|
51 | 51 | MISSING_FILE_WARNING = "The list of installed Python packages does not match the packages specified in the graalpy-maven-plugin configuration." |
52 | 52 | PACKAGES_CHANGED_ERROR = "but packages and their version constraints in graalpy-maven-plugin configuration are different then previously used to generate the lock file" |
53 | 53 | VENV_UPTODATE = "Virtual environment is up to date with lock file, skipping install" |
| 54 | +DEPRECATION_MSG = "Deprecated artifact detected on classpath" |
54 | 55 |
|
55 | 56 | class MavenPluginTest(util.BuildToolTestBase): |
56 | 57 | @classmethod |
@@ -204,6 +205,7 @@ def check_generated_app(self, use_default_vfs_path): |
204 | 205 | util.check_ouput("BUILD SUCCESS", out, logger=log) |
205 | 206 | util.check_ouput("Virtual filesystem is deployed to default resources directory", out, contains=use_default_vfs_path, logger=log) |
206 | 207 | util.check_ouput("This can cause conflicts if used with other Java libraries that also deploy GraalPy virtual filesystem.", out, contains=use_default_vfs_path, logger=log) |
| 208 | + util.check_ouput(DEPRECATION_MSG, out, contains=False, logger=log) |
207 | 209 |
|
208 | 210 | # check fileslist.txt |
209 | 211 | fl_path = os.path.join(target_dir, "target", "classes", vfs_prefix, "fileslist.txt") |
@@ -310,6 +312,7 @@ def test_lock_file(self): |
310 | 312 | out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir) |
311 | 313 | util.check_ouput("pip install", out) |
312 | 314 | util.check_ouput("BUILD SUCCESS", out) |
| 315 | + util.check_ouput(DEPRECATION_MSG, out, contains=False) |
313 | 316 | util.check_ouput(MISSING_FILE_WARNING, out, contains=True) |
314 | 317 | assert not os.path.exists(os.path.join(target_dir, "test-graalpy.lock")) |
315 | 318 |
|
@@ -411,6 +414,7 @@ def test_generated_app_external_resources(self): |
411 | 414 | cmd = mvnw_cmd + ["package"] + native_image_arg + ["-DmainClass=it.pkg.GraalPy"] |
412 | 415 | out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir) |
413 | 416 | util.check_ouput("BUILD SUCCESS", out) |
| 417 | + util.check_ouput(DEPRECATION_MSG, out, contains=False) |
414 | 418 |
|
415 | 419 | # execute and check JVM mode |
416 | 420 | cmd = mvnw_cmd + ["exec:java", "-Dexec.mainClass=it.pkg.GraalPy"] |
@@ -448,7 +452,7 @@ def test_fail_without_graalpy_dep(self): |
448 | 452 |
|
449 | 453 | cmd = mvnw_cmd + ["process-resources"] |
450 | 454 | out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir) |
451 | | - util.check_ouput("Missing GraalPy dependency. Please add to your pom either org.graalvm.polyglot:python-community or org.graalvm.polyglot:python", out) |
| 455 | + util.check_ouput("Missing GraalPy dependency. Please add to your pom org.graalvm.polyglot:python", out) |
452 | 456 |
|
453 | 457 |
|
454 | 458 | def test_check_home_warning(self): |
@@ -835,6 +839,26 @@ def test_multiple_namespaced_vfs(self): |
835 | 839 | assert return_code == 0, log |
836 | 840 |
|
837 | 841 |
|
| 842 | + def test_community_dep_deprecation_message(self): |
| 843 | + with util.TemporaryTestDirectory() as tmpdir: |
| 844 | + target_name = "community_dep_deprecation_test" |
| 845 | + target_dir = os.path.join(str(tmpdir), target_name) |
| 846 | + self.generate_app(tmpdir, target_dir, target_name) |
| 847 | + |
| 848 | + mvnw_cmd = util.get_mvn_wrapper(target_dir, self.env) |
| 849 | + pom_path = os.path.join(target_dir, "pom.xml") |
| 850 | + |
| 851 | + # Force community edition on classpath by replacing python with python-community in the generated POM |
| 852 | + util.replace_in_file(pom_path, "<artifactId>python</artifactId>", "<artifactId>python-community</artifactId>") |
| 853 | + util.replace_in_file(pom_path, "org.graalvm.python:python", "org.graalvm.python:python-community") |
| 854 | + util.replace_in_file(pom_path, "org.graalvm.polyglot:python", "org.graalvm.polyglot:python-community") |
| 855 | + |
| 856 | + # Run a goal that triggers the plugin resolution |
| 857 | + cmd = mvnw_cmd + ["process-resources"] |
| 858 | + out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir) |
| 859 | + # Expect deprecation message for python-community |
| 860 | + util.check_ouput(DEPRECATION_MSG, out, contains=True) |
| 861 | + |
838 | 862 | if __name__ == "__main__": |
839 | 863 | run_path = os.path.join(os.path.abspath(__file__), 'run.py') |
840 | 864 | print(f"Run this file using the run.py driver ({run_path})") |
0 commit comments