From dd80a22b9f4fb50cae7d902406d09f8dcdb52bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 5 Feb 2024 18:59:49 +0100 Subject: [PATCH] Use imported BundlesAction where possible / adjust tests --- .../p2maven/InstallableUnitGenerator.java | 2 +- .../MavenProjectDependencyProcessor.java | 2 +- .../actions/BundleDependenciesAction.java | 2 +- ...eaturesAndBundlesPublisherApplication.java | 2 +- ...mConfigurationInstallableUnitProvider.java | 2 +- .../tycho/core/TychoProjectManager.java | 3 +- .../core/bnd/TargetPlatformRepository.java | 2 +- ...leRequirementsInstallableUnitProvider.java | 2 +- .../MavenTargetDefinitionContent.java | 2 +- .../resolver/target/ArtifactTypeHelper.java | 2 +- .../target/TargetPlatformFilterEvaluator.java | 2 +- .../resource/InstallableUnitCapability.java | 2 +- .../resource/InstallableUnitRequirement.java | 2 +- .../publisher/BundleDependenciesAction.java | 2 +- .../tycho/p2/resolver/BundlePublisher.java | 2 +- .../tycho/p2/resolver/FeatureGenerator.java | 2 +- .../resolver/FileTargetDefinitionContent.java | 2 +- .../AbstractDirectorApplicationCommand.java | 5 ++- .../AbstractResolutionStrategy.java | 3 +- .../tycho/p2resolver/P2GeneratorImpl.java | 2 +- .../p2resolver/P2ResolverFactoryImpl.java | 2 +- .../tycho/p2resolver/P2ResolverImpl.java | 2 +- .../p2resolver/RepositoryLocationContent.java | 2 +- ...rcesBundleDependencyMetadataGenerator.java | 2 +- .../P2DependencyGeneratorImplTest.java | 19 ++++++--- .../tycho/p2resolver/P2GeneratorImplTest.java | 41 +++++++++++-------- .../P2MetadataGeneratorImplTest.java | 2 +- .../tycho/test/util/InstallableUnitUtil.java | 2 +- .../EclipseBuildInstallableUnitProvider.java | 2 +- .../plugins/p2/director/DirectorMojo.java | 3 +- .../source/SourceInstallableUnitProvider.java | 2 +- ...BndTestBundlesInstallableUnitProvider.java | 2 +- .../bnd/TargetPlatformRepository.java | 2 +- 33 files changed, 73 insertions(+), 55 deletions(-) diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitGenerator.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitGenerator.java index 1be5f3857e..5d89c5edf9 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitGenerator.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitGenerator.java @@ -53,7 +53,6 @@ import org.eclipse.equinox.p2.publisher.IPublisherAction; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.PublisherInfo; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.Feature; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.osgi.framework.util.CaseInsensitiveDictionaryMap; @@ -67,6 +66,7 @@ import org.eclipse.tycho.p2maven.actions.ProductDependenciesAction; import org.eclipse.tycho.p2maven.actions.ProductFile2; import org.eclipse.tycho.p2maven.io.MetadataIO; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.resolver.InstallableUnitProvider; import org.osgi.framework.Constants; import org.xml.sax.SAXException; diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/MavenProjectDependencyProcessor.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/MavenProjectDependencyProcessor.java index d1000f3c84..c3c3d9dc41 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/MavenProjectDependencyProcessor.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/MavenProjectDependencyProcessor.java @@ -43,10 +43,10 @@ import org.eclipse.equinox.p2.metadata.IProvidedCapability; import org.eclipse.equinox.p2.metadata.IRequirement; import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.query.CollectionResult; import org.eclipse.equinox.p2.query.IQueryable; import org.eclipse.tycho.p2maven.io.MetadataIO; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; /** * THis component computes dependencies between projects diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/BundleDependenciesAction.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/BundleDependenciesAction.java index b3af6f4c5e..39ac89161b 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/BundleDependenciesAction.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/actions/BundleDependenciesAction.java @@ -31,13 +31,13 @@ import org.eclipse.equinox.p2.publisher.AdviceFileParser; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.actions.ICapabilityAdvice; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.osgi.service.resolver.BundleSpecification; import org.eclipse.osgi.service.resolver.ImportPackageSpecification; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.tycho.OptionalResolutionAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; public class BundleDependenciesAction extends BundlesAction { diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/tools/TychoFeaturesAndBundlesPublisherApplication.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/tools/TychoFeaturesAndBundlesPublisherApplication.java index e0cd1dd752..9b02ae0665 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/tools/TychoFeaturesAndBundlesPublisherApplication.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/tools/TychoFeaturesAndBundlesPublisherApplication.java @@ -46,13 +46,13 @@ import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.IPublisherResult; import org.eclipse.equinox.p2.publisher.PublisherInfo; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.repository.IRepositoryManager; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.tycho.p2maven.advices.PGPSignatureAdvice; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.osgi.framework.BundleException; public class TychoFeaturesAndBundlesPublisherApplication extends AbstractPublisherApplication { diff --git a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java index 87d6c83242..db8720fd9d 100644 --- a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java +++ b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java @@ -31,12 +31,12 @@ 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.eclipse.BundlesAction; import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.core.TargetPlatformConfiguration; import org.eclipse.tycho.core.TychoProject; import org.eclipse.tycho.core.TychoProjectManager; import org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.resolver.InstallableUnitProvider; /** diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java b/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java index 061d492d62..6a68efc9d9 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java @@ -62,6 +62,7 @@ import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.helper.PluginRealmHelper; import org.eclipse.tycho.model.project.EclipseProject; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.targetplatform.TargetDefinition; import aQute.bnd.osgi.Processor; @@ -164,7 +165,7 @@ private Map getProfileProperties(TargetEnvironment environment, properties.put("org.eclipse.update.install.features", "true"); IncludeSourceMode sourceMode = configuration.getTargetDefinitionIncludeSourceMode(); if (sourceMode == IncludeSourceMode.force || sourceMode == IncludeSourceMode.honor) { - properties.put("org.eclipse.update.install.sources", "true"); + properties.put(BundlesAction.FILTER_PROPERTY_INSTALL_SOURCE, "true"); } properties.putAll(configuration.getProfileProperties()); return properties; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/bnd/TargetPlatformRepository.java b/tycho-core/src/main/java/org/eclipse/tycho/core/bnd/TargetPlatformRepository.java index 0113d99378..ca35c59b80 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/bnd/TargetPlatformRepository.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/bnd/TargetPlatformRepository.java @@ -26,13 +26,13 @@ import org.codehaus.plexus.component.annotations.Requirement; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.query.IQueryResult; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.tycho.ArtifactKey; import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.TargetPlatform; import org.eclipse.tycho.TargetPlatformService; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import aQute.bnd.osgi.Instruction; import aQute.bnd.service.RepositoryPlugin; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/AdditionalBundleRequirementsInstallableUnitProvider.java b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/AdditionalBundleRequirementsInstallableUnitProvider.java index 187d8991ac..72303cf79d 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/AdditionalBundleRequirementsInstallableUnitProvider.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/AdditionalBundleRequirementsInstallableUnitProvider.java @@ -29,12 +29,12 @@ import org.eclipse.equinox.p2.metadata.IRequirement; import org.eclipse.equinox.p2.metadata.MetadataFactory; import org.eclipse.equinox.p2.metadata.VersionRange; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.tycho.BuildProperties; import org.eclipse.tycho.BuildPropertiesParser; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.core.TychoProjectManager; import org.eclipse.tycho.core.osgitools.DefaultReactorProject; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.resolver.InstallableUnitProvider; import aQute.bnd.osgi.Constants; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/MavenTargetDefinitionContent.java b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/MavenTargetDefinitionContent.java index 3427c5f389..f55683c304 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/MavenTargetDefinitionContent.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/MavenTargetDefinitionContent.java @@ -57,7 +57,6 @@ import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.PublisherInfo; import org.eclipse.equinox.p2.publisher.actions.IPropertyAdvice; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.Feature; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; @@ -85,6 +84,7 @@ import org.eclipse.tycho.p2.resolver.WrappedArtifact; import org.eclipse.tycho.p2maven.advices.MavenChecksumAdvice; import org.eclipse.tycho.p2maven.advices.MavenPropertiesAdvice; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.targetplatform.TargetDefinition.BNDInstructions; import org.eclipse.tycho.targetplatform.TargetDefinition.MavenDependency; import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/ArtifactTypeHelper.java b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/ArtifactTypeHelper.java index 5742b32f6e..a95f1ba7b3 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/ArtifactTypeHelper.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/ArtifactTypeHelper.java @@ -24,7 +24,7 @@ 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.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.query.IQuery; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformFilterEvaluator.java b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformFilterEvaluator.java index 70437f18e3..aeb107b822 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformFilterEvaluator.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformFilterEvaluator.java @@ -22,7 +22,7 @@ import org.eclipse.equinox.p2.metadata.IProvidedCapability; import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.metadata.VersionRange; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.tycho.core.shared.MavenLogger; import org.eclipse.tycho.targetplatform.TargetPlatformFilter; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitCapability.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitCapability.java index cccd1e42b6..9625841230 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitCapability.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitCapability.java @@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IProvidedCapability; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.osgi.framework.Version; import org.osgi.framework.namespace.BundleNamespace; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitRequirement.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitRequirement.java index 782fce6f05..fe175a9a0a 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitRequirement.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/resource/InstallableUnitRequirement.java @@ -21,7 +21,7 @@ import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.metadata.VersionRange; import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.osgi.framework.namespace.BundleNamespace; import org.osgi.framework.namespace.PackageNamespace; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/BundleDependenciesAction.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/BundleDependenciesAction.java index c8d484628d..1987d0dccc 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/BundleDependenciesAction.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/publisher/BundleDependenciesAction.java @@ -32,7 +32,7 @@ import org.eclipse.equinox.p2.publisher.AdviceFileParser; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.actions.ICapabilityAdvice; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.osgi.service.resolver.BundleSpecification; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/BundlePublisher.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/BundlePublisher.java index 5880bddbde..14610aab4a 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/BundlePublisher.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/BundlePublisher.java @@ -33,7 +33,7 @@ import org.eclipse.equinox.p2.publisher.Publisher; import org.eclipse.equinox.p2.publisher.PublisherInfo; import org.eclipse.equinox.p2.publisher.actions.IPropertyAdvice; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FeatureGenerator.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FeatureGenerator.java index 4e14fc0695..b9a0c459cf 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FeatureGenerator.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FeatureGenerator.java @@ -45,7 +45,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IVersionedId; import org.eclipse.equinox.p2.metadata.VersionedId; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.Feature; import org.eclipse.tycho.core.MavenModelFacade; import org.eclipse.tycho.core.MavenModelFacade.MavenLicense; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java index eecedab9b4..77c659176b 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java @@ -27,7 +27,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.PublisherInfo; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.Feature; import org.eclipse.equinox.p2.query.IQuery; import org.eclipse.equinox.p2.query.IQueryResult; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/director/shared/AbstractDirectorApplicationCommand.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/director/shared/AbstractDirectorApplicationCommand.java index 6d59f72409..1d2acbd372 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/director/shared/AbstractDirectorApplicationCommand.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/director/shared/AbstractDirectorApplicationCommand.java @@ -25,6 +25,7 @@ import org.eclipse.tycho.DependencySeed; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.p2.CommandLineArguments; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.p2tools.copiedfromp2.PhaseSetFactory; /** @@ -165,8 +166,8 @@ protected List getDirectorApplicationArguments() { public Map getProfileProperties() { Map props = new TreeMap<>(this.profileProperties); props.put("org.eclipse.update.install.features", Boolean.toString(installFeatures)); - if (installSources && props.get("org.eclipse.update.install.sources") == null) { - props.put("org.eclipse.update.install.sources", "true"); + if (installSources && props.get(BundlesAction.FILTER_PROPERTY_INSTALL_SOURCE) == null) { + props.put(BundlesAction.FILTER_PROPERTY_INSTALL_SOURCE, "true"); } return props; } diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractResolutionStrategy.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractResolutionStrategy.java index ee2ee3b2ae..00cc30aa05 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractResolutionStrategy.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractResolutionStrategy.java @@ -33,6 +33,7 @@ import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.core.shared.MavenLogger; import org.eclipse.tycho.p2.resolver.ResolverException; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; public abstract class AbstractResolutionStrategy { protected static final IInstallableUnit[] EMPTY_IU_ARRAY = new IInstallableUnit[0]; @@ -71,7 +72,7 @@ protected abstract Collection resolve(Map prop private Map getEffectiveFilterProperties(TargetEnvironment environment) { Map result = environment.toFilterProperties(); result.put("org.eclipse.update.install.features", "true"); - result.put("org.eclipse.update.install.sources", "true"); + result.put(BundlesAction.FILTER_PROPERTY_INSTALL_SOURCE, "true"); insertAdditionalFilterProperties(result); return result; } 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 4bc5cfa261..7ba3c924d0 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 @@ -54,7 +54,7 @@ import org.eclipse.equinox.p2.publisher.IPublisherResult; import org.eclipse.equinox.p2.publisher.PublisherInfo; import org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.Feature; import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverFactoryImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverFactoryImpl.java index ae112056b5..89434459ab 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverFactoryImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverFactoryImpl.java @@ -38,7 +38,7 @@ 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.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.tycho.ArtifactDescriptor; import org.eclipse.tycho.IRepositoryIdManager; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverImpl.java index 21db213c82..c1b90daef8 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/P2ResolverImpl.java @@ -41,7 +41,7 @@ import org.eclipse.equinox.p2.metadata.MetadataFactory; import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; import org.eclipse.equinox.p2.metadata.VersionRange; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.query.IQuery; import org.eclipse.equinox.p2.query.IQueryResult; import org.eclipse.equinox.p2.query.IQueryable; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/RepositoryLocationContent.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/RepositoryLocationContent.java index ed971f8a90..8a0768ca84 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/RepositoryLocationContent.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/RepositoryLocationContent.java @@ -32,7 +32,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.PublisherInfo; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.Feature; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/SourcesBundleDependencyMetadataGenerator.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/SourcesBundleDependencyMetadataGenerator.java index c4a9defda0..7d9fd7327e 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/SourcesBundleDependencyMetadataGenerator.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/SourcesBundleDependencyMetadataGenerator.java @@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.publisher.IPublisherAdvice; import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.publisher.PublisherInfo; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.osgi.service.resolver.StateObjectFactory; import org.eclipse.tycho.BuildPropertiesParser; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2DependencyGeneratorImplTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2DependencyGeneratorImplTest.java index 8b44c5cb6c..a6d05dae0e 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2DependencyGeneratorImplTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2DependencyGeneratorImplTest.java @@ -79,7 +79,7 @@ public void bundle() throws Exception { assertEquals("org.eclipse.tycho.p2.impl.test.bundle", unit.getId()); assertEquals("1.0.0.qualifier", unit.getVersion().toString()); - assertEquals(3, unit.getRequirements().size()); + assertEquals(4, unit.getRequirements().size()); assertEquals(DEFAULT_CLASSIFIER, unit.getProperty(TychoConstants.PROP_CLASSIFIER)); // not really necessary, but we get this because we reuse standard p2 implementation @@ -97,14 +97,21 @@ public void bundle_with_p2_inf() throws Exception { assertEquals("1.0.0.qualifier", unit.getVersion().toString()); List requirements = new ArrayList<>(unit.getRequirements()); - assertEquals(1, requirements.size()); - IRequiredCapability requirement = (IRequiredCapability) requirements.get(0); - assertEquals(IInstallableUnit.NAMESPACE_IU_ID, requirement.getNamespace()); - assertEquals("required.p2.inf", requirement.getName()); - + assertNotNull(getReqCap(requirements, IInstallableUnit.NAMESPACE_IU_ID, "required.p2.inf")); assertNotNull(getUnitWithId("iu.p2.inf", units)); } + private IRequiredCapability getReqCap(List requirements, String ns, String name) { + for (IRequirement r : requirements) { + if (r instanceof IRequiredCapability cap) { + if (ns.equals(cap.getNamespace()) && name.equals(cap.getName())) { + return cap; + } + } + } + return null; + } + private IInstallableUnit getUnitWithId(String id, List units) { for (IInstallableUnit unit : units) { if (id.equals(unit.getId())) { diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2GeneratorImplTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2GeneratorImplTest.java index a7bd17a538..a48ddf57ce 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2GeneratorImplTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2GeneratorImplTest.java @@ -34,12 +34,12 @@ import org.eclipse.equinox.p2.metadata.IRequirement; import org.eclipse.equinox.p2.metadata.ITouchpointData; import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.p2.metadata.DependencyMetadataGenerator; import org.eclipse.tycho.p2.metadata.PublisherOptions; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.test.util.ArtifactMock; import org.eclipse.tycho.test.util.BuildPropertiesParserForTesting; import org.eclipse.tycho.test.util.LogVerifier; @@ -117,8 +117,9 @@ public void testOptionalImportPackage_REQUIRE() throws Exception { IInstallableUnit iu = getUnit("optional-import-package", units); assertNotNull(iu); List requirements = new ArrayList<>(iu.getRequirements()); - assertEquals(1, requirements.size()); - IRequiredCapability requirement = (IRequiredCapability) requirements.get(0); + IRequiredCapability requirement = getReqCap(requirements, PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, + "org.osgi.framework"); + assertNotNull("org.osgi.framework", requirement); assertTrue(requirement.isGreedy()); assertEquals(1, requirement.getMin()); assertEquals(1, requirement.getMax()); @@ -126,6 +127,17 @@ public void testOptionalImportPackage_REQUIRE() throws Exception { assertEquals("org.osgi.framework", requirement.getName()); } + private IRequiredCapability getReqCap(List requirements, String ns, String name) { + for (IRequirement r : requirements) { + if (r instanceof IRequiredCapability cap) { + if (ns.equals(cap.getNamespace()) && name.equals(cap.getName())) { + return cap; + } + } + } + return null; + } + private DefaultDependencyMetadataGenerator createDependencyMetadataGenerator() { DefaultDependencyMetadataGenerator generator = new DefaultDependencyMetadataGenerator(); generator.setBuildPropertiesParser(new BuildPropertiesParserForTesting()); @@ -145,7 +157,7 @@ public void testOptionalImportPackage_IGNORE() throws Exception { IInstallableUnit iu = getUnit("optional-import-package", units); assertNotNull(iu); List requirements = new ArrayList<>(iu.getRequirements()); - assertEquals(0, requirements.size()); + assertEquals(1, requirements.size()); } @Test @@ -160,13 +172,12 @@ public void testOptionalRequireBundle_REQUIRE() throws Exception { IInstallableUnit iu = getUnit("optional-require-bundle", units); assertNotNull(iu); List requirements = new ArrayList<>(iu.getRequirements()); - assertEquals(1, requirements.size()); - IRequiredCapability requirement = (IRequiredCapability) requirements.get(0); + IRequiredCapability requirement = getReqCap(requirements, BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, + "org.eclipse.osgi"); + assertNotNull(requirement); assertTrue(requirement.isGreedy()); assertEquals(1, requirement.getMin()); assertEquals(1, requirement.getMax()); - assertEquals(BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, requirement.getNamespace()); - assertEquals("org.eclipse.osgi", requirement.getName()); } @Test @@ -181,13 +192,11 @@ public void testOptionalRequireBundle_OPTIONAL() throws Exception { IInstallableUnit iu = getUnit("optional-require-bundle", units); assertNotNull(iu); List requirements = new ArrayList<>(iu.getRequirements()); - assertEquals(1, requirements.size()); - IRequiredCapability requirement = (IRequiredCapability) requirements.get(0); + IRequiredCapability requirement = getReqCap(requirements, BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, + "org.eclipse.osgi"); assertFalse(requirement.isGreedy()); assertEquals(0, requirement.getMin()); assertEquals(1, requirement.getMax()); - assertEquals(BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, requirement.getNamespace()); - assertEquals("org.eclipse.osgi", requirement.getName()); } @Test @@ -202,7 +211,7 @@ public void testOptionalRequireBundle_IGNORE() throws Exception { IInstallableUnit iu = getUnit("optional-require-bundle", units); assertNotNull(iu); List requirements = new ArrayList<>(iu.getRequirements()); - assertEquals(0, requirements.size()); + assertEquals(1, requirements.size()); } @Test @@ -217,12 +226,10 @@ public void testOptionalRequireBundleP2inf_REQUIRE() throws Exception { IInstallableUnit iu = getUnit("optional-reqiure-bundle-p2inf", units); assertNotNull(iu); List requirements = new ArrayList<>(iu.getRequirements()); - assertEquals(1, requirements.size()); - IRequiredCapability requirement = (IRequiredCapability) requirements.get(0); + IRequiredCapability requirement = getReqCap(requirements, BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, + "org.eclipse.osgi"); assertTrue(requirement.isGreedy()); assertEquals(1, requirement.getMin()); assertEquals(1, requirement.getMax()); - assertEquals(BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, requirement.getNamespace()); - assertEquals("org.eclipse.osgi", requirement.getName()); } } diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2MetadataGeneratorImplTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2MetadataGeneratorImplTest.java index 63669c9037..55a62d63bc 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2MetadataGeneratorImplTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/P2MetadataGeneratorImplTest.java @@ -61,7 +61,7 @@ public void gav() throws Exception { Assert.assertEquals("org.eclipse.tycho.p2.impl.test.bundle", unit.getId()); Assert.assertEquals("1.0.0.qualifier", unit.getVersion().toString()); - Assert.assertEquals(3, unit.getRequirements().size()); + Assert.assertEquals(4, unit.getRequirements().size()); Assert.assertEquals(1, artifacts.size()); IArtifactDescriptor ad = artifacts.iterator().next(); diff --git a/tycho-core/src/test/java/org/eclipse/tycho/test/util/InstallableUnitUtil.java b/tycho-core/src/test/java/org/eclipse/tycho/test/util/InstallableUnitUtil.java index 9236e3837b..caec2fe134 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/test/util/InstallableUnitUtil.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/test/util/InstallableUnitUtil.java @@ -26,7 +26,7 @@ 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.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; public class InstallableUnitUtil { diff --git a/tycho-eclipse-plugin/src/main/java/org/eclipse/tycho/eclipsebuild/EclipseBuildInstallableUnitProvider.java b/tycho-eclipse-plugin/src/main/java/org/eclipse/tycho/eclipsebuild/EclipseBuildInstallableUnitProvider.java index f904e5aeec..037eedc360 100644 --- a/tycho-eclipse-plugin/src/main/java/org/eclipse/tycho/eclipsebuild/EclipseBuildInstallableUnitProvider.java +++ b/tycho-eclipse-plugin/src/main/java/org/eclipse/tycho/eclipsebuild/EclipseBuildInstallableUnitProvider.java @@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.MetadataFactory; import org.eclipse.equinox.p2.metadata.VersionRange; -import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.helper.PluginConfigurationHelper; import org.eclipse.tycho.helper.PluginConfigurationHelper.Configuration; import org.eclipse.tycho.resolver.InstallableUnitProvider; diff --git a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java index 04bdc2ed13..1256cf111e 100644 --- a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java +++ b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java @@ -45,6 +45,7 @@ import org.eclipse.tycho.p2.CommandLineArguments; import org.eclipse.tycho.p2.resolver.BundlePublisher; import org.eclipse.tycho.p2.tools.director.shared.DirectorRuntime; +import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.p2tools.MavenDirectorLog; import org.eclipse.tycho.p2tools.copiedfromp2.DirectorApplication; import org.eclipse.tycho.p2tools.copiedfromp2.PhaseSetFactory; @@ -477,7 +478,7 @@ private Map getPropertyMap(String csvPropertiesMap, Map