Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Sievers2014-06-27 11:14:32 -0400
committerTobias Oberlies2014-09-30 03:24:10 -0400
commitb699e6c4b09203c4a87c03b8085af441087b2c71 (patch)
treead37f64ca0aa84883a1953ea929978776ddf8a28
parent9ac358fe4f777b6526b90dd8645b863ab14243fe (diff)
downloadorg.eclipse.tycho-b699e6c4b09203c4a87c03b8085af441087b2c71.tar.gz
org.eclipse.tycho-b699e6c4b09203c4a87c03b8085af441087b2c71.tar.xz
org.eclipse.tycho-b699e6c4b09203c4a87c03b8085af441087b2c71.zip
435068 Allow ignoring execution environments in dependency resolution
Add a new target platform configuration option resolveWithExecutionEnvironmentConstraints which makes Tycho check that the bundle being built and all its dependencies can resolve & run in an OSGi container with the configured execution environment. This is the current behaviour of Tycho, so the switch is true by default. When the new switch is set to false, the p2 and Equinox resolver will use all known execution environments: <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> <version>${tycho-version}</version> <configuration> <resolveWithExecutionEnvironmentConstraints>false </resolveWithExecutionEnvironmentConstraints> </configuration> </plugin> This allows required bundles to also use packages of other execution environments (which otherwise leads to a p2 resolution error, cf. bug 434959) or declare a different BREE (which otherwise leads to missing fragments, cf. bug 413116) Added integration tests for both the p2 and Equinox resolver scenario. Bug: 435068 Bug: 413116 Bug: 434959 Change-Id: I5dc3dd20d459a30c481928d059815fa215bc6a09 Signed-off-by: Jan Sievers <jan.sievers@sap.com> Also-by: Tobias Oberlies <tobias.oberlies@sap.com>
-rw-r--r--tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfiguration.java8
-rw-r--r--tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfigurationStub.java6
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandlerTest.java5
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/AllKnownEEsResolutionHints.java104
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/ExecutionEnvironmentResolutionHandler.java10
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHandler.java7
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHints.java8
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/TargetPlatformConfiguration.java10
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java19
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentUtils.java10
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/EquinoxResolver.java33
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java8
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java16
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTychoResolver.java5
-rw-r--r--tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java17
-rw-r--r--tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java2
-rw-r--r--tycho-core/src/test/java/org/eclipse/tycho/core/test/DependencyComputerTest.java7
-rw-r--r--tycho-its/projects/eeProfile.java7/bundle2/META-INF/MANIFEST.MF7
-rw-r--r--tycho-its/projects/eeProfile.java7/bundle2/build.properties4
-rw-r--r--tycho-its/projects/eeProfile.java7/bundle2/pom.xml39
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/META-INF/MANIFEST.MF11
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/build.properties2
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/pom.xml17
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ButtonImageProperty.java11
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/META-INF/MANIFEST.MF11
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/build.properties2
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/pom.xml17
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Image.java5
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/META-INF/MANIFEST.MF9
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/build.properties2
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/pom.xml17
-rw-r--r--tycho-its/projects/eeProfile.resolution.fragments/pom.xml44
-rw-r--r--tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/FragmentsAttachedTest.java29
-rw-r--r--tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/Java7ResolutionTest.java11
34 files changed, 475 insertions, 38 deletions
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfiguration.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfiguration.java
index 3aaf9448a..2cd5edf73 100644
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfiguration.java
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfiguration.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 SAP AG and others.
+ * Copyright (c) 2012, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.core.ee.shared;
@@ -75,10 +75,12 @@ public interface ExecutionEnvironmentConfiguration {
* Returns the execution environment specification with information needed for the build.
*
* @throws IllegalStateException
- * if a custom execution enviromnent profile has been configure, and
+ * if a custom execution environment profile has been configure, and
* {@link #setFullSpecificationForCustomProfile(List)} has not been called.
* @see ExecutionEnvironment
*/
public ExecutionEnvironment getFullSpecification() throws IllegalStateException;
+ public boolean isIgnoredByResolver();
+
}
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfigurationStub.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfigurationStub.java
index 0cf2ffd1f..f20547e7a 100644
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfigurationStub.java
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/ee/shared/ExecutionEnvironmentConfigurationStub.java
@@ -12,7 +12,6 @@ package org.eclipse.tycho.core.ee.shared;
import java.util.List;
-
/**
* {@link ExecutionEnvironmentConfiguration} instance usable for additional calls of the target
* platform computation and dependency resolution.
@@ -69,4 +68,9 @@ public class ExecutionEnvironmentConfigurationStub implements ExecutionEnvironme
throw new UnsupportedOperationException();
}
+ @Override
+ public boolean isIgnoredByResolver() {
+ return false;
+ }
+
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandlerTest.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandlerTest.java
index db88cfefe..8319f2a7f 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandlerTest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandlerTest.java
@@ -122,5 +122,10 @@ public class CustomEEResolutionHandlerTest {
return null;
}
+ @Override
+ public boolean isIgnoredByResolver() {
+ return false;
+ }
+
}
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/AllKnownEEsResolutionHints.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/AllKnownEEsResolutionHints.java
new file mode 100644
index 000000000..b4ceada46
--- /dev/null
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/AllKnownEEsResolutionHints.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2014 SAP SE and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP SE - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.p2.target.ee;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.VersionedId;
+import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints;
+import org.osgi.framework.BundleActivator;
+
+public class AllKnownEEsResolutionHints implements ExecutionEnvironmentResolutionHints {
+
+ private final Map<VersionedId, IInstallableUnit> temporaryUnits;
+
+ public AllKnownEEsResolutionHints() {
+ temporaryUnits = new LinkedHashMap<VersionedId, IInstallableUnit>();
+ for (String env : getAllKnownExecutionEnvironments()) {
+ StandardEEResolutionHints.addIUsFromEnvironment(env, temporaryUnits);
+ }
+ }
+
+ @Override
+ public Collection<IInstallableUnit> getMandatoryUnits() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public boolean isNonApplicableEEUnit(IInstallableUnit iu) {
+ // See JREAction
+ return iu.getId().startsWith("a.jre") || iu.getId().startsWith("config.a.jre");
+ }
+
+ @Override
+ public boolean isEESpecificationUnit(IInstallableUnit unit) {
+ // not needed
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<IRequirement> getMandatoryRequires() {
+ // not needed; getMandatoryUnits already enforces the use of the JRE IUs during resolution
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Collection<IInstallableUnit> getTemporaryAdditions() {
+ return temporaryUnits.values();
+ }
+
+ private static List<String> getAllKnownExecutionEnvironments() {
+ ClassLoader loader = BundleActivator.class.getClassLoader();
+ Properties listProps = readProperties(loader.getResource("profile.list"));
+ List<String> result = new ArrayList<String>();
+ for (String profileFile : listProps.getProperty("java.profiles").split(",")) {
+ Properties props = readProperties(loader.getResource(profileFile.trim()));
+ String profileName = props.getProperty("osgi.java.profile.name");
+ if (profileName == null) {
+ throw new IllegalStateException("osgi.java.profile.name must not be null for profile " + profileFile);
+ }
+ result.add(profileName);
+ }
+ return result;
+ }
+
+ private static Properties readProperties(final URL url) {
+ Properties listProps = new Properties();
+ InputStream stream = null;
+ try {
+ stream = url.openStream();
+ listProps.load(stream);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ if (stream != null) {
+ stream.close();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return listProps;
+ }
+
+}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/ExecutionEnvironmentResolutionHandler.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/ExecutionEnvironmentResolutionHandler.java
index 62007e0d9..845cf92af 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/ExecutionEnvironmentResolutionHandler.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/ExecutionEnvironmentResolutionHandler.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 SAP AG and others.
+ * Copyright (c) 2012, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.p2.target.ee;
@@ -19,10 +19,12 @@ import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints;
public abstract class ExecutionEnvironmentResolutionHandler {
public static ExecutionEnvironmentResolutionHandler adapt(ExecutionEnvironmentConfiguration eeConfiguration) {
- if (eeConfiguration.isCustomProfile()) {
+ if (eeConfiguration.isIgnoredByResolver()) {
+ return new StandardEEResolutionHandler(new AllKnownEEsResolutionHints());
+ } else if (eeConfiguration.isCustomProfile()) {
return new CustomEEResolutionHandler(eeConfiguration);
} else {
- return new StandardEEResolutionHandler(eeConfiguration.getProfileName());
+ return new StandardEEResolutionHandler(new StandardEEResolutionHints(eeConfiguration.getProfileName()));
}
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHandler.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHandler.java
index abbe3f816..abd3667da 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHandler.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 SAP AG and others.
+ * Copyright (c) 2012, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,11 +13,12 @@ package org.eclipse.tycho.p2.target.ee;
import java.util.Collection;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints;
class StandardEEResolutionHandler extends ExecutionEnvironmentResolutionHandler {
- public StandardEEResolutionHandler(String executionEnvironment) {
- super(new StandardEEResolutionHints(executionEnvironment));
+ public StandardEEResolutionHandler(ExecutionEnvironmentResolutionHints resolutionHints) {
+ super(resolutionHints);
}
@Override
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHints.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHints.java
index 7ecdf5cee..713001ab9 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHints.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/StandardEEResolutionHints.java
@@ -77,7 +77,12 @@ public final class StandardEEResolutionHints implements ExecutionEnvironmentReso
*/
private static Map<VersionedId, IInstallableUnit> computeAdditionalUnits(String executionEnvironment) {
Map<VersionedId, IInstallableUnit> units = new LinkedHashMap<VersionedId, IInstallableUnit>();
+ addIUsFromEnvironment(executionEnvironment, units);
+ ensureEEWasKnownToJREAction(executionEnvironment, units.values());
+ return units;
+ }
+ static void addIUsFromEnvironment(String executionEnvironment, Map<VersionedId, IInstallableUnit> units) {
// generate real IUs that represent requested execution environment
PublisherResult results = new PublisherResult();
new JREAction(executionEnvironment).perform(new PublisherInfo(), results, null);
@@ -86,9 +91,6 @@ public final class StandardEEResolutionHints implements ExecutionEnvironmentReso
while (iterator.hasNext()) {
put(units, iterator.next());
}
-
- ensureEEWasKnownToJREAction(executionEnvironment, units.values());
- return units;
}
private static void ensureEEWasKnownToJREAction(String executionEnvironment, Collection<IInstallableUnit> eeUnits) {
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/TargetPlatformConfiguration.java b/tycho-core/src/main/java/org/eclipse/tycho/core/TargetPlatformConfiguration.java
index 1b030bbd6..4672fc645 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/TargetPlatformConfiguration.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/TargetPlatformConfiguration.java
@@ -45,6 +45,7 @@ public class TargetPlatformConfiguration implements DependencyResolverConfigurat
private String executionEnvironment;
private String executionEnvironmentDefault;
private BREEHeaderSelectionPolicy breeHeaderSelectionPolicy = BREEHeaderSelectionPolicy.first;
+ private boolean resolveWithEEConstraints = true;
private List<TargetPlatformFilter> filters;
@@ -134,6 +135,14 @@ public class TargetPlatformConfiguration implements DependencyResolverConfigurat
this.breeHeaderSelectionPolicy = breeHeaderSelectionPolicy;
}
+ public boolean isResolveWithEEConstraints() {
+ return resolveWithEEConstraints;
+ }
+
+ public void setResolveWithEEContraints(boolean value) {
+ this.resolveWithEEConstraints = value;
+ }
+
public void setFilters(List<TargetPlatformFilter> filters) {
this.filters = filters;
}
@@ -183,4 +192,5 @@ public class TargetPlatformConfiguration implements DependencyResolverConfigurat
public void addProfileProperty(String key, String value) {
resolverProfileProperties.put(key, value);
}
+
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
index ab6f6a32b..ddbf866f1 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
@@ -1,18 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2012 SAP AG and others.
+ * Copyright (c) 2012, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.core.ee;
import java.util.List;
import org.codehaus.plexus.logging.Logger;
+import org.eclipse.tycho.core.ee.shared.BuildFailureException;
import org.eclipse.tycho.core.ee.shared.ExecutionEnvironment;
import org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration;
import org.eclipse.tycho.core.ee.shared.SystemCapability;
@@ -31,8 +32,11 @@ public class ExecutionEnvironmentConfigurationImpl implements ExecutionEnvironme
private String effectiveProfileName = null;
private CustomExecutionEnvironment customExecutionEnvironment;
- public ExecutionEnvironmentConfigurationImpl(Logger logger) {
+ private final boolean ignoredByResolver;
+
+ public ExecutionEnvironmentConfigurationImpl(Logger logger, boolean ignoredByResolver) {
this.logger = logger;
+ this.ignoredByResolver = ignoredByResolver;
}
@Override
@@ -92,6 +96,10 @@ public class ExecutionEnvironmentConfigurationImpl implements ExecutionEnvironme
ExecutionEnvironmentUtils.getExecutionEnvironment(profileName);
return false;
} catch (UnknownEnvironmentException e) {
+ if (ignoredByResolver) {
+ throw new BuildFailureException(
+ "When using a custom execution environment profile, resolveWithExecutionEnvironmentConstraints must not be set to false");
+ }
return true;
}
}
@@ -134,4 +142,9 @@ public class ExecutionEnvironmentConfigurationImpl implements ExecutionEnvironme
}
+ @Override
+ public boolean isIgnoredByResolver() {
+ return ignoredByResolver;
+ }
+
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentUtils.java b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentUtils.java
index fe4801c73..a52269c56 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentUtils.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentUtils.java
@@ -13,7 +13,9 @@ package org.eclipse.tycho.core.ee;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -35,7 +37,7 @@ public class ExecutionEnvironmentUtils {
private static Map<String, StandardExecutionEnvironment> fillEnvironmentsMap() {
Properties listProps = readProperties(findInSystemBundle("profile.list"));
String[] profileFiles = listProps.getProperty("java.profiles").split(",");
- Map<String, StandardExecutionEnvironment> envMap = new HashMap<String, StandardExecutionEnvironment>();
+ Map<String, StandardExecutionEnvironment> envMap = new LinkedHashMap<String, StandardExecutionEnvironment>();
for (String profileFile : profileFiles) {
Properties props = readProperties(findInSystemBundle(profileFile.trim()));
envMap.put(props.getProperty("osgi.java.profile.name").trim(), new StandardExecutionEnvironment(props));
@@ -82,6 +84,10 @@ public class ExecutionEnvironmentUtils {
return executionEnvironment;
}
+ public static List<String> getProfileNames() {
+ return new ArrayList<String>(executionEnvironmentsMap.keySet());
+ }
+
public static void applyProfileProperties(Properties properties, Properties profileProps) {
String systemExports = properties.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
// set the system exports property using the vm profile; only if the property is not already set
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/EquinoxResolver.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/EquinoxResolver.java
index 6bee82480..8f7a49c9a 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/EquinoxResolver.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/EquinoxResolver.java
@@ -11,11 +11,13 @@
package org.eclipse.tycho.core.osgitools;
import java.io.File;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -60,11 +62,11 @@ public class EquinoxResolver {
@Requirement
private Logger logger;
- public State newResolvedState(MavenProject project, ExecutionEnvironment ee, DependencyArtifacts artifacts)
- throws BundleException {
+ public State newResolvedState(MavenProject project, ExecutionEnvironment ee, boolean ignoreEE,
+ DependencyArtifacts artifacts) throws BundleException {
Properties properties = getPlatformProperties(project, ee);
- State state = newState(artifacts, properties);
+ State state = newState(artifacts, properties, ignoreEE);
resolveState(state);
@@ -79,7 +81,7 @@ public class EquinoxResolver {
throws BundleException {
Properties properties = getPlatformProperties(new Properties(), null, ee);
- State state = newState(artifacts, properties);
+ State state = newState(artifacts, properties, false);
resolveState(state);
@@ -146,7 +148,8 @@ public class EquinoxResolver {
return properties;
}
- protected State newState(DependencyArtifacts artifacts, Properties properties) throws BundleException {
+ protected State newState(DependencyArtifacts artifacts, Properties properties, boolean ignoreEE)
+ throws BundleException {
State state = factory.createState(true);
Map<File, Dictionary<String, String>> systemBundles = new LinkedHashMap<File, Dictionary<String, String>>();
@@ -186,10 +189,28 @@ public class EquinoxResolver {
addBundle(state, id++, entry.getKey(), entry.getValue(), true/* override */);
}
+ List<Dictionary<Object, Object>> allProps = new ArrayList<Dictionary<Object, Object>>();
+
// force our system.bundle
Hashtable<Object, Object> platformProperties = new Hashtable<Object, Object>(properties);
platformProperties.put(StateImpl.STATE_SYSTEM_BUNDLE, state.getBundle(SYSTEM_BUNDLE_ID).getSymbolicName());
- state.setPlatformProperties(platformProperties);
+ allProps.add(platformProperties);
+ if (ignoreEE) {
+ // ignoring EE by adding all known EEs
+ for (String profile : ExecutionEnvironmentUtils.getProfileNames()) {
+ Properties envProps = ExecutionEnvironmentUtils.getExecutionEnvironment(profile).getProfileProperties();
+ String systemPackages = envProps.getProperty("org.osgi.framework.system.packages");
+ String execEnv = envProps.getProperty("org.osgi.framework.executionenvironment");
+ Dictionary<Object, Object> prop = new Hashtable<Object, Object>();
+ prop.put("org.osgi.framework.system.packages", systemPackages);
+ prop.put("org.osgi.framework.executionenvironment", execEnv);
+ allProps.add(prop);
+ }
+ }
+
+ Dictionary<Object, Object>[] stateProperties = allProps.toArray(new Dictionary[allProps.size()]);
+
+ state.setPlatformProperties(stateProperties);
return state;
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
index 59bc71c41..fae4eb7f9 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
@@ -248,9 +248,11 @@ public class OsgiBundleProject extends AbstractTychoProject implements BundlePro
private State getResolverState(MavenProject project, DependencyArtifacts artifacts) {
try {
- ExecutionEnvironment executionEnvironment = TychoProjectUtils.getExecutionEnvironmentConfiguration(project)
- .getFullSpecification();
- return resolver.newResolvedState(project, executionEnvironment, artifacts);
+ ExecutionEnvironmentConfiguration eeConfiguration = TychoProjectUtils
+ .getExecutionEnvironmentConfiguration(project);
+ ExecutionEnvironment executionEnvironment = eeConfiguration.getFullSpecification();
+ return resolver.newResolvedState(project, executionEnvironment, eeConfiguration.isIgnoredByResolver(),
+ artifacts);
} catch (BundleException e) {
throw new RuntimeException(e);
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java
index f695a272b..69d1a590e 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java
@@ -82,6 +82,7 @@ public class DefaultTargetPlatformConfigurationReader {
setExecutionEnvironment(result, configuration);
setExecutionEnvironmentDefault(result, configuration);
setBREEHeaderSelectionPolicy(result, configuration);
+ setResolveWithEEContraints(result, configuration);
readFilters(result, configuration);
@@ -235,6 +236,21 @@ public class DefaultTargetPlatformConfigurationReader {
}
}
+ /**
+ * Take the constraints of the configured execution environment into account when resolving
+ * dependencies or target definitions. These constraints include the list of system packages and
+ * the <tt>Bundle-RequiredExecutionEnvironment</tt> header. When set to <code>true</code>, the dependency resolution
+ * verifies that the bundle and all required bundles can be used in an OSGi container with the
+ * configured execution environment.
+ */
+ private void setResolveWithEEContraints(TargetPlatformConfiguration result, Xpp3Dom resolverDom) {
+ String value = getStringValue(resolverDom.getChild("resolveWithExecutionEnvironmentConstraints"));
+ if (value == null) {
+ return;
+ }
+ result.setResolveWithEEContraints(Boolean.valueOf(value));
+ }
+
private void setDisableP2Mirrors(TargetPlatformConfiguration result, Xpp3Dom configuration) {
Xpp3Dom disableP2mirrorsDom = configuration.getChild("disableP2Mirrors");
if (disableP2mirrorsDom != null) {
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTychoResolver.java b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTychoResolver.java
index 0187ec04e..085a97429 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTychoResolver.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTychoResolver.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Sonatype Inc. and others.
+ * Copyright (c) 2008, 2014 Sonatype Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -80,7 +80,8 @@ public class DefaultTychoResolver implements TychoResolver {
.getTargetPlatformConfiguration(session, project);
project.setContextValue(TychoConstants.CTX_TARGET_PLATFORM_CONFIGURATION, configuration);
- ExecutionEnvironmentConfiguration eeConfiguration = new ExecutionEnvironmentConfigurationImpl(logger);
+ ExecutionEnvironmentConfiguration eeConfiguration = new ExecutionEnvironmentConfigurationImpl(logger,
+ !configuration.isResolveWithEEConstraints());
dr.readExecutionEnvironmentConfiguration(project, eeConfiguration);
project.setContextValue(TychoConstants.CTX_EXECUTION_ENVIRONMENT_CONFIGURATION, eeConfiguration);
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
index 5489d6229..7dc764724 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 SAP AG and others.
+ * Copyright (c) 2012, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.core.ee;
@@ -19,6 +19,7 @@ import java.util.List;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
+import org.eclipse.tycho.core.ee.shared.BuildFailureException;
import org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration;
import org.eclipse.tycho.core.ee.shared.SystemCapability;
import org.junit.Before;
@@ -33,11 +34,13 @@ public class ExecutionEnvironmentConfigurationTest {
private static final String STANDARD_PROFILE = "OSGi/Minimum-1.1";
private static final String OTHER_STANDARD_PROFILE = "OSGi/Minimum-1.2";
+ ConsoleLogger logger = new ConsoleLogger(Logger.LEVEL_DISABLED, "no-op logger");
+
ExecutionEnvironmentConfiguration subject;
@Before
public void initSubject() {
- subject = new ExecutionEnvironmentConfigurationImpl(new ConsoleLogger(Logger.LEVEL_DISABLED, "no-op logger"));
+ subject = new ExecutionEnvironmentConfigurationImpl(logger, false);
}
@Test
@@ -86,6 +89,14 @@ public class ExecutionEnvironmentConfigurationTest {
assertThat(subject.getFullSpecification().getProfileName(), is(CUSTOM_PROFILE));
}
+ @Test(expected = BuildFailureException.class)
+ public void testMustNotIgnoreEEWhenUsingCustomProfile() {
+ subject = new ExecutionEnvironmentConfigurationImpl(logger, true);
+ subject.setProfileConfiguration(CUSTOM_PROFILE, DUMMY_ORIGIN);
+
+ subject.isCustomProfile();
+ }
+
// BEGIN fail fast if methods are called in unexpected order
@Test(expected = IllegalStateException.class)
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
index ff64ff6a5..e062e0b7e 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
@@ -47,7 +47,7 @@ public class EquinoxResolverTest extends AbstractTychoMojoTestCase {
public void test_noSystemBundle() throws BundleException {
Properties properties = subject.getPlatformProperties(new Properties(), null, DUMMY_EE);
- State state = subject.newState(new DefaultDependencyArtifacts(), properties);
+ State state = subject.newState(new DefaultDependencyArtifacts(), properties, false);
BundleDescription[] bundles = state.getBundles("system.bundle");
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/test/DependencyComputerTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/test/DependencyComputerTest.java
index 73b112912..ff911db5f 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/test/DependencyComputerTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/test/DependencyComputerTest.java
@@ -74,7 +74,7 @@ public class DependencyComputerTest extends AbstractTychoMojoTestCase {
ExecutionEnvironment executionEnvironment = TychoProjectUtils.getExecutionEnvironmentConfiguration(project)
.getFullSpecification();
- State state = resolver.newResolvedState(project, executionEnvironment, platform);
+ State state = resolver.newResolvedState(project, executionEnvironment, false, platform);
BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
List<DependencyEntry> dependencies = dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
@@ -114,7 +114,7 @@ public class DependencyComputerTest extends AbstractTychoMojoTestCase {
new SystemCapability(Type.OSGI_EE, "JavaSE", "1.1.0"), //
new SystemCapability(Type.OSGI_EE, "JavaSE", "1.2.0")));
- State state = resolver.newResolvedState(project, customProfile, platform);
+ State state = resolver.newResolvedState(project, customProfile, false, platform);
BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
List<DependencyEntry> dependencies = dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
@@ -154,9 +154,8 @@ public class DependencyComputerTest extends AbstractTychoMojoTestCase {
DependencyArtifacts platform = (DependencyArtifacts) project
.getContextValue(TychoConstants.CTX_DEPENDENCY_ARTIFACTS);
State state = resolver.newResolvedState(project, ExecutionEnvironmentUtils.getExecutionEnvironment("J2SE-1.4"),
- platform);
+ false, platform);
BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
return dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
}
-
}
diff --git a/tycho-its/projects/eeProfile.java7/bundle2/META-INF/MANIFEST.MF b/tycho-its/projects/eeProfile.java7/bundle2/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..4b6d195da
--- /dev/null
+++ b/tycho-its/projects/eeProfile.java7/bundle2/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Bundle
+Bundle-SymbolicName: consumer.bundle
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: ep7.bundle
diff --git a/tycho-its/projects/eeProfile.java7/bundle2/build.properties b/tycho-its/projects/eeProfile.java7/bundle2/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/tycho-its/projects/eeProfile.java7/bundle2/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tycho-its/projects/eeProfile.java7/bundle2/pom.xml b/tycho-its/projects/eeProfile.java7/bundle2/pom.xml
new file mode 100644
index 000000000..461e7220e
--- /dev/null
+++ b/tycho-its/projects/eeProfile.java7/bundle2/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>tycho-its-project.eeProfile.java7</groupId>
+ <artifactId>consumer.bundle</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <packaging>eclipse-plugin</packaging>
+
+ <repositories>
+ <repository>
+ <id>p2.repo</id>
+ <url>${p2.repo.url}</url>
+ <layout>p2</layout>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <resolveWithExecutionEnvironmentConstraints>false</resolveWithExecutionEnvironmentConstraints>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/META-INF/MANIFEST.MF b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..08ac66e4f
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.jface.databinding
+Bundle-Version: 1.6.200.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.swt;bundle-version="[3.2.0,4.0.0)"
+Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
+ J2SE-1.3
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/build.properties b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/build.properties
new file mode 100644
index 000000000..7ae18c629
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/build.properties
@@ -0,0 +1,2 @@
+source.. = src/
+bin.includes = .,META-INF/
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/pom.xml b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/pom.xml
new file mode 100644
index 000000000..3c15d7411
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.tycho.bug413116.sample</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.eclipse.jface</groupId>
+ <artifactId>org.eclipse.jface.databinding</artifactId>
+ <version>1.6.200-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+</project>
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ButtonImageProperty.java b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ButtonImageProperty.java
new file mode 100644
index 000000000..10cc1cab2
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ButtonImageProperty.java
@@ -0,0 +1,11 @@
+package org.eclipse.jface.internal.databinding.swt;
+
+import org.eclipse.swt.graphics.Image;
+
+public class ButtonImageProperty {
+
+ Image getImage() {
+ return null;
+ }
+
+}
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/META-INF/MANIFEST.MF b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..88c5749f9
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Fragment-Host: org.eclipse.swt; bundle-version="[3.0.0,4.0.0)"
+Bundle-Name: %fragmentName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.swt.gtk.linux.x86; singleton:=true
+Bundle-Version: 3.102.0.qualifier
+Bundle-ManifestVersion: 2
+Bundle-Localization: fragment
+Export-Package: org.eclipse.swt.graphics
+Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86))
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/build.properties b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/build.properties
new file mode 100644
index 000000000..444e0c636
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/build.properties
@@ -0,0 +1,2 @@
+bin.includes = .,META-INF/
+source.. = src/
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/pom.xml b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/pom.xml
new file mode 100644
index 000000000..5b8b35aec
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.tycho.bug413116.sample</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.eclipse.swt</groupId>
+ <artifactId>org.eclipse.swt.gtk.linux.x86</artifactId>
+ <version>3.102.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+</project>
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Image.java b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Image.java
new file mode 100644
index 000000000..54d4cccfd
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Image.java
@@ -0,0 +1,5 @@
+package org.eclipse.swt.graphics;
+
+public final class Image {
+
+}
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/META-INF/MANIFEST.MF b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..43961ec03
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.swt; singleton:=true
+Bundle-Version: 3.102.0.qualifier
+Bundle-ManifestVersion: 2
+Bundle-Localization: plugin
+Eclipse-ExtensibleAPI: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/build.properties b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/build.properties
new file mode 100644
index 000000000..7b02ed4a0
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/build.properties
@@ -0,0 +1,2 @@
+bin.includes = META-INF/
+
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/pom.xml b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/pom.xml
new file mode 100644
index 000000000..85c48e68a
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/org.eclipse.swt/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.tycho.bug413116.sample</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.eclipse.swt</groupId>
+ <artifactId>org.eclipse.swt</artifactId>
+ <version>3.102.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+</project>
diff --git a/tycho-its/projects/eeProfile.resolution.fragments/pom.xml b/tycho-its/projects/eeProfile.resolution.fragments/pom.xml
new file mode 100644
index 000000000..28bdaacf5
--- /dev/null
+++ b/tycho-its/projects/eeProfile.resolution.fragments/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.tycho.bug413116.sample</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>org.eclipse.jface.databinding</module>
+ <module>org.eclipse.swt</module>
+ <module>org.eclipse.swt.gtk.linux.x86</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <resolveWithExecutionEnvironmentConstraints>false</resolveWithExecutionEnvironmentConstraints>
+ <environments>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86</arch>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/FragmentsAttachedTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/FragmentsAttachedTest.java
new file mode 100644
index 000000000..0e02b8d8c
--- /dev/null
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/FragmentsAttachedTest.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2014 SAP SE and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP SE - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.test.eeProfile;
+
+import org.apache.maven.it.Verifier;
+import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
+import org.junit.Test;
+
+public class FragmentsAttachedTest extends AbstractTychoIntegrationTest {
+
+ @Test
+ public void testSWTFragmentsAttached() throws Exception {
+ Verifier verifier = getVerifier("eeProfile.resolution.fragments", false);
+
+ verifier.executeGoal("verify");
+
+ // with bug 413116, compile would fail
+ verifier.verifyErrorFreeLog();
+ }
+
+}
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/Java7ResolutionTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/Java7ResolutionTest.java
index f3dc96f16..09a34999e 100644
--- a/tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/Java7ResolutionTest.java
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/eeProfile/Java7ResolutionTest.java
@@ -70,4 +70,15 @@ public class Java7ResolutionTest extends AbstractTychoIntegrationTest {
List<String> jreUnitVersions = productRepo.getUnitVersions("a.jre.javase");
assertThat(jreUnitVersions, hasItem("1.7.0"));
}
+
+ @Test
+ public void testP2ResolutionWithLowerBREEThanRequiredBundle() throws Exception {
+ Verifier verifier = getVerifier("eeProfile.java7/bundle2", false);
+ verifier.getCliOptions().add("-Dp2.repo.url=" + new File(buildResult, "repository1/target/repository").toURI());
+ verifier.executeGoal("verify");
+
+ // with bug 434959, p2 resolver would fail
+ verifier.verifyErrorFreeLog();
+ }
+
}

Back to the top