sjvanrossum commented on code in PR #34915:
URL: https://github.com/apache/beam/pull/34915#discussion_r2093213865


##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -1845,21 +1674,7 @@ class BeamModulePlugin implements Plugin<Project> {
       project.ext.includeInJavaBom = configuration.publish
       project.ext.exportJavadoc = configuration.exportJavadoc
 
-      boolean publishEnabledByCommand = isRelease(project) || 
project.hasProperty('publishing')
-      if (forkJavaVersion == '') {
-        // project needs newer version and not served.
-        // If not publishing ,disable the project. Otherwise, fail the build
-        def msg = "project ${project.name} needs newer Java version to 
compile. Consider set -Pjava${project.javaVersion}Home"
-        if (publishEnabledByCommand) {
-          throw new GradleException("Publish enabled but " + msg + ".")

Review Comment:
   I added a commit to select the minimum language version when the requested 
language version is incompatible. When a suitable toolchain can't be discovered 
this will still result in a build failure.
   ```
   > Configure project :sdks:java:container:agent
   Requested a toolchain for language version 11 because a toolchain for 
language version 8 is incompatible with the minimum supported language version.
   
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Could not determine the dependencies of task 
':sdks:java:container:agent:compileJava'.
   > Failed to query the value of extension 'errorprone' property 'enabled'.
      > Failed to calculate the value of task 
':sdks:java:container:agent:compileJava' property 'javaCompiler'.
         > No matching toolchains found for requested specification: 
{languageVersion=11, vendor=any, implementation=vendor-specific} for MAC_OS on 
aarch64.
            > No locally installed toolchains match and toolchain 
auto-provisioning is not enabled.
   
   * Try:
   > Learn more about toolchain auto-detection at 
https://docs.gradle.org/8.4/userguide/toolchains.html#sec:auto_detection.
   > Run with --stacktrace option to get the stack trace.
   > Run with --info or --debug option to get more log output.
   > Get more help at https://help.gradle.org.
   
   BUILD FAILED in 7s
   ```
   
   If a compatible toolchain can be discovered (e.g. requested Java 8, but 
provided both Java 8 and Java 11 toolchain locations) then it still prints a 
warning, but the build will succeed with a successful build of the affected 
project instead of skipping it. The requested build target depends on that 
incompatible target so we should ensure that it builds.
   ```
   > Configure project :sdks:java:container:agent
   Requested a toolchain for language version 11 because a toolchain for 
language version 8 is incompatible with the minimum supported language version.
   
   BUILD SUCCESSFUL in 8s
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to