From 1c250b16c6eaa42e43394b38ce89605bc0c35a44 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sun, 28 Jul 2024 12:16:34 +0200 Subject: [PATCH] [PDE-Build] Use first supported version as default javac target/source Generalization of https://github.com/eclipse-pde/eclipse.pde/pull/1351 --- .../build/builder/ModelBuildScriptGenerator.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java b/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java index 97abe5e378..ad5c0ec233 100644 --- a/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java +++ b/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java @@ -34,6 +34,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry; +import org.eclipse.jdt.core.JavaCore; import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.osgi.service.resolver.HostSpecification; import org.eclipse.osgi.service.resolver.State; @@ -1067,10 +1068,12 @@ private void generateCompilerSettings() throws CoreException { script.printProperty(PROPERTY_JAVAC_COMPILERARG, ""); //$NON-NLS-1$ script.printProperty(PROPERTY_PREREQ_COMPILE_LOG, Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + "/prereqErrors.log"); //$NON-NLS-1$ - if (javacSource == null) - script.printProperty(IXMLConstants.PROPERTY_JAVAC_SOURCE, "1.8"); //$NON-NLS-1$ - if (javacTarget == null) - script.printProperty(IXMLConstants.PROPERTY_JAVAC_TARGET, "1.8"); //$NON-NLS-1$ + if (javacSource == null) { + script.printProperty(IXMLConstants.PROPERTY_JAVAC_SOURCE, JavaCore.getFirstJavaSourceVersionSupportedByCompiler()); + } + if (javacTarget == null) { + script.printProperty(IXMLConstants.PROPERTY_JAVAC_TARGET, JavaCore.getFirstJavaSourceVersionSupportedByCompiler()); + } if (bootClasspath == null) { script.println("");//$NON-NLS-1$ script.println("\t"); //$NON-NLS-1$