diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/AbstractSiteDependenciesAction.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/AbstractSiteDependenciesAction.java index bef9152ba6..ca8aced6c8 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/AbstractSiteDependenciesAction.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/AbstractSiteDependenciesAction.java @@ -41,7 +41,7 @@ public AbstractSiteDependenciesAction(String id, String version) { this.version = version; } - abstract SiteModel getSiteModel(); + protected abstract SiteModel getSiteModel(); @Override protected Set getRequiredCapabilities() { @@ -90,7 +90,7 @@ private IRequirement getRequirement(SiteIU iu) { } else if ("match".equals(type)) { IMatchExpression iuMatcher = ExpressionUtil.getFactory() . matchExpression(ExpressionUtil.parse(expression), params); - return MetadataFactory.createRequirement(iuMatcher, null, 0, 1, true); + return MetadataFactory.createRequirement(iuMatcher, null, 0, Integer.MAX_VALUE, true); } else if ("context".equals(type)) { throw new IllegalStateException( "Context iu queries are not supported in Tycho. Faulty expression is " + expression); diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/CategoryDependenciesAction.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/CategoryDependenciesAction.java index aa5cd292ec..4658070478 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/CategoryDependenciesAction.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/CategoryDependenciesAction.java @@ -15,16 +15,16 @@ import org.eclipse.equinox.internal.p2.updatesite.SiteModel; public class CategoryDependenciesAction extends AbstractSiteDependenciesAction { - private final SiteModel siteModel; + private final SiteModel siteModel; - public CategoryDependenciesAction(SiteModel siteModel, String id, String version) { - super(id, version); - this.siteModel = siteModel; - } + public CategoryDependenciesAction(SiteModel siteModel, String id, String version) { + super(id, version); + this.siteModel = siteModel; + } - @Override - SiteModel getSiteModel() { - return this.siteModel; - } + @Override + protected SiteModel getSiteModel() { + return this.siteModel; + } } diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java index cbdd5dc257..47b2d56038 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java @@ -120,6 +120,7 @@ public void afterProjectsRead(MavenSession session) throws MavenExecutionExcepti + session.getUserProperties().getProperty(TychoConstants.SESSION_PROPERTY_TYCHO_MODE, "project")); log.info("Tycho Builder: " + session.getUserProperties().getProperty(TychoConstants.SESSION_PROPERTY_TYCHO_BUILDER, "maven")); + log.info("Build Threads: " + session.getRequest().getDegreeOfConcurrency()); if (disableLifecycleParticipation(session)) { buildListeners.notifyBuildStart(session); return; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/AbstractDependenciesAction.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/AbstractDependenciesAction.java deleted file mode 100644 index 5f46cdb960..0000000000 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/AbstractDependenciesAction.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Sonatype Inc. 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, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Sonatype Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.tycho.p2.publisher; - -import java.util.LinkedHashSet; -import java.util.Set; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.p2.metadata.IProvidedCapability; -import org.eclipse.equinox.p2.metadata.IRequirement; -import org.eclipse.equinox.p2.metadata.MetadataFactory; -import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; -import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.metadata.VersionRange; -import org.eclipse.equinox.p2.publisher.AbstractPublisherAction; -import org.eclipse.equinox.p2.publisher.IPublisherInfo; -import org.eclipse.equinox.p2.publisher.IPublisherResult; -import org.eclipse.equinox.p2.publisher.PublisherResult; -import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; -import org.eclipse.tycho.TychoConstants; - -public abstract class AbstractDependenciesAction extends AbstractPublisherAction { - - protected static final Version OSGi_versionMin = Version.createOSGi(0, 0, 0); - - /** - * Conventional qualifier used to denote "ANY QUALIFIER" in feature.xml and .product files. See - * TYCHO-383. - */ - protected static final String ANY_QUALIFIER = TychoConstants.ANY_QUALIFIER; - - /** - * copy&paste from e3.5.1 org.eclipse.osgi.internal.resolver.StateImpl - */ - protected static final String OSGI_OS = "osgi.os"; - - /** - * copy&paste from e3.5.1 org.eclipse.osgi.internal.resolver.StateImpl - */ - protected static final String OSGI_WS = "osgi.ws"; - - /** - * copy&paste from e3.5.1 org.eclipse.osgi.internal.resolver.StateImpl - */ - protected static final String OSGI_ARCH = "osgi.arch"; - - /** - * copy&paste from e3.5.1 org.eclipse.osgi.internal.resolver.StateImpl - */ - protected static final String OSGI_NL = "osgi.nl"; - - protected static final String FEATURE_GROUP_IU_SUFFIX = ".feature.group"; - - protected void addRequiredCapability(Set required, String id, Version version, String filter, - boolean optional) { - VersionRange range = getVersionRange(version); - - required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, - InstallableUnit.parseFilter(filter), optional, false)); - } - - @Override - public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { - InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); - iud.setId(getId()); - iud.setVersion(getVersion()); - - Set provided = new LinkedHashSet<>(); - addProvidedCapabilities(provided); - provided.add(MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, iud.getId(), - iud.getVersion())); - iud.addProvidedCapabilities(provided); - - iud.addRequirements(getRequiredCapabilities()); - - addProperties(iud); - addPublisherAdvice(publisherInfo); - - processCapabilityAdvice(iud, publisherInfo); - processInstallableUnitPropertiesAdvice(iud, publisherInfo); - - IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud); - results.addIU(iu, PublisherResult.ROOT); - - InstallableUnitDescription[] others = processAdditionalInstallableUnitsAdvice(iu, publisherInfo); - if (others != null) { - for (InstallableUnitDescription other : others) { - // using PublisherResult.NON_ROOT results in these IUs appear after the primary - // see org.eclipse.equinox.p2.publisher.PublisherResult.getIUs(String, String) - // see org.eclipse.tycho.p2.metadata.IReactorArtifactFacade.getDependencyMetadata() - results.addIU(MetadataFactory.createInstallableUnit(other), PublisherResult.NON_ROOT); - } - } - - return Status.OK_STATUS; - } - - protected void addPublisherAdvice(IPublisherInfo publisherInfo) { - // do nothing by default - } - - protected void addProperties(InstallableUnitDescription iud) { - // do nothing by default - } - - protected abstract Set getRequiredCapabilities(); - - protected void addProvidedCapabilities(Set provided) { - - } - - protected abstract Version getVersion(); - - protected abstract String getId(); - - protected VersionRange getVersionRange(String version) { - if (version == null) { - return VersionRange.emptyRange; - } - - return getVersionRange(Version.create(version)); - } - - /** - * @see org.eclipse.tycho.artifacts.DependencyArtifacts.getArtifact(String, String, String) - */ - protected VersionRange getVersionRange(Version version) { - if (version == null || OSGi_versionMin.equals(version)) { - return VersionRange.emptyRange; - } - - org.osgi.framework.Version osgiVersion = PublisherHelper.toOSGiVersion(version); - - String qualifier = osgiVersion.getQualifier(); - - if (qualifier == null || "".equals(qualifier) || ANY_QUALIFIER.equals(qualifier)) { - Version from = Version.createOSGi(osgiVersion.getMajor(), osgiVersion.getMinor(), osgiVersion.getMicro()); - Version to = Version.createOSGi(osgiVersion.getMajor(), osgiVersion.getMinor(), osgiVersion.getMicro() + 1); - return new VersionRange(from, true, to, false); - } - - return new VersionRange(version, true, version, true); - } - - protected Version createVersion(String version) { - return Version.create(version); - } - -} diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/AbstractSiteDependenciesAction.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/AbstractSiteDependenciesAction.java deleted file mode 100644 index 978e59bd68..0000000000 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/AbstractSiteDependenciesAction.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2018 Sonatype Inc. 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, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Sonatype Inc. - initial API and implementation - * Rapicorp, Inc. - add support for IU type (428310) - *******************************************************************************/ -package org.eclipse.tycho.p2.publisher; - -import java.util.LinkedHashSet; -import java.util.Set; - -import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; -import org.eclipse.equinox.internal.p2.updatesite.SiteBundle; -import org.eclipse.equinox.internal.p2.updatesite.SiteFeature; -import org.eclipse.equinox.internal.p2.updatesite.SiteIU; -import org.eclipse.equinox.internal.p2.updatesite.SiteModel; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.p2.metadata.IRequirement; -import org.eclipse.equinox.p2.metadata.MetadataFactory; -import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.metadata.VersionRange; -import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil; -import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; -import org.eclipse.tycho.TargetEnvironment; - -public abstract class AbstractSiteDependenciesAction extends AbstractDependenciesAction { - - private final String id; - - private final String version; - - public AbstractSiteDependenciesAction(String id, String version) { - this.id = id; - this.version = version; - } - - abstract SiteModel getSiteModel(); - - @Override - protected Set getRequiredCapabilities() { - Set required = new LinkedHashSet<>(); - - for (SiteFeature feature : getSiteModel().getFeatures()) { - String id = feature.getFeatureIdentifier() + FEATURE_GROUP_IU_SUFFIX; //$NON-NLS-1$ - - VersionRange range = getVersionRange(createVersion(feature.getFeatureVersion())); - String filter = new TargetEnvironment(feature.getOS(), feature.getWS(), feature.getOSArch()) - .toFilterExpression(); - // boolean optional = feature.isOptional(); - required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, - InstallableUnit.parseFilter(filter), false, false)); - } - - for (SiteBundle bundle : getSiteModel().getBundles()) { - String id = bundle.getBundleIdentifier(); - VersionRange range = getVersionRange(createVersion(bundle.getBundleVersion())); - String filter = new TargetEnvironment(bundle.getOS(), bundle.getWS(), bundle.getOSArch()) - .toFilterExpression(); - // boolean optional = feature.isOptional(); - required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, - InstallableUnit.parseFilter(filter), false, false)); - } - - for (SiteIU iu : getSiteModel().getIUs()) { - IRequirement requirement = getRequirement(iu); - if (requirement != null) - required.add(requirement); - } - - return required; - } - - //This is roughly inspired from org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction - private IRequirement getRequirement(SiteIU iu) { - String id = iu.getID(); - String range = iu.getRange(); - String type = iu.getQueryType(); - String expression = iu.getQueryExpression(); - Object[] params = iu.getQueryParams(); - if (id != null) { - VersionRange vRange = new VersionRange(range); - return MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, vRange, null, false, false); - } else if ("match".equals(type)) { - IMatchExpression iuMatcher = ExpressionUtil.getFactory() - . matchExpression(ExpressionUtil.parse(expression), params); - return MetadataFactory.createRequirement(iuMatcher, null, 0, 1, true); - } else if ("context".equals(type)) { - throw new IllegalStateException( - "Context iu queries are not supported in Tycho. Faulty expression is " + expression); - } - return null; - } - - @Override - protected String getId() { - return id; - } - - @Override - protected Version getVersion() { - return createSiteVersion(version); - } - - public static Version createSiteVersion(String version) { - try { - // try default (OSGi?) format first - return Version.create(version); - } catch (IllegalArgumentException e) { - // treat as raw otherwise - return Version.create("format(n[.n=0;[.n=0;['-'S]]]):" + version); - } - } -} diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/CategoryDependenciesAction.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/CategoryDependenciesAction.java deleted file mode 100644 index 3a8f93ba5f..0000000000 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/CategoryDependenciesAction.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 SAP AG 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, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * SAP AG - initial API and implementation - *******************************************************************************/ -package org.eclipse.tycho.p2.publisher; - -import org.eclipse.equinox.internal.p2.updatesite.SiteModel; - -public class CategoryDependenciesAction extends AbstractSiteDependenciesAction { - private final SiteModel siteModel; - - public CategoryDependenciesAction(SiteModel siteModel, String id, String version) { - super(id, version); - this.siteModel = siteModel; - } - - @Override - SiteModel getSiteModel() { - return this.siteModel; - } - -} diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/FeatureDependenciesAction.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/FeatureDependenciesAction.java index d261d5ed41..e4c07074c5 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/FeatureDependenciesAction.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/FeatureDependenciesAction.java @@ -34,6 +34,7 @@ import org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; +import org.eclipse.tycho.p2maven.actions.AbstractDependenciesAction; public class FeatureDependenciesAction extends AbstractDependenciesAction { /** diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/ProductDependenciesAction.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/ProductDependenciesAction.java index d79a11f637..13ff9d43eb 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/ProductDependenciesAction.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/ProductDependenciesAction.java @@ -28,6 +28,7 @@ import org.eclipse.equinox.p2.publisher.AdviceFileAdvice; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry; +import org.eclipse.tycho.p2maven.actions.AbstractDependenciesAction; public class ProductDependenciesAction extends AbstractDependenciesAction { private final IProductDescriptor product; @@ -53,7 +54,7 @@ protected Set getRequiredCapabilities() { ProductContentType type = product.getProductContentType(); if (type == ProductContentType.FEATURES || type == ProductContentType.MIXED) { for (IVersionedId feature : product.getFeatures()) { - String id = feature.getId() + FEATURE_GROUP_IU_SUFFIX; //$NON-NLS-1$ + String id = feature.getId() + FEATURE_GROUP_IU_SUFFIX; Version version = feature.getVersion(); addRequiredCapability(required, id, version, null, false); diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2GeneratorImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2GeneratorImpl.java index e79b7abbc8..87d919d8ca 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2GeneratorImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2GeneratorImpl.java @@ -75,7 +75,6 @@ import org.eclipse.tycho.p2.publisher.AbstractMetadataGenerator; import org.eclipse.tycho.p2.publisher.AuthoredIUAction; import org.eclipse.tycho.p2.publisher.BundleDependenciesAction; -import org.eclipse.tycho.p2.publisher.CategoryDependenciesAction; import org.eclipse.tycho.p2.publisher.DependencyMetadata; import org.eclipse.tycho.p2.publisher.DownloadStatsAdvice; import org.eclipse.tycho.p2.publisher.FeatureDependenciesAction; @@ -85,6 +84,7 @@ import org.eclipse.tycho.p2.publisher.rootfiles.FeatureRootAdvice; import org.eclipse.tycho.p2.repository.ArtifactsIO; import org.eclipse.tycho.p2.repository.MetadataIO; +import org.eclipse.tycho.p2maven.actions.CategoryDependenciesAction; import org.eclipse.tycho.p2maven.actions.ProductFile2; import org.osgi.framework.BundleException;