Skip to content

Commit ce7f385

Browse files
committed
Fix: Maven plugin incorrectly prints warning about default resources directory. Fix few typos in warning messages.
1 parent 3004cf3 commit ce7f385

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_gradle_plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ def check_gradle_generated_app(self, community):
133133
cmd = gradlew_cmd + ["build"]
134134
out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir, logger=log)
135135
util.check_ouput("BUILD SUCCESS", out, logger=log)
136+
util.check_ouput("Virtual filesystem is deployed to default resources directory", out, logger=log)
137+
util.check_ouput("This can cause conflicts if used with other Java libraries that also deploy GraalPy virtual filesystem", out, logger=log)
136138
self.check_filelist(target_dir, log)
137139

138140
cmd = gradlew_cmd + ["nativeCompile"]
@@ -413,7 +415,7 @@ def check_gradle_python_resources_dir_and_external_dir_error(self):
413415
gradle_cmd = util.get_gradle_wrapper(target_dir, self.env)
414416
cmd = gradle_cmd + ["graalPyResources"]
415417
out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir)
416-
util.check_ouput("Cannot set both 'externalDirectory' and 'resourcesDirectory' at the same time", out)
418+
util.check_ouput("Cannot set both 'externalDirectory' and 'resourceDirectory' at the same time", out)
417419
assert return_code != 0, out
418420

419421

@@ -478,6 +480,8 @@ def check_gradle_namespaced_vfs(self):
478480

479481
app1_gradle_cmd = util.get_gradle_wrapper(app1_dir, self.env)
480482
out, return_code = util.run_cmd(app1_gradle_cmd + ['publishToMavenLocal'], self.env, cwd=app1_dir)
483+
util.check_ouput("Virtual filesystem is deployed to default resources directory", out, contains=False)
484+
util.check_ouput("This can cause conflicts if used with other Java libraries that also deploy GraalPy virtual filesystem", out, contains=False)
481485
assert return_code == 0, out
482486

483487
app2_gradle_cmd = util.get_gradle_wrapper(app2_dir, self.env)

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_maven_plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def check_generated_app(self, use_default_vfs_path, use_utils_pkg=False):
115115
cmd = mvnw_cmd + ["package", "-Pnative", "-DmainClass=it.pkg.GraalPy"]
116116
out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir)
117117
util.check_ouput("BUILD SUCCESS", out)
118+
util.check_ouput("Virtual filesystem is deployed to default resources directory", out, contains=use_default_vfs_path)
119+
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)
118120

119121
# check fileslist.txt
120122
fl_path = os.path.join(target_dir, "target", "classes", vfs_prefix, "fileslist.txt")

graalpython/graalpy-maven-plugin/src/main/java/org/graalvm/python/maven/plugin/ManageResourcesMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void execute() throws MojoExecutionException {
145145
}
146146

147147
if (resourceDirectory == null) {
148-
if (externalDirectory != null) {
148+
if (externalDirectory == null) {
149149
getLog().info(String.format("Virtual filesystem is deployed to default resources directory '%s'. " +
150150
"This can cause conflicts if used with other Java libraries that also deploy GraalPy virtual filesystem. " +
151151
"Consider adding <resourceDirectory>GRAALPY-VFS/${project.groupId}/${project.artifactId}</resourceDirectory> to your pom.xml, " +
@@ -162,7 +162,7 @@ public void execute() throws MojoExecutionException {
162162
getLog().warn("The GraalPy plugin <pythonHome> configuration setting was deprecated and has no effect anymore.\n" +
163163
"For execution in jvm mode, the python language home is always available.\n" +
164164
"When building a native executable using GraalVM Native Image, then the full python language home is by default embedded into the native executable.\n" +
165-
"For more details, please refer to the documentation of GraalVM Native Image options IncludeLanguageResources and CopyLanguageResources documentation.");
165+
"For more details, please refer to the documentation of GraalVM Native Image options IncludeLanguageResources and CopyLanguageResources.");
166166
}
167167

168168
manageVenv();

graalpython/org.graalvm.python.gradle.plugin/src/main/java/org/graalvm/python/GraalPyGradlePlugin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ public void apply(Project project) {
117117

118118
if (extension.getPythonResourcesDirectory().isPresent() && extension.getExternalDirectory().isPresent()) {
119119
throw new GradleException(
120-
"Cannot set both 'externalDirectory' and 'resourcesDirectory' at the same time. " +
120+
"Cannot set both 'externalDirectory' and 'resourceDirectory' at the same time. " +
121121
"New property 'externalDirectory' is a replacement for deprecated 'pythonResourcesDirectory'. " +
122122
"If you want to deploy the virtual environment into physical filesystem, use 'externalDirectory'. " +
123123
"The deployment of the external directory alongside the application is not handled by the GraalPy Maven plugin in such case." +
124-
"If you wish to bundle the virtual filesystem in Java resources, use 'resourcesDirectory'. " +
124+
"If you wish to bundle the virtual filesystem in Java resources, use 'resourceDirectory'. " +
125125
"For more details, please refer to https://www.graalvm.org/latest/reference-manual/python/Embedding-Build-Tools. ");
126126
}
127127

@@ -132,9 +132,9 @@ public void apply(Project project) {
132132
// Run the vfsFilesListTask conditionally only if 'externalDirectory' is not set
133133
if (!extension.getPythonResourcesDirectory().isPresent() && !extension.getExternalDirectory().isPresent()) {
134134
if (!extension.getResourceDirectory().isPresent()) {
135-
proj.getLogger().info(String.format("Virtual filesystem is deployed to default resources directory '%s'. " +
135+
proj.getLogger().warn(String.format("Virtual filesystem is deployed to default resources directory '%s'. " +
136136
"This can cause conflicts if used with other Java libraries that also deploy GraalPy virtual filesystem. " +
137-
"Consider adding `resourcesDirectory = \"GRAALPY-VFS/${groupId}/${artifactId}\"` to your build.gradle script " +
137+
"Consider adding `resourceDirectory = \"GRAALPY-VFS/${groupId}/${artifactId}\"` to your build.gradle script " +
138138
"(replace the placeholders with values specific to your project), " +
139139
"moving any existing sources from '%s' to '%s', and using VirtualFileSystem$Builder#resourceDirectory." +
140140
"For more details, please refer to https://www.graalvm.org/latest/reference-manual/python/Embedding-Build-Tools. ",
@@ -192,7 +192,7 @@ private TaskProvider<ResourcesTask> registerResourcesTask(Project project, Confi
192192
t.getLogger().warn("The GraalPy plugin pythonHome configuration setting was deprecated and has no effect anymore.\n" +
193193
"For execution in jvm mode, the python language home is always available.\n" +
194194
"When building a native executable using GraalVM Native Image, then the full python language home is by default embedded into the native executable.\n" +
195-
"For more details, please refer to the documentation of GraalVM Native Image options IncludeLanguageResources and CopyLanguageResources documentation.");
195+
"For more details, please refer to the documentation of GraalVM Native Image options IncludeLanguageResources and CopyLanguageResources.");
196196
}
197197
t.getPackages().set(extension.getPackages());
198198

0 commit comments

Comments
 (0)