|
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 |
@@ -134,8 +135,9 @@ def setUpClass(cls): |
134 | 135 | if util.extra_maven_repos and not found and not cls.extraRemoteRepo: |
135 | 136 | print("WARNING: extra Maven repos passed, but could not find GraalPy Maven archetype " |
136 | 137 | "in any of the local repos and there is no extra remote repo. This is OK only if " |
137 | | - "GraalPy Maven archetype of the required version is available at Mavencentral, " |
138 | | - "otherwise the tests will fail to generate the example application.") |
| 138 | + "GraalPy Maven archetype of the required version is available at Mavencentral or " |
| 139 | + "it is installed in local repo, otherwise the tests will fail to generate the " |
| 140 | + "example application.") |
139 | 141 |
|
140 | 142 | def generate_app(self, tmpdir, target_dir, target_name, pom_template=None, group_id="archetype.it", package="it.pkg", log=Logger()): |
141 | 143 | extra_repo = [] |
@@ -204,6 +206,7 @@ def check_generated_app(self, use_default_vfs_path): |
204 | 206 | util.check_ouput("BUILD SUCCESS", out, logger=log) |
205 | 207 | util.check_ouput("Virtual filesystem is deployed to default resources directory", out, contains=use_default_vfs_path, logger=log) |
206 | 208 | 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) |
| 209 | + util.check_ouput(DEPRECATION_MSG, out, contains=False, logger=log) |
207 | 210 |
|
208 | 211 | # check fileslist.txt |
209 | 212 | fl_path = os.path.join(target_dir, "target", "classes", vfs_prefix, "fileslist.txt") |
@@ -310,6 +313,7 @@ def test_lock_file(self): |
310 | 313 | out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir) |
311 | 314 | util.check_ouput("pip install", out) |
312 | 315 | util.check_ouput("BUILD SUCCESS", out) |
| 316 | + util.check_ouput(DEPRECATION_MSG, out, contains=False) |
313 | 317 | util.check_ouput(MISSING_FILE_WARNING, out, contains=True) |
314 | 318 | assert not os.path.exists(os.path.join(target_dir, "test-graalpy.lock")) |
315 | 319 |
|
@@ -411,6 +415,7 @@ def test_generated_app_external_resources(self): |
411 | 415 | cmd = mvnw_cmd + ["package"] + native_image_arg + ["-DmainClass=it.pkg.GraalPy"] |
412 | 416 | out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir) |
413 | 417 | util.check_ouput("BUILD SUCCESS", out) |
| 418 | + util.check_ouput(DEPRECATION_MSG, out, contains=False) |
414 | 419 |
|
415 | 420 | # execute and check JVM mode |
416 | 421 | cmd = mvnw_cmd + ["exec:java", "-Dexec.mainClass=it.pkg.GraalPy"] |
@@ -448,7 +453,7 @@ def test_fail_without_graalpy_dep(self): |
448 | 453 |
|
449 | 454 | cmd = mvnw_cmd + ["process-resources"] |
450 | 455 | 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) |
| 456 | + util.check_ouput("Missing GraalPy dependency. Please add to your pom org.graalvm.polyglot:python", out) |
452 | 457 |
|
453 | 458 |
|
454 | 459 | def test_check_home_warning(self): |
@@ -835,6 +840,21 @@ def test_multiple_namespaced_vfs(self): |
835 | 840 | assert return_code == 0, log |
836 | 841 |
|
837 | 842 |
|
| 843 | + def test_community_dep_deprecation_message(self): |
| 844 | + with util.TemporaryTestDirectory() as tmpdir: |
| 845 | + target_name = "community_dep_deprecation_test" |
| 846 | + target_dir = os.path.join(str(tmpdir), target_name) |
| 847 | + self.generate_app(tmpdir, target_dir, target_name) |
| 848 | + |
| 849 | + mvnw_cmd = util.get_mvn_wrapper(target_dir, self.env) |
| 850 | + pom_path = os.path.join(target_dir, "pom.xml") |
| 851 | + |
| 852 | + util.replace_in_file(pom_path, "<artifactId>python</artifactId>", "<artifactId>python-community</artifactId>") |
| 853 | + |
| 854 | + cmd = mvnw_cmd + ["process-resources"] |
| 855 | + out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir) |
| 856 | + util.check_ouput(DEPRECATION_MSG, out, contains=True) |
| 857 | + |
838 | 858 | if __name__ == "__main__": |
839 | 859 | run_path = os.path.join(os.path.abspath(__file__), 'run.py') |
840 | 860 | print(f"Run this file using the run.py driver ({run_path})") |
0 commit comments