diff options
| author | Vikas Chandra | 2019-03-05 05:40:49 +0000 |
|---|---|---|
| committer | Vikas Chandra | 2019-03-05 08:56:04 +0000 |
| commit | b82765c4469b663022f4d9a1c532c4c6a227b627 (patch) | |
| tree | 789c0c323970f29302f4bbcb932cf4cc073fb8ce | |
| parent | ce181a6fd57fef37eabcdf41b8a5601833f8c21b (diff) | |
| download | eclipse.pde.build-b82765c4469b663022f4d9a1c532c4c6a227b627.tar.gz eclipse.pde.build-b82765c4469b663022f4d9a1c532c4c6a227b627.tar.xz eclipse.pde.build-b82765c4469b663022f4d9a1c532c4c6a227b627.zip | |
Bug 544038 - Export Plug-ins fails with Host plug-in JavaSE_0.0.0 hasS4_11_0_RC2R4_11I20190307-0500I20190306-2135I20190306-1800I20190306-0600I20190305-1800I20190305-0600R4_11_maintenance
not been found.
Change-Id: Idfe9b5494885c89e1fd2d26bb5e81f14920b96f7
Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
5 files changed, 99 insertions, 7 deletions
diff --git a/org.eclipse.pde.build/META-INF/MANIFEST.MF b/org.eclipse.pde.build/META-INF/MANIFEST.MF index 0cb33e1a..2a16c6f8 100644 --- a/org.eclipse.pde.build/META-INF/MANIFEST.MF +++ b/org.eclipse.pde.build/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.pde.build;singleton:=true -Bundle-Version: 3.10.200.qualifier +Bundle-Version: 3.10.300.qualifier Bundle-ClassPath: pdebuild.jar Bundle-Activator: org.eclipse.pde.internal.build.BuildActivator Bundle-Vendor: %providerName diff --git a/org.eclipse.pde.build/pom.xml b/org.eclipse.pde.build/pom.xml index 5c457bc3..5d622d95 100644 --- a/org.eclipse.pde.build/pom.xml +++ b/org.eclipse.pde.build/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2012, 2017 Eclipse Foundation and others. + Copyright (c) 2012, 2019 Eclipse Foundation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Distribution License v1.0 which accompanies this distribution, and is available at @@ -18,6 +18,6 @@ </parent> <groupId>org.eclipse.pde</groupId> <artifactId>org.eclipse.pde.build</artifactId> - <version>3.10.200-SNAPSHOT</version> + <version>3.10.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java index 87dcaf5d..72afcf10 100644 --- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java +++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which accompanies this distribution, @@ -1545,7 +1545,30 @@ public class ModelBuildScriptGenerator extends AbstractBuildScriptGenerator { script.printComment("compile the source code"); //$NON-NLS-1$ JavacTask javac = new JavacTask(); javac.setClasspathId(name + PROPERTY_CLASSPATH); - javac.setBootClasspath(Utils.getPropertyFormat(PROPERTY_BUNDLE_BOOTCLASSPATH)); + String[] executionEnvironments = model.getExecutionEnvironments(); + boolean isModular = false; + // 1 execution env associated with the model + if (executionEnvironments.length == 1) { + String ee = executionEnvironments[0]; + ProfileManager profileManager = null; + try { + profileManager = getSite(false).getRegistry().getProfileManager(); + } catch (CoreException e) { + //nothing to do, will assume non-modular + } + String source = null; + if (profileManager != null) + source = profileManager.getJavacSource(ee); + int parseInt = -1; + try { + parseInt = Integer.parseInt(source); + } catch (NumberFormatException ne) { + //by default non-modular for 1.8 etc and below + } + if (parseInt >= 9) + isModular = true; + } + javac.setBootClasspath(isModular == true ? null : Utils.getPropertyFormat(PROPERTY_BUNDLE_BOOTCLASSPATH)); javac.setDestdir(destdir); javac.setFailOnError(Utils.getPropertyFormat(PROPERTY_JAVAC_FAIL_ON_ERROR)); javac.setDebug(Utils.getPropertyFormat(PROPERTY_JAVAC_DEBUG_INFO)); diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java index dfb3f435..c8519069 100644 --- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java +++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/PDEState.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2017 IBM Corporation and others. + * Copyright (c) 2004, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,6 +14,8 @@ package org.eclipse.pde.internal.build.site; import java.io.*; +import java.net.URL; +import java.net.URLConnection; import java.util.*; import java.util.jar.JarFile; import java.util.zip.ZipEntry; @@ -407,6 +409,7 @@ public class PDEState implements IPDEBuildConstants, IBuildPropertiesConstants { Properties profileProps = null; boolean added = false; + String eeJava9 = null; //javaProfiles are sorted, go in reverse order, and if when we hit 0 we haven't added any yet, //then add that last profile so we have something. for (int j = javaProfiles.length - 1; j >= 0; j--) { @@ -420,12 +423,36 @@ public class PDEState implements IPDEBuildConstants, IBuildPropertiesConstants { prop = new Hashtable<>(); prop.put(ProfileManager.SYSTEM_PACKAGES, systemPackages); + if (profileName.equals("JavaSE-9")) { //$NON-NLS-1$ + eeJava9 = ee; + } prop.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee); properties.add(prop); added = true; } } } + // from java 10 and beyond + String[] java10AndBeyond = {"JavaSE-10", "JavaSE-11"}; //$NON-NLS-1$//$NON-NLS-2$ + prop = new Hashtable<>(); + String previousEE = eeJava9; + for (int i = 0; i <= java10AndBeyond.length - 1; i++) { + String execEnvID = java10AndBeyond[i]; + prop = new Hashtable<>(); + Properties javaProfilePropertiesForVMPackage = getJavaProfilePropertiesForVMPackage(execEnvID); + if (javaProfilePropertiesForVMPackage != null) { + systemPackages = javaProfilePropertiesForVMPackage.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); + } + String currentEE = previousEE + "," + execEnvID; //$NON-NLS-1$ + if (systemPackages == null) { + previousEE = currentEE; + continue; + } + prop.put(ProfileManager.SYSTEM_PACKAGES, systemPackages); + prop.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, currentEE); + previousEE = currentEE; + properties.add(prop); + } Dictionary<String, Object>[] stateProperties = properties.toArray(new Dictionary[properties.size()]); state.setPlatformProperties(stateProperties); @@ -717,4 +744,43 @@ public class PDEState implements IPDEBuildConstants, IBuildPropertiesConstants { } return profileManager; } + + private static Properties getJavaProfilePropertiesForVMPackage(String ee) { + Bundle apitoolsBundle = Platform.getBundle("org.eclipse.pde.api.tools"); //$NON-NLS-1$ + if (apitoolsBundle == null) { + return null; + } + URL systemPackageProfile = apitoolsBundle.getEntry("system_packages" + '/' + ee.replace('/', '_') + "-systempackages.profile"); //$NON-NLS-1$ //$NON-NLS-2$ + if (systemPackageProfile != null) { + return getPropertiesFromURL(systemPackageProfile); + + } + return null; + } + + private static Properties getPropertiesFromURL(URL profileURL) { + InputStream is = null; + try { + profileURL = FileLocator.resolve(profileURL); + URLConnection openConnection = profileURL.openConnection(); + openConnection.setUseCaches(false); + is = openConnection.getInputStream(); + if (is != null) { + Properties profile = new Properties(); + profile.load(is); + return profile; + } + } catch (IOException e) { + // nothing to do + } finally { + try { + if (is != null) { + is.close(); + } + } catch (IOException e) { + // nothing to do + } + } + return null; + } } diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/ProfileManager.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/ProfileManager.java index b37306c1..090db436 100644 --- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/ProfileManager.java +++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/ProfileManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 2019 IBM Corporation and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which accompanies this distribution, @@ -73,6 +73,9 @@ public class ProfileManager { Properties properties = profileMap.get(environment); return properties.getProperty(PROFILE_JAVAC_SOURCE); } + if (environment.startsWith("JavaSE-")) { //$NON-NLS-1$ + return environment.replace("JavaSE-", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } return null; } |
