@@ -139,6 +139,50 @@ def test_generated_app(self):
139
139
util .check_ouput ("Deleting GraalPy venv due to changed launcher path" , out )
140
140
util .check_ouput ("hello java" , out )
141
141
142
+ @unittest .skipUnless (util .is_maven_plugin_test_enabled , "ENABLE_MAVEN_PLUGIN_UNITTESTS is not true" )
143
+ def test_generated_app_utils_pkg (self ):
144
+ # check if java classes from the deprecated embedding.utils pkg work as expected
145
+ with util .TemporaryTestDirectory () as tmpdir :
146
+
147
+ target_name = "generated_app_test_utils_pkg"
148
+ target_dir = os .path .join (str (tmpdir ), target_name )
149
+ self .generate_app (tmpdir , target_dir , target_name )
150
+
151
+ util .replace_in_file (os .path .join (target_dir , "src" , "main" , "java" , "it" , "pkg" , "GraalPy.java" ),
152
+ "import org.graalvm.python.embedding.GraalPyResources;" ,
153
+ "import org.graalvm.python.embedding.utils.GraalPyResources;" )
154
+
155
+ mvnw_cmd = util .get_mvn_wrapper (target_dir , self .env )
156
+
157
+ # build
158
+ cmd = mvnw_cmd + ["package" , "-Pnative" , "-DmainClass=it.pkg.GraalPy" ]
159
+ out , return_code = util .run_cmd (cmd , self .env , cwd = target_dir )
160
+ util .check_ouput ("BUILD SUCCESS" , out )
161
+
162
+ # check fileslist.txt
163
+ fl_path = os .path .join (target_dir , "target" , "classes" , util .VFS_PREFIX , "fileslist.txt" )
164
+ with open (fl_path ) as f :
165
+ lines = f .readlines ()
166
+ assert "/" + util .VFS_PREFIX + "/\n " in lines , "unexpected output from " + str (cmd )
167
+
168
+ # execute and check native image
169
+ cmd = [os .path .join (target_dir , "target" , target_name )]
170
+ out , return_code = util .run_cmd (cmd , self .env , cwd = target_dir )
171
+ util .check_ouput ("hello java" , out )
172
+
173
+ # 2.) check java build and exec
174
+ # run with java asserts on
175
+ if self .env .get ("MAVEN_OPTS" ):
176
+ self .env ["MAVEN_OPTS" ] = self .env .get ("MAVEN_OPTS" ) + " -ea -esa"
177
+ else :
178
+ self .env ["MAVEN_OPTS" ] = "-ea -esa"
179
+
180
+ # rebuild and exec
181
+ cmd = mvnw_cmd + ["package" , "exec:java" , "-Dexec.mainClass=it.pkg.GraalPy" ]
182
+ out , return_code = util .run_cmd (cmd , self .env , cwd = target_dir )
183
+ util .check_ouput ("BUILD SUCCESS" , out )
184
+ util .check_ouput ("hello java" , out )
185
+
142
186
@unittest .skipUnless (util .is_maven_plugin_test_enabled , "ENABLE_MAVEN_PLUGIN_UNITTESTS is not true" )
143
187
def test_generated_app_external_resources (self ):
144
188
with util .TemporaryTestDirectory () as tmpdir :
@@ -278,7 +322,7 @@ def test_check_home(self):
278
322
log = Logger ()
279
323
util .replace_in_file (os .path .join (target_dir , "pom.xml" ), "<fallback>false</fallback>" ,
280
324
textwrap .dedent ("""<systemProperties>
281
- <org.graalvm.python.resources.include>.*</org.graalvm.python.resources.include>
325
+ <org.graalvm.python.resources.include>.*</org.graalvm.python.resources.include>
282
326
<org.graalvm.python.resources.log>true</org.graalvm.python.resources.log>
283
327
</systemProperties>
284
328
<fallback>false</fallback>""" ))
0 commit comments