@@ -28,7 +28,63 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
28
28
directory(" src/main/java/com/palantir/test" )
29
29
file(" src/main/java/com/palantir/test/Main.java" ) << '''
30
30
package com.palantir.test;
31
-
31
+
32
+ public final class Main {
33
+ public static final void main(String[] args) {
34
+ System.out.println("hello, world!");
35
+ }
36
+ }
37
+ '''
38
+
39
+ buildFile << '''
40
+ apply plugin: 'com.palantir.graal'
41
+
42
+ graal {
43
+ mainClass 'com.palantir.test.Main'
44
+ outputName 'hello-world'
45
+ }
46
+ '''
47
+
48
+ when :
49
+ ExecutionResult result = runTasksSuccessfully(' nativeImage' ) // note, this accesses your real ~/.gradle cache
50
+ println " Gradle Standard Out:\n " + result. standardOutput
51
+ println " Gradle Standard Error:\n " + result. standardError
52
+ File output = new File (getProjectDir(), " build/graal/hello-world" );
53
+
54
+ then :
55
+ output. exists()
56
+ output. getAbsolutePath(). execute(). text. equals(" hello, world!\n " )
57
+
58
+ when :
59
+ ExecutionResult result2 = runTasksSuccessfully(' nativeImage' )
60
+
61
+ then :
62
+ result2. wasUpToDate(' :nativeImage' )
63
+
64
+ when :
65
+ new File (getProjectDir(), " src/main/java/com/palantir/test/Main.java" ). text = '''
66
+ package com.palantir.test;
67
+
68
+ public final class Main {
69
+ public static final void main(String[] args) {
70
+ System.out.println("hello, world (modified)!");
71
+ }
72
+ }
73
+ '''
74
+ ExecutionResult result3 = runTasksSuccessfully(' nativeImage' )
75
+
76
+ then :
77
+ println result3. standardOutput
78
+ ! result3. wasUpToDate(' :nativeImage' )
79
+ output. getAbsolutePath(). execute(). text. equals(" hello, world (modified)!\n " )
80
+ }
81
+
82
+ def ' test 1.0.0-rc5 nativeImage' () {
83
+ setup :
84
+ directory(" src/main/java/com/palantir/test" )
85
+ file(" src/main/java/com/palantir/test/Main.java" ) << '''
86
+ package com.palantir.test;
87
+
32
88
public final class Main {
33
89
public static final void main(String[] args) {
34
90
System.out.println("hello, world!");
@@ -65,7 +121,7 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
65
121
when :
66
122
new File (getProjectDir(), " src/main/java/com/palantir/test/Main.java" ). text = '''
67
123
package com.palantir.test;
68
-
124
+
69
125
public final class Main {
70
126
public static final void main(String[] args) {
71
127
System.out.println("hello, world (modified)!");
@@ -85,10 +141,10 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
85
141
directory(" src/main/java/com/palantir/test" )
86
142
file(" src/main/java/com/palantir/test/Main.java" ) << '''
87
143
package com.palantir.test;
88
-
144
+
89
145
import java.io.IOException;
90
146
import java.net.URL;
91
-
147
+
92
148
public final class Main {
93
149
public static final void main(String[] args) throws IOException {
94
150
String result = convertStreamToString(new URL("http://www.google.com/").openStream());
@@ -125,8 +181,29 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
125
181
output. getAbsolutePath(). execute(). text. toLowerCase(). contains(" <html" )
126
182
}
127
183
184
+ def ' can build shared libraries on default version' () {
185
+ setup :
186
+ directory(" src/main/java/com/palantir/test" )
187
+ file(" src/main/java/com/palantir/test/Main.java" ) << '''
188
+ package com.palantir.test;
189
+ public final class Main {}
190
+ '''
191
+ buildFile << '''
192
+ apply plugin: 'com.palantir.graal'
193
+ graal {
194
+ outputName 'hello-world'
195
+ }
196
+ '''
197
+
198
+ when :
199
+ runTasksSuccessfully(' sharedLibrary' )
200
+ File dylibFile = new File (getProjectDir(), " build/graal/hello-world." + getSharedLibPrefixByOs())
201
+
202
+ then :
203
+ dylibFile. exists()
204
+ }
128
205
129
- def ' can build shared libraries' () {
206
+ def ' can build shared libraries on 1.0.0-rc5 ' () {
130
207
setup :
131
208
directory(" src/main/java/com/palantir/test" )
132
209
file(" src/main/java/com/palantir/test/Main.java" ) << '''
0 commit comments