@@ -296,7 +296,8 @@ def test_gradle_generated_app_external_resources(self):
296
296
os .makedirs (src_dir , exist_ok = True )
297
297
# copy hello.py
298
298
shutil .copyfile (os .path .join (target_dir , "src" , "main" , "resources" , "org.graalvm.python.vfs" , "src" , "hello.py" ), os .path .join (src_dir , "hello.py" ))
299
- shutil .rmtree (os .path .join (target_dir , "src" , "main" , "resources" , "org.graalvm.python.vfs" ))
299
+ # remove all resources, we also want to check if the gradle plugin can deal with no user resources
300
+ shutil .rmtree (os .path .join (target_dir , "src" , "main" , "resources" ))
300
301
# patch GraalPy.java
301
302
util .replace_in_file (os .path .join (target_dir , "src" , "main" , "java" , "org" , "example" , "GraalPy.java" ),
302
303
"package org.example;" ,
@@ -315,6 +316,16 @@ def test_gradle_generated_app_external_resources(self):
315
316
out , return_code = util .run_cmd (cmd , self .env , cwd = target_dir , gradle = True )
316
317
util .check_ouput ("BUILD SUCCESS" , out )
317
318
319
+ # check java exec
320
+ cmd = gradle_cmd + ["run" ]
321
+ out , return_code = util .run_cmd (cmd , self .env , cwd = target_dir , gradle = True )
322
+ util .check_ouput ("hello java" , out )
323
+
324
+ # prepare for native build
325
+ meta_inf = os .path .join (target_dir , "src" , "main" , "resources" , "META-INF" , "native-image" )
326
+ os .makedirs (meta_inf , exist_ok = True )
327
+ shutil .copyfile (os .path .join (self .test_prj_path , "src" , "main" , "resources" , "META-INF" , "native-image" , "proxy-config.json" ), os .path .join (meta_inf , "proxy-config.json" ))
328
+
318
329
# gradle needs jdk <= 22, but it looks like the 'gradle nativeCompile' cmd does not complain if higher,
319
330
# which is fine, because we need to build the native binary with a graalvm build
320
331
# and the one we have set in JAVA_HOME is at least jdk24
@@ -328,12 +339,6 @@ def test_gradle_generated_app_external_resources(self):
328
339
out , return_code = util .run_cmd (cmd , self .env , cwd = target_dir )
329
340
util .check_ouput ("hello java" , out )
330
341
331
- # 2.) check java build and exec
332
- cmd = gradle_cmd + ["run" ]
333
- out , return_code = util .run_cmd (cmd , self .env , cwd = target_dir , gradle = True )
334
- util .check_ouput ("BUILD SUCCESS" , out )
335
- util .check_ouput ("hello java" , out )
336
-
337
342
@unittest .skipUnless (is_gradle_enabled , "ENABLE_GRADLE_STANDALONE_UNITTESTS is not true" )
338
343
def test_gradle_fail_without_graalpy_dep (self ):
339
344
with tempfile .TemporaryDirectory () as tmpdir :
0 commit comments