diff --git a/pom.xml b/pom.xml index 86d00ec72d..abc7febd7c 100644 --- a/pom.xml +++ b/pom.xml @@ -493,6 +493,7 @@ tycho-extras tycho-build tycho-apitools-plugin + tycho-targetplatform diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/pom.xml b/tycho-bundles/org.eclipse.tycho.core.shared/pom.xml index 83e3bfdd57..6e19f8fa8c 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/pom.xml +++ b/tycho-bundles/org.eclipse.tycho.core.shared/pom.xml @@ -31,6 +31,11 @@ org.eclipse.tycho.embedder.shared ${project.version} + + org.eclipse.tycho + tycho-targetplatform + ${project.version} + org.eclipse.platform org.eclipse.equinox.p2.metadata diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundleInfo.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundleInfo.java index 0f1e267cc0..7a283078b8 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundleInfo.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundleInfo.java @@ -14,7 +14,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; +import org.eclipse.tycho.IArtifactFacade; public class MavenBundleInfo { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundlesArtifactRepository.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundlesArtifactRepository.java index 5313564a9e..db1c48ebb6 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundlesArtifactRepository.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/MavenBundlesArtifactRepository.java @@ -21,8 +21,8 @@ import org.eclipse.core.runtime.AssertionFailedException; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.core.shared.MavenContext; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.repository.ArtifactRepositoryBaseImpl; import org.eclipse.tycho.p2.repository.ArtifactTransferPolicies; import org.eclipse.tycho.p2.repository.GAVArtifactDescriptor; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/P2TargetPlatform.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/P2TargetPlatform.java index 5c81cc9e03..45b22393c4 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/P2TargetPlatform.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/P2TargetPlatform.java @@ -24,10 +24,10 @@ import org.eclipse.equinox.p2.metadata.VersionRange; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.tycho.DependencyResolutionException; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IllegalArtifactReferenceException; import org.eclipse.tycho.ReactorProjectIdentities; import org.eclipse.tycho.TargetPlatform; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints; /** diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformBundlePublisher.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformBundlePublisher.java index ee811d09d2..0716d9e771 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformBundlePublisher.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/resolver/target/TargetPlatformBundlePublisher.java @@ -33,11 +33,11 @@ import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.osgi.service.resolver.BundleDescription; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.core.shared.MavenContext; import org.eclipse.tycho.core.shared.MavenLogger; import org.eclipse.tycho.p2.artifact.provider.IRawArtifactFileProvider; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.publisher.MavenPropertiesAdvice; import org.eclipse.tycho.p2.publisher.TransientArtifactRepository; import org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenDependenciesResolver.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenDependenciesResolver.java index fda0c0e63e..a85d4bd9ea 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenDependenciesResolver.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenDependenciesResolver.java @@ -16,6 +16,8 @@ import java.io.IOException; import java.util.Collection; +import org.eclipse.tycho.MavenArtifactRepositoryReference; + public interface MavenDependenciesResolver { /** * Only the specified artifact will be resolved diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ArtifactFacadeProxy.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ArtifactFacadeProxy.java index 50ab3a49ce..c89f8d375d 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ArtifactFacadeProxy.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ArtifactFacadeProxy.java @@ -16,6 +16,8 @@ import java.io.File; import java.util.Objects; +import org.eclipse.tycho.IArtifactFacade; + /** * Abstract proxy class for implementors who wish to modify some aspects of a facade. implementor * should consider the following: diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/DependencyMetadataGenerator.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/DependencyMetadataGenerator.java index 9483f87c3a..9eee235c2a 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/DependencyMetadataGenerator.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/DependencyMetadataGenerator.java @@ -14,6 +14,7 @@ import java.util.List; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IDependencyMetadata; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.TargetEnvironment; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/P2Generator.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/P2Generator.java index d9df6ff66d..7b3d3b97ba 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/P2Generator.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/P2Generator.java @@ -17,6 +17,8 @@ import java.util.List; import java.util.Map; +import org.eclipse.tycho.IArtifactFacade; + public interface P2Generator { /** * @param artifacts diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ReactorProjectFacade.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ReactorProjectFacade.java index 48808b7ff6..b0e2a02c47 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ReactorProjectFacade.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/ReactorProjectFacade.java @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.tycho.p2.metadata; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.ReactorProject; /** diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/AbstractMetadataGenerator.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/AbstractMetadataGenerator.java index 43412a5360..812ffb025b 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/AbstractMetadataGenerator.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/AbstractMetadataGenerator.java @@ -37,12 +37,12 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.tycho.BuildProperties; import org.eclipse.tycho.BuildPropertiesParser; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; import org.eclipse.tycho.Interpolator; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.TychoConstants; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.PublisherOptions; import org.eclipse.tycho.repository.util.StatusTool; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/MavenPropertiesAdvice.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/MavenPropertiesAdvice.java index 20ebca7b1d..c701822395 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/MavenPropertiesAdvice.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/MavenPropertiesAdvice.java @@ -22,9 +22,9 @@ import org.eclipse.equinox.p2.publisher.actions.IPropertyAdvice; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.core.shared.MavenContext; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; public class MavenPropertiesAdvice implements IPropertyAdvice { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/rootfiles/FeatureRootAdvice.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/rootfiles/FeatureRootAdvice.java index 0acb528b23..45d20a227e 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/rootfiles/FeatureRootAdvice.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/publisher/rootfiles/FeatureRootAdvice.java @@ -26,9 +26,9 @@ import org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice; import org.eclipse.tycho.BuildProperties; import org.eclipse.tycho.BuildPropertiesParser; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.Interpolator; import org.eclipse.tycho.PackagingType; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.ReactorProjectFacade; /** diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedArtifactKey.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedArtifactKey.java index e9c06f7a2b..42cdcda98e 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedArtifactKey.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedArtifactKey.java @@ -16,7 +16,7 @@ import org.eclipse.tycho.ArtifactKey; import org.eclipse.tycho.DefaultArtifactKey; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; +import org.eclipse.tycho.IArtifactFacade; public class ClassifiedArtifactKey { public final ArtifactKey artifactKey; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedLocation.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedLocation.java index abb79f0d22..67827edc39 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedLocation.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/ClassifiedLocation.java @@ -15,7 +15,7 @@ import java.io.File; import java.util.Objects; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; +import org.eclipse.tycho.IArtifactFacade; public class ClassifiedLocation { public final File location; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java index 2e71f8b45f..4e1592b90e 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/FileTargetDefinitionContent.java @@ -38,8 +38,8 @@ import org.eclipse.tycho.core.resolver.target.FileArtifactRepository; import org.eclipse.tycho.core.resolver.target.SupplierMetadataRepository; import org.eclipse.tycho.core.resolver.target.TargetDefinitionContent; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; import org.eclipse.tycho.p2.util.resolution.ResolverException; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; import org.osgi.framework.BundleException; public class FileTargetDefinitionContent implements TargetDefinitionContent { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/InstallableUnitResolver.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/InstallableUnitResolver.java index ef64eec7f9..f31849fe61 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/InstallableUnitResolver.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/InstallableUnitResolver.java @@ -39,11 +39,6 @@ import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.shared.MavenLogger; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.IncludeMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Unit; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionSyntaxException; import org.eclipse.tycho.p2.util.resolution.AbstractResolutionStrategy; import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints; import org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy; @@ -52,6 +47,11 @@ import org.eclipse.tycho.p2.util.resolution.ResolverException; import org.eclipse.tycho.p2.util.resolution.SlicerResolutionStrategy; import org.eclipse.tycho.repository.util.DuplicateFilteringLoggingProgressMonitor; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinitionSyntaxException; +import org.eclipse.tycho.targetplatform.TargetDefinition.IncludeMode; +import org.eclipse.tycho.targetplatform.TargetDefinition.InstallableUnitLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.Unit; public class InstallableUnitResolver { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/MavenTargetDefinitionContent.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/MavenTargetDefinitionContent.java index 3ebdd9aab0..42188a4a30 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/MavenTargetDefinitionContent.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/MavenTargetDefinitionContent.java @@ -52,6 +52,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.osgi.service.resolver.BundleDescription; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.resolver.target.FileArtifactRepository; import org.eclipse.tycho.core.resolver.target.SupplierMetadataRepository; @@ -61,16 +62,15 @@ import org.eclipse.tycho.core.shared.MavenDependenciesResolver; import org.eclipse.tycho.core.shared.MavenLogger; import org.eclipse.tycho.core.shared.MavenModelFacade; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.publisher.MavenChecksumAdvice; import org.eclipse.tycho.p2.publisher.MavenPropertiesAdvice; import org.eclipse.tycho.p2.repository.GAV; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.BNDInstructions; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenDependency; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenGAVLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenGAVLocation.DependencyDepth; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenGAVLocation.MissingManifestStrategy; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinition.BNDInstructions; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenDependency; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation.DependencyDepth; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation.MissingManifestStrategy; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; import org.w3c.dom.Element; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/URITargetDefinitionContent.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/URITargetDefinitionContent.java index 6b2d83ff14..69382e3be8 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/URITargetDefinitionContent.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/URITargetDefinitionContent.java @@ -28,7 +28,7 @@ import org.eclipse.tycho.core.resolver.target.TargetDefinitionContent; import org.eclipse.tycho.p2.repository.LazyArtifactRepository; import org.eclipse.tycho.p2.repository.RepositoryArtifactProvider; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; public class URITargetDefinitionContent implements TargetDefinitionContent { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/WrappedArtifact.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/WrappedArtifact.java index bfcd3d7784..190f7cff19 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/WrappedArtifact.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/resolver/WrappedArtifact.java @@ -20,8 +20,8 @@ import java.util.Properties; import java.util.jar.Manifest; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.p2.metadata.ArtifactFacadeProxy; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import aQute.bnd.osgi.Analyzer; import aQute.bnd.osgi.Jar; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/PomDependencyCollector.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/PomDependencyCollector.java index fccf7be60d..b83387dd38 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/PomDependencyCollector.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/PomDependencyCollector.java @@ -17,7 +17,7 @@ import java.util.Map; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.tycho.ArtifactKey; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; +import org.eclipse.tycho.IArtifactFacade; /** * Object that allows to collect POM dependency artifacts and their p2 metadata. diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java index dc7cb53ba3..ac4dd8489f 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java +++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java @@ -23,6 +23,7 @@ import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.artifacts.TargetPlatformFilter; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; +import org.eclipse.tycho.targetplatform.TargetDefinition; // TODO 412416 add an TargetPlatformConfiguration interface with only getters, and add implementation backed by the POM configuration public class TargetPlatformConfigurationStub { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/IArtifactFacade.java b/tycho-bundles/org.eclipse.tycho.embedder.shared/src/main/java/org/eclipse/tycho/IArtifactFacade.java similarity index 97% rename from tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/IArtifactFacade.java rename to tycho-bundles/org.eclipse.tycho.embedder.shared/src/main/java/org/eclipse/tycho/IArtifactFacade.java index b32495b285..8166e91825 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/metadata/IArtifactFacade.java +++ b/tycho-bundles/org.eclipse.tycho.embedder.shared/src/main/java/org/eclipse/tycho/IArtifactFacade.java @@ -11,7 +11,7 @@ * SAP AG - initial API and implementation * Christoph Läubrich - enhance Javadoc *******************************************************************************/ -package org.eclipse.tycho.p2.metadata; +package org.eclipse.tycho; import java.io.File; import java.util.Collections; diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenArtifactRepositoryReference.java b/tycho-bundles/org.eclipse.tycho.embedder.shared/src/main/java/org/eclipse/tycho/MavenArtifactRepositoryReference.java similarity index 94% rename from tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenArtifactRepositoryReference.java rename to tycho-bundles/org.eclipse.tycho.embedder.shared/src/main/java/org/eclipse/tycho/MavenArtifactRepositoryReference.java index 1ddf83b897..1a4a3b0a19 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenArtifactRepositoryReference.java +++ b/tycho-bundles/org.eclipse.tycho.embedder.shared/src/main/java/org/eclipse/tycho/MavenArtifactRepositoryReference.java @@ -10,7 +10,7 @@ * Contributors: * Christoph Läubrich - initial API and implementation *******************************************************************************/ -package org.eclipse.tycho.core.shared; +package org.eclipse.tycho; public interface MavenArtifactRepositoryReference { 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 d8a9da252b..7d40ad32fa 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 @@ -31,7 +31,7 @@ import org.eclipse.tycho.artifacts.TargetPlatformFilter; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.resolver.shared.PomDependencies; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; public class TargetPlatformConfiguration implements DependencyResolverConfiguration { diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenArtifactFacade.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenArtifactFacade.java index a92536707f..8b9e852928 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenArtifactFacade.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenArtifactFacade.java @@ -23,7 +23,7 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; +import org.eclipse.tycho.IArtifactFacade; public final class MavenArtifactFacade implements IArtifactFacade { diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java index d248044438..3390f9bcf5 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/MavenDependencyInjector.java @@ -44,6 +44,7 @@ import org.eclipse.tycho.ArtifactKey; import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.BuildProperties; +import org.eclipse.tycho.MavenArtifactRepositoryReference; import org.eclipse.tycho.MavenDependencyDescriptor; import org.eclipse.tycho.PackagingType; import org.eclipse.tycho.ReactorProject; @@ -52,7 +53,6 @@ import org.eclipse.tycho.core.osgitools.BundleReader; import org.eclipse.tycho.core.osgitools.DefaultReactorProject; import org.eclipse.tycho.core.osgitools.OsgiManifestParserException; -import org.eclipse.tycho.core.shared.MavenArtifactRepositoryReference; public final class MavenDependencyInjector { diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java index 5a07375291..c350573794 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java @@ -28,7 +28,7 @@ import org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration; import org.eclipse.tycho.core.osgitools.targetplatform.MultiEnvironmentDependencyArtifacts; import org.eclipse.tycho.core.utils.TychoProjectUtils; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinition; public abstract class AbstractTychoProject extends AbstractLogEnabled implements TychoProject { 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 f3d030b982..6ade6cb387 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 @@ -21,16 +21,14 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Map; +import java.util.Objects; import java.util.Properties; import org.apache.commons.io.FilenameUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; -import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; @@ -47,6 +45,9 @@ import org.eclipse.tycho.core.osgitools.DefaultReactorProject; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.resolver.shared.PomDependencies; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetPlatformArtifactResolver; +import org.eclipse.tycho.targetplatform.TargetResolveException; @Component(role = DefaultTargetPlatformConfigurationReader.class) public class DefaultTargetPlatformConfigurationReader { @@ -67,20 +68,18 @@ public class DefaultTargetPlatformConfigurationReader { private static final String OPTIONAL_RESOLUTION_REQUIRE = "require"; private static final String OPTIONAL_RESOLUTION_IGNORE = "ignore"; private static final String OPTIONAL_RESOLUTION_OPTIONAL = "optional"; - private static final String FILE_EXTENSION = ".target"; - @Requirement private Logger logger; - @Requirement - private RepositorySystem repositorySystem; - @Requirement private Map projectTypes; @Requirement private TargetPlatformFilterConfigurationReader filterReader; + @Requirement + private TargetPlatformArtifactResolver platformArtifactResolver; + public TargetPlatformConfiguration getTargetPlatformConfiguration(MavenSession session, MavenProject project) throws BuildFailureException { TargetPlatformConfiguration result = new TargetPlatformConfiguration(); @@ -374,7 +373,7 @@ private void setTarget(TargetPlatformConfiguration result, MavenSession session, for (Xpp3Dom fileDom : fileDomArray) { String file = fileDom.getValue(); File target = basedir.resolve(file).toFile(); - if (isTargetFile(target)) { + if (TargetDefinitionFile.isTargetFile(target)) { result.addTarget(target); return; } else { @@ -412,48 +411,13 @@ protected void addTargetArtifact(TargetPlatformConfiguration result, MavenSessio String artifactId = artifactIdDom.getValue(); String version = versionDom.getValue(); String classifier = classifierDom != null ? classifierDom.getValue() : null; - - //check if target is part of reactor-build - for (MavenProject otherProject : session.getProjects()) { - if (groupId.equals(otherProject.getGroupId()) && artifactId.equals(otherProject.getArtifactId()) - && version.equals(otherProject.getVersion())) { - if (classifier == null) { - File[] targetFiles = listTargetFiles(otherProject.getBasedir()); - for (File targetFile : targetFiles) { - if (isPrimaryTarget(otherProject, targetFile, targetFiles)) { - result.addTarget(targetFile); - return; - } - } - throwNoPrimaryTargetFound(otherProject, targetFiles); - } else { - File target = new File(otherProject.getBasedir(), classifier + FILE_EXTENSION); - if (isTargetFile(target)) { - result.addTarget(target); - return; - } else { - throw new MojoExecutionException("target definition file '" + target - + "' not found in project '" + project.getName() + "'."); - } - } - } - } - // resolve using maven - - Artifact artifact = repositorySystem.createArtifactWithClassifier(groupId, artifactId, version, TARGET, - classifier); - ArtifactResolutionRequest request = new ArtifactResolutionRequest(); - request.setArtifact(artifact); - request.setLocalRepository(session.getLocalRepository()); - request.setRemoteRepositories(project.getRemoteArtifactRepositories()); - repositorySystem.resolve(request); - - if (artifact.isResolved()) { - result.addTarget(artifact.getFile()); - return; + try { + result.addTarget(platformArtifactResolver.resolveTargetFile(groupId, artifactId, version, classifier, + session, project.getRemoteArtifactRepositories())); + } catch (TargetResolveException e) { + throw new MojoExecutionException("resolve target artifact " + groupId + ":" + artifactId + ":" + version + + ":" + Objects.requireNonNullElse(classifier, "no classifier") + " failed!", e); } - throw new RuntimeException("Could not resolve target platform specification artifact " + artifact); - } private void setTargetPlatformResolver(TargetPlatformConfiguration result, Xpp3Dom configuration) { @@ -534,34 +498,6 @@ private static String getStringValue(Xpp3Dom element) { } } - /** - * List all target files in the given folder - * - * @param folder - * @return the found target files or empty array if nothing was found, folder is not a directory - * or the directory could not be read - */ - public static File[] listTargetFiles(File folder) { - if (folder.isDirectory()) { - File[] targetFiles = folder.listFiles(DefaultTargetPlatformConfigurationReader::isTargetFile); - if (targetFiles != null) { - return targetFiles; - } - } - return new File[0]; - } - - /** - * - * @param file - * @return true if the given files likely denotes are targetfile based on file - * naming, false otherwise - */ - public static boolean isTargetFile(File file) { - return file != null && file.isFile() && file.getName().toLowerCase().endsWith(FILE_EXTENSION) - && !file.getName().startsWith(".polyglot."); - } - /** * Checks if the given target file is the "primary" target artifact file among others * @@ -575,10 +511,10 @@ public static boolean isTargetFile(File file) { */ public static boolean isPrimaryTarget(MavenProject project, File targetFile, File[] otherTargetFiles) { if (otherTargetFiles != null && otherTargetFiles.length == 1) { - return isTargetFile(otherTargetFiles[0]); + return TargetDefinitionFile.isTargetFile(otherTargetFiles[0]); } String name = targetFile.getName(); - if (name.toLowerCase().endsWith(FILE_EXTENSION)) { + if (name.toLowerCase().endsWith(TargetDefinitionFile.FILE_EXTENSION)) { String baseName = FilenameUtils.getBaseName(name); if (baseName.equalsIgnoreCase(project.getArtifactId())) { return true; @@ -593,8 +529,8 @@ public static void throwNoPrimaryTargetFound(MavenProject project, File[] target throw new MojoExecutionException( "No target definition file(s) found in project '" + project.getName() + "'."); } - throw new MojoExecutionException("One target file must be named '" + project.getArtifactId() + FILE_EXTENSION - + "' when multiple targets are present"); + throw new MojoExecutionException("One target file must be named '" + project.getArtifactId() + + TargetDefinitionFile.FILE_EXTENSION + "' when multiple targets are present"); } } diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenDependenciesResolverConfigurer.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenDependenciesResolverConfigurer.java index b9d97f72ce..8023a313d7 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenDependenciesResolverConfigurer.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenDependenciesResolverConfigurer.java @@ -38,9 +38,9 @@ import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.eclipse.tycho.MavenArtifactRepositoryReference; import org.eclipse.tycho.core.maven.MavenArtifactFacade; import org.eclipse.tycho.core.shared.DependencyResolutionException; -import org.eclipse.tycho.core.shared.MavenArtifactRepositoryReference; import org.eclipse.tycho.core.shared.MavenDependenciesResolver; import org.eclipse.tycho.core.shared.MavenModelFacade; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/DefaultDependencyMetadataGenerator.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/DefaultDependencyMetadataGenerator.java index 8667af3cb0..c693810c8c 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/DefaultDependencyMetadataGenerator.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/DefaultDependencyMetadataGenerator.java @@ -16,10 +16,10 @@ import org.codehaus.plexus.component.annotations.Component; import org.eclipse.equinox.p2.publisher.PublisherInfo; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.p2.metadata.DependencyMetadataGenerator; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.PublisherOptions; import org.eclipse.tycho.p2.publisher.DependencyMetadata; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/FinalTargetPlatformImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/FinalTargetPlatformImpl.java index 91b3d568c8..1a04e0b06b 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/FinalTargetPlatformImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/FinalTargetPlatformImpl.java @@ -18,9 +18,9 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.ReactorProjectIdentities; import org.eclipse.tycho.p2.artifact.provider.IRawArtifactFileProvider; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.repository.ImmutableInMemoryMetadataRepository; import org.eclipse.tycho.p2.repository.LocalArtifactRepository; import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints; 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 99486f0bfa..44bc0c517d 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 @@ -43,13 +43,13 @@ import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.tycho.BuildPropertiesParser; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.Interpolator; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.PackagingType; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.core.shared.MavenContext; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.IP2Artifact; import org.eclipse.tycho.p2.metadata.P2Generator; import org.eclipse.tycho.p2.metadata.PublisherOptions; 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 026e4e5162..2d689b007c 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 @@ -53,6 +53,7 @@ import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.DefaultArtifactKey; import org.eclipse.tycho.DependencyResolutionException; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; import org.eclipse.tycho.IllegalArtifactReferenceException; import org.eclipse.tycho.PackagingType; @@ -68,7 +69,6 @@ import org.eclipse.tycho.core.resolver.target.P2TargetPlatform; import org.eclipse.tycho.core.shared.MavenLogger; import org.eclipse.tycho.core.shared.MultiLineLogger; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.publisher.AuthoredIUAction; import org.eclipse.tycho.p2.repository.QueryableCollection; import org.eclipse.tycho.p2.resolver.DefaultP2ResolutionResult; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/PomDependencyCollectorImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/PomDependencyCollectorImpl.java index a2e990da04..d18c95281f 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/PomDependencyCollectorImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/PomDependencyCollectorImpl.java @@ -38,6 +38,7 @@ import org.eclipse.tycho.ArtifactKey; import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.DefaultArtifactKey; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.core.resolver.target.FileArtifactRepository; @@ -46,7 +47,6 @@ import org.eclipse.tycho.core.shared.MavenContext; import org.eclipse.tycho.core.shared.MavenLogger; import org.eclipse.tycho.p2.artifact.provider.IRawArtifactFileProvider; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.ReactorProjectFacade; import org.eclipse.tycho.p2.repository.ArtifactTransferPolicies; import org.eclipse.tycho.p2.repository.CompositeArtifactProvider; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/ReactorRepositoryManagerImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/ReactorRepositoryManagerImpl.java index cf3d14eeb4..dbba590ddd 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/ReactorRepositoryManagerImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/ReactorRepositoryManagerImpl.java @@ -25,20 +25,20 @@ import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.core.IProvisioningAgentProvider; import org.eclipse.equinox.p2.core.ProvisionException; +import org.eclipse.tycho.MavenArtifactRepositoryReference; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.ReactorProjectIdentities; import org.eclipse.tycho.TargetPlatform; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration; -import org.eclipse.tycho.core.shared.MavenArtifactRepositoryReference; import org.eclipse.tycho.p2.repository.module.PublishingRepositoryImpl; import org.eclipse.tycho.p2.resolver.facade.P2ResolverFactory; import org.eclipse.tycho.p2.target.facade.PomDependencyCollector; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenGAVLocation; import org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub; import org.eclipse.tycho.p2.target.facade.TargetPlatformFactory; import org.eclipse.tycho.repository.publishing.PublishingRepository; import org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManager; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation; @Component(role = ReactorRepositoryManager.class) public class ReactorRepositoryManagerImpl implements ReactorRepositoryManager, Disposable { 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 b067f6cc3f..9a64de98b2 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 @@ -27,11 +27,11 @@ import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.osgi.service.resolver.StateObjectFactory; import org.eclipse.tycho.BuildPropertiesParser; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.core.shared.MavenContext; import org.eclipse.tycho.p2.metadata.DependencyMetadataGenerator; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.PublisherOptions; import org.eclipse.tycho.p2.publisher.AbstractMetadataGenerator; import org.eclipse.tycho.p2.publisher.DependencyMetadata; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolver.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolver.java index 5f938a3c65..6d28993367 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolver.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolver.java @@ -56,22 +56,22 @@ import org.eclipse.tycho.p2.resolver.InstallableUnitResolver; import org.eclipse.tycho.p2.resolver.MavenTargetDefinitionContent; import org.eclipse.tycho.p2.resolver.URITargetDefinitionContent; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.DirectoryLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.FeaturesLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Location; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenGAVLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.PathLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.ProfileLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.TargetReferenceLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionSyntaxException; import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints; import org.eclipse.tycho.p2.util.resolution.ResolverException; import org.eclipse.tycho.repository.util.LoggingProgressMonitor; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinitionSyntaxException; +import org.eclipse.tycho.targetplatform.TargetDefinition.DirectoryLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.FeaturesLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.InstallableUnitLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.Location; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.PathLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.ProfileLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.Repository; +import org.eclipse.tycho.targetplatform.TargetDefinition.TargetReferenceLocation; /** * Class which performs target definition resolution. This class is used by the diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverService.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverService.java index d6ef068cfb..536e1fa56e 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverService.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverService.java @@ -32,8 +32,8 @@ import org.eclipse.tycho.core.resolver.target.TargetDefinitionContent; import org.eclipse.tycho.core.shared.MavenContext; import org.eclipse.tycho.core.shared.MavenDependenciesResolver; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints; +import org.eclipse.tycho.targetplatform.TargetDefinition; /** * Service instance for resolving target definitions. Results are cached so that there is no diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformBaseImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformBaseImpl.java index 0ecdcb6258..fe28126940 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformBaseImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformBaseImpl.java @@ -28,13 +28,13 @@ import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.DefaultArtifactKey; import org.eclipse.tycho.DependencyResolutionException; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IllegalArtifactReferenceException; import org.eclipse.tycho.ReactorProjectIdentities; import org.eclipse.tycho.core.resolver.target.ArtifactMatcher; import org.eclipse.tycho.core.resolver.target.ArtifactTypeHelper; import org.eclipse.tycho.core.resolver.target.P2TargetPlatform; import org.eclipse.tycho.p2.artifact.provider.IRawArtifactFileProvider; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.repository.LocalArtifactRepository; import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints; diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java index 0bd26b42ea..6b73981971 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java @@ -46,6 +46,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IRepositoryIdManager; import org.eclipse.tycho.MavenRepositoryLocation; import org.eclipse.tycho.ReactorProject; @@ -62,7 +63,6 @@ import org.eclipse.tycho.core.shared.MavenContext; import org.eclipse.tycho.core.shared.MavenLogger; import org.eclipse.tycho.p2.artifact.provider.IRawArtifactFileProvider; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.ReactorProjectFacade; import org.eclipse.tycho.p2.repository.ArtifactRepositoryBlackboard; import org.eclipse.tycho.p2.repository.ArtifactTransferPolicies; @@ -76,13 +76,13 @@ import org.eclipse.tycho.p2.repository.ProviderOnlyArtifactRepository; import org.eclipse.tycho.p2.repository.RepositoryArtifactProvider; import org.eclipse.tycho.p2.target.facade.PomDependencyCollector; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; import org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub; import org.eclipse.tycho.p2.target.facade.TargetPlatformFactory; import org.eclipse.tycho.p2.util.resolution.ExecutionEnvironmentResolutionHints; import org.eclipse.tycho.repository.publishing.PublishingRepository; import org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey; import org.eclipse.tycho.repository.util.DuplicateFilteringLoggingProgressMonitor; +import org.eclipse.tycho.targetplatform.TargetDefinition; public class TargetPlatformFactoryImpl implements TargetPlatformFactory { diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/maven/MavenDependenciesResolverTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/maven/MavenDependenciesResolverTest.java index b5f6101419..aa902f0b3d 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/core/maven/MavenDependenciesResolverTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/core/maven/MavenDependenciesResolverTest.java @@ -24,8 +24,8 @@ import org.apache.maven.project.MavenProject; import org.codehaus.plexus.PlexusContainerException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.eclipse.tycho.MavenArtifactRepositoryReference; import org.eclipse.tycho.core.shared.DependencyResolutionException; -import org.eclipse.tycho.core.shared.MavenArtifactRepositoryReference; import org.eclipse.tycho.core.shared.MavenDependenciesResolver; import org.eclipse.tycho.osgi.configuration.MavenDependenciesResolverConfigurer; import org.junit.Test; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReaderTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReaderTest.java index 85dc44e186..5397bd69a5 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReaderTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReaderTest.java @@ -85,10 +85,20 @@ public void testAddTargetWithValidMissingTargetDefinition() { MavenSession session = setupMockSession(); TargetPlatformConfiguration configuration = new TargetPlatformConfiguration(); try { - configurationReader.addTargetArtifact(configuration, session, null, dom); + configurationReader.addTargetArtifact(configuration, session, new MavenProject(), dom); } catch (MojoExecutionException e) { - assertTrue(e.getMessage().contains("No target definition file(s) found in project")); + assertMessageContains(e, "No target definition file(s) found in project"); + } + } + + private void assertMessageContains(Throwable throwable, String string) { + if (throwable == null) { + fail("Message " + string + " was not found in the exception stack!"); + } + if (throwable.getMessage().contains(string)) { + return; } + assertMessageContains(throwable.getCause(), string); } @Test diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverExecutionEnvironmentTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverExecutionEnvironmentTest.java index aa12869f1c..f0e30a07aa 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverExecutionEnvironmentTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverExecutionEnvironmentTest.java @@ -34,10 +34,10 @@ import org.eclipse.tycho.core.ee.impl.StandardEEResolutionHints; import org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentStub; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverIncludeModeTest.PlannerLocationStub; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.RepositoryStub; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinition.Repository; import org.eclipse.tycho.test.util.LogVerifier; import org.eclipse.tycho.test.util.MockMavenContext; import org.eclipse.tycho.testing.TychoPlexusTestCase; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeModeTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeModeTest.java index e3dd2e51d4..000ffc3fce 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeModeTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeModeTest.java @@ -31,12 +31,12 @@ import org.eclipse.equinox.p2.metadata.IVersionedId; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.resolver.target.TargetDefinitionContent; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.IncludeMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; import org.eclipse.tycho.p2.util.resolution.ResolverException; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.LocationStub; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.TestRepositories; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinition.IncludeMode; import org.eclipse.tycho.test.util.LogVerifier; import org.eclipse.tycho.test.util.MockMavenContext; import org.eclipse.tycho.testing.TychoPlexusTestCase; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeSourceTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeSourceTest.java index b146d46feb..b4e563db31 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeSourceTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverIncludeSourceTest.java @@ -27,11 +27,11 @@ import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.resolver.target.TargetDefinitionContent; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.IncludeMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.LocationStub; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.TestRepositories; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinition.IncludeMode; import org.eclipse.tycho.test.util.LogVerifier; import org.eclipse.tycho.test.util.MockMavenContext; import org.eclipse.tycho.testing.TychoPlexusTestCase; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverTest.java index 944ec51bdd..10bc92ed3f 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverTest.java @@ -39,14 +39,14 @@ import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.resolver.target.TargetDefinitionContent; import org.eclipse.tycho.core.test.utils.ResourceUtil; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.IncludeMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Location; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Unit; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionSyntaxException; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinitionSyntaxException; +import org.eclipse.tycho.targetplatform.TargetDefinition.IncludeMode; +import org.eclipse.tycho.targetplatform.TargetDefinition.InstallableUnitLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.Location; +import org.eclipse.tycho.targetplatform.TargetDefinition.Repository; +import org.eclipse.tycho.targetplatform.TargetDefinition.Unit; import org.eclipse.tycho.test.util.LogVerifier; import org.eclipse.tycho.test.util.MockMavenContext; import org.eclipse.tycho.testing.TychoPlexusTestCase; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverWithPlatformSpecificUnitsTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverWithPlatformSpecificUnitsTest.java index 3a7842ebca..686bfb2e20 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverWithPlatformSpecificUnitsTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetDefinitionResolverWithPlatformSpecificUnitsTest.java @@ -31,13 +31,13 @@ import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; import org.eclipse.tycho.core.resolver.target.TargetDefinitionContent; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.IncludeMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Unit; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.RepositoryStub; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.UnitStub; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinition.IncludeMode; +import org.eclipse.tycho.targetplatform.TargetDefinition.Repository; +import org.eclipse.tycho.targetplatform.TargetDefinition.Unit; import org.eclipse.tycho.test.util.LogVerifier; import org.eclipse.tycho.test.util.MockMavenContext; import org.eclipse.tycho.testing.TychoPlexusTestCase; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformBundlePublisherTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformBundlePublisherTest.java index 2a00c481a6..5c1318c283 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformBundlePublisherTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformBundlePublisherTest.java @@ -34,11 +34,11 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.core.resolver.target.MavenBundleInfo; import org.eclipse.tycho.core.resolver.target.TargetPlatformBundlePublisher; import org.eclipse.tycho.core.test.utils.ResourceUtil; import org.eclipse.tycho.p2.artifact.provider.IRawArtifactProvider; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper; import org.eclipse.tycho.p2.resolver.WrappedArtifact; import org.eclipse.tycho.test.util.ArtifactMock; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java index 1bd234925f..b89b27ff2d 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java @@ -58,11 +58,11 @@ import org.eclipse.tycho.p2.publisher.DependencyMetadata; import org.eclipse.tycho.p2.repository.GAV; import org.eclipse.tycho.p2.repository.LocalMetadataRepository; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; import org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.TargetDefinitionStub; import org.eclipse.tycho.p2resolver.TargetDefinitionResolverTest.TestRepositories; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; import org.eclipse.tycho.test.util.InstallableUnitUtil; import org.eclipse.tycho.test.util.LogVerifier; import org.eclipse.tycho.test.util.MockMavenContext; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/test/util/ArtifactMock.java b/tycho-core/src/test/java/org/eclipse/tycho/test/util/ArtifactMock.java index 442e4fcf03..15cfbea1a8 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/test/util/ArtifactMock.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/test/util/ArtifactMock.java @@ -17,9 +17,9 @@ import java.util.Set; import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IDependencyMetadata; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; public class ArtifactMock implements IArtifactFacade { private File location; diff --git a/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestResolverFactory.java b/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestResolverFactory.java index 9432d36f40..039f122bcd 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestResolverFactory.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestResolverFactory.java @@ -24,10 +24,10 @@ import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.tycho.ArtifactDescriptor; import org.eclipse.tycho.IRepositoryIdManager; +import org.eclipse.tycho.MavenArtifactRepositoryReference; import org.eclipse.tycho.MavenDependencyDescriptor; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.core.shared.DependencyResolutionException; -import org.eclipse.tycho.core.shared.MavenArtifactRepositoryReference; import org.eclipse.tycho.core.shared.MavenContext; import org.eclipse.tycho.core.shared.MavenDependenciesResolver; import org.eclipse.tycho.core.shared.MavenLogger; diff --git a/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java b/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java index a7cb773f16..63b9cf2c10 100644 --- a/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java +++ b/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPError.java @@ -17,7 +17,7 @@ import java.io.IOException; import java.io.PrintStream; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionResolutionException; +import org.eclipse.tycho.targetplatform.TargetDefinitionResolutionException; public class TPError extends Exception { diff --git a/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java b/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java index 2132eb7522..c21ab801f5 100644 --- a/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java +++ b/tycho-extras/target-platform-validation-plugin/src/main/java/org/eclipse/tycho/extras/tpvalidator/TPValidationMojo.java @@ -43,14 +43,14 @@ import org.eclipse.tycho.osgi.adapters.MavenLoggerAdapter; import org.eclipse.tycho.p2.resolver.facade.P2Resolver; import org.eclipse.tycho.p2.resolver.facade.P2ResolverFactory; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Location; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Unit; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; import org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub; import org.eclipse.tycho.p2.tools.RepositoryReferences; import org.eclipse.tycho.p2.tools.director.shared.DirectorRuntime; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetDefinition.InstallableUnitLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.Location; +import org.eclipse.tycho.targetplatform.TargetDefinition.Repository; +import org.eclipse.tycho.targetplatform.TargetDefinition.Unit; /** * Validates that specified target platforms (.target files) contents can be resolved. @@ -126,7 +126,7 @@ public void execute() throws MojoExecutionException { targetFilesToValidate = this.targetFiles; } else if (this.project != null && PackagingType.TYPE_ECLIPSE_TARGET_DEFINITION.equals(this.project.getPackaging())) { - File[] targetFiles = DefaultTargetPlatformConfigurationReader.listTargetFiles(project.getBasedir()); + File[] targetFiles = TargetDefinitionFile.listTargetFiles(project.getBasedir()); Optional primaryTarget = Arrays.stream(targetFiles) .filter(targetFile -> DefaultTargetPlatformConfigurationReader.isPrimaryTarget(project, targetFile, targetFiles)) diff --git a/tycho-extras/tycho-version-bump-plugin/src/main/java/org/eclipse/tycho/versionbump/UpdateTargetMojo.java b/tycho-extras/tycho-version-bump-plugin/src/main/java/org/eclipse/tycho/versionbump/UpdateTargetMojo.java index b66104e515..1e0014dc73 100644 --- a/tycho-extras/tycho-version-bump-plugin/src/main/java/org/eclipse/tycho/versionbump/UpdateTargetMojo.java +++ b/tycho-extras/tycho-version-bump-plugin/src/main/java/org/eclipse/tycho/versionbump/UpdateTargetMojo.java @@ -30,12 +30,12 @@ import org.apache.maven.project.MavenProject; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult; -import org.eclipse.tycho.p2.target.facade.TargetDefinition; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.IncludeMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Unit; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetDefinition; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetDefinition.IncludeMode; +import org.eclipse.tycho.targetplatform.TargetDefinition.InstallableUnitLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.Repository; +import org.eclipse.tycho.targetplatform.TargetDefinition.Unit; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/util/TargetDefinitionUtil.java b/tycho-its/src/test/java/org/eclipse/tycho/test/util/TargetDefinitionUtil.java index 88a7a8af16..d856859e4d 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/util/TargetDefinitionUtil.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/util/TargetDefinitionUtil.java @@ -22,7 +22,7 @@ import javax.xml.parsers.ParserConfigurationException; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; diff --git a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/facade/internal/ArtifactFacade.java b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/facade/internal/ArtifactFacade.java index 5bd429641c..84026d8f6d 100644 --- a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/facade/internal/ArtifactFacade.java +++ b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/facade/internal/ArtifactFacade.java @@ -17,7 +17,7 @@ import java.util.Objects; import org.apache.maven.artifact.Artifact; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; +import org.eclipse.tycho.IArtifactFacade; public final class ArtifactFacade implements IArtifactFacade { diff --git a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java index d70db8027e..a0c80cce61 100644 --- a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java +++ b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java @@ -99,11 +99,11 @@ import org.eclipse.tycho.p2.resolver.facade.P2Resolver; import org.eclipse.tycho.p2.resolver.facade.P2ResolverFactory; import org.eclipse.tycho.p2.target.facade.PomDependencyCollector; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; import org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub; import org.eclipse.tycho.p2maven.helper.PluginRealmHelper; import org.eclipse.tycho.p2maven.repository.P2ArtifactRepositoryLayout; import org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManager; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; @Component(role = DependencyResolver.class, hint = P2DependencyResolver.ROLE_HINT, instantiationStrategy = "per-lookup") public class P2DependencyResolver extends AbstractLogEnabled implements DependencyResolver, Initializable { diff --git a/tycho-p2/tycho-p2-facade/src/test/java/org/eclipse/tycho/p2/resolver/TargetDefinitionFileTest.java b/tycho-p2/tycho-p2-facade/src/test/java/org/eclipse/tycho/p2/resolver/TargetDefinitionFileTest.java index b594336dfa..b428004a40 100644 --- a/tycho-p2/tycho-p2-facade/src/test/java/org/eclipse/tycho/p2/resolver/TargetDefinitionFileTest.java +++ b/tycho-p2/tycho-p2-facade/src/test/java/org/eclipse/tycho/p2/resolver/TargetDefinitionFileTest.java @@ -25,14 +25,14 @@ import java.util.List; import org.eclipse.tycho.core.resolver.shared.IncludeSourceMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.DirectoryLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.FeaturesLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.IncludeMode; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.Location; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.ProfileLocation; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionFile; -import org.eclipse.tycho.p2.target.facade.TargetDefinitionSyntaxException; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; +import org.eclipse.tycho.targetplatform.TargetDefinitionSyntaxException; +import org.eclipse.tycho.targetplatform.TargetDefinition.DirectoryLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.FeaturesLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.IncludeMode; +import org.eclipse.tycho.targetplatform.TargetDefinition.InstallableUnitLocation; +import org.eclipse.tycho.targetplatform.TargetDefinition.Location; +import org.eclipse.tycho.targetplatform.TargetDefinition.ProfileLocation; import org.junit.jupiter.api.Test; class TargetDefinitionFileTest { diff --git a/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/P2MetadataMojo.java b/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/P2MetadataMojo.java index b44b124361..080ba57480 100644 --- a/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/P2MetadataMojo.java +++ b/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/P2MetadataMojo.java @@ -36,13 +36,13 @@ import org.apache.maven.project.MavenProjectHelper; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.tycho.ArtifactType; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.artifactcomparator.ArtifactComparator.ComparisonData; import org.eclipse.tycho.core.osgitools.DefaultReactorProject; import org.eclipse.tycho.p2.facade.internal.ArtifactFacade; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.IP2Artifact; import org.eclipse.tycho.p2.metadata.P2Generator; import org.eclipse.tycho.p2.metadata.PublisherOptions; diff --git a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageTargetDefinitionMojo.java b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageTargetDefinitionMojo.java index 3c9bbb9b71..f5f2172c7c 100644 --- a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageTargetDefinitionMojo.java +++ b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageTargetDefinitionMojo.java @@ -26,6 +26,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; import org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader; +import org.eclipse.tycho.targetplatform.TargetDefinitionFile; /** * Registers all target definition files in the basedir of a project as maven artifact. @@ -42,7 +43,7 @@ public class PackageTargetDefinitionMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { - File[] targetFiles = DefaultTargetPlatformConfigurationReader.listTargetFiles(project.getBasedir()); + File[] targetFiles = TargetDefinitionFile.listTargetFiles(project.getBasedir()); for (File targetFile : targetFiles) { if (DefaultTargetPlatformConfigurationReader.isPrimaryTarget(project, targetFile, targetFiles)) { project.getArtifact().setFile(targetFile); diff --git a/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourceFeatureP2MetadataProvider.java b/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourceFeatureP2MetadataProvider.java index 073ea835c9..710d071247 100644 --- a/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourceFeatureP2MetadataProvider.java +++ b/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourceFeatureP2MetadataProvider.java @@ -26,6 +26,7 @@ import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IDependencyMetadata; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.TargetEnvironment; @@ -33,7 +34,6 @@ import org.eclipse.tycho.model.FeatureRef; import org.eclipse.tycho.p2.facade.internal.AttachedArtifact; import org.eclipse.tycho.p2.metadata.DependencyMetadataGenerator; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.PublisherOptions; import org.eclipse.tycho.p2.resolver.P2MetadataProvider; diff --git a/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourcesP2MetadataProvider.java b/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourcesP2MetadataProvider.java index 862bf06518..e33d807dbd 100644 --- a/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourcesP2MetadataProvider.java +++ b/tycho-source-plugin/src/main/java/org/eclipse/tycho/source/SourcesP2MetadataProvider.java @@ -22,12 +22,12 @@ import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; +import org.eclipse.tycho.IArtifactFacade; import org.eclipse.tycho.IDependencyMetadata; import org.eclipse.tycho.OptionalResolutionAction; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.p2.facade.internal.AttachedArtifact; import org.eclipse.tycho.p2.metadata.DependencyMetadataGenerator; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; import org.eclipse.tycho.p2.metadata.PublisherOptions; import org.eclipse.tycho.p2.resolver.P2MetadataProvider; diff --git a/tycho-targetplatform/.classpath b/tycho-targetplatform/.classpath new file mode 100644 index 0000000000..3bc452ee9e --- /dev/null +++ b/tycho-targetplatform/.classpath @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tycho-targetplatform/.project b/tycho-targetplatform/.project new file mode 100644 index 0000000000..0ed67859be --- /dev/null +++ b/tycho-targetplatform/.project @@ -0,0 +1,23 @@ + + + tycho-targetplatform + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/tycho-targetplatform/.settings/org.eclipse.core.resources.prefs b/tycho-targetplatform/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..29abf99956 --- /dev/null +++ b/tycho-targetplatform/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/tycho-targetplatform/.settings/org.eclipse.jdt.core.prefs b/tycho-targetplatform/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..cf2cd4590a --- /dev/null +++ b/tycho-targetplatform/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/tycho-targetplatform/.settings/org.eclipse.m2e.core.prefs b/tycho-targetplatform/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000..f897a7f1cb --- /dev/null +++ b/tycho-targetplatform/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/tycho-targetplatform/pom.xml b/tycho-targetplatform/pom.xml new file mode 100644 index 0000000000..c56763be08 --- /dev/null +++ b/tycho-targetplatform/pom.xml @@ -0,0 +1,35 @@ + + 4.0.0 + + org.eclipse.tycho + tycho + 4.0.0-SNAPSHOT + + tycho-targetplatform + Tycho Target Platform + Contains the neccesary bits to handle target platform files. + + + org.eclipse.tycho + org.eclipse.tycho.embedder.shared + ${project.version} + + + org.codehaus.plexus + plexus-component-annotations + + + org.apache.maven + maven-core + + + + + + + org.codehaus.plexus + plexus-component-metadata + + + + \ No newline at end of file diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinition.java b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinition.java similarity index 97% rename from tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinition.java rename to tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinition.java index ab0b240228..d4d5467c43 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinition.java +++ b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinition.java @@ -16,15 +16,15 @@ * [Issue 194] - Support additional repositories defined in the maven-target location * [Issue 401] - Support nested targets *******************************************************************************/ -package org.eclipse.tycho.p2.target.facade; +package org.eclipse.tycho.targetplatform; import java.net.URI; import java.util.Collection; import java.util.List; import java.util.Properties; -import org.eclipse.tycho.core.shared.MavenArtifactRepositoryReference; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; +import org.eclipse.tycho.IArtifactFacade; +import org.eclipse.tycho.MavenArtifactRepositoryReference; import org.w3c.dom.Element; // TODO javadoc diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionFile.java b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionFile.java similarity index 94% rename from tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionFile.java rename to tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionFile.java index 52b269ffc2..282d1890a3 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionFile.java +++ b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionFile.java @@ -18,7 +18,7 @@ * - [Issue 194] - Support additional repositories defined in the maven-target location * - [Issue 401] - Support nested targets *******************************************************************************/ -package org.eclipse.tycho.p2.target.facade; +package org.eclipse.tycho.targetplatform; import java.io.BufferedOutputStream; import java.io.File; @@ -48,10 +48,10 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.eclipse.tycho.core.shared.MavenArtifactRepositoryReference; -import org.eclipse.tycho.p2.metadata.IArtifactFacade; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenGAVLocation.DependencyDepth; -import org.eclipse.tycho.p2.target.facade.TargetDefinition.MavenGAVLocation.MissingManifestStrategy; +import org.eclipse.tycho.IArtifactFacade; +import org.eclipse.tycho.MavenArtifactRepositoryReference; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation.DependencyDepth; +import org.eclipse.tycho.targetplatform.TargetDefinition.MavenGAVLocation.MissingManifestStrategy; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -70,6 +70,7 @@ public final class TargetDefinitionFile implements TargetDefinition { private boolean hasIncludeBundles; private String targetEE; + public static final String FILE_EXTENSION = ".target"; private abstract static class AbstractPathLocation implements TargetDefinition.PathLocation { private String path; @@ -186,7 +187,8 @@ public MavenLocation(Collection roots, Collection inclu this.featureTemplate = featureTemplate == null ? null : (Element) featureTemplate.cloneNode(true); } - public Collection getIncludeDependencyScopes() { + @Override + public Collection getIncludeDependencyScopes() { return includeDependencyScopes; } @@ -532,7 +534,36 @@ public String toString() { return "TargetDefinitionFile[" + origin + "]"; } - private static List parseLocations(Element dom) { + /** + * List all target files in the given folder + * + * @param folder + * @return the found target files or empty array if nothing was found, folder is not a directory + * or the directory could not be read + */ + public static File[] listTargetFiles(File folder) { + if (folder.isDirectory()) { + File[] targetFiles = folder.listFiles(TargetDefinitionFile::isTargetFile); + if (targetFiles != null) { + return targetFiles; + } + } + return new File[0]; + } + + /** + * + * @param file + * @return true if the given files likely denotes are targetfile based on file + * naming, false otherwise + */ + public static boolean isTargetFile(File file) { + return file != null && file.isFile() + && file.getName().toLowerCase().endsWith(TargetDefinitionFile.FILE_EXTENSION) + && !file.getName().startsWith(".polyglot."); + } + + private static List parseLocations(Element dom) { ArrayList locations = new ArrayList<>(); Element locationsDom = getChild(dom, "locations"); if (locationsDom != null) { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionResolutionException.java b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionResolutionException.java similarity index 95% rename from tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionResolutionException.java rename to tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionResolutionException.java index 11149d1428..1c444a8a92 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionResolutionException.java +++ b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionResolutionException.java @@ -10,7 +10,7 @@ * Contributors: * SAP SE - initial API and implementation *******************************************************************************/ -package org.eclipse.tycho.p2.target.facade; +package org.eclipse.tycho.targetplatform; public class TargetDefinitionResolutionException extends RuntimeException { diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionSyntaxException.java b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionSyntaxException.java similarity index 95% rename from tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionSyntaxException.java rename to tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionSyntaxException.java index 267dc7eae0..7ac5dd73b1 100644 --- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetDefinitionSyntaxException.java +++ b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionSyntaxException.java @@ -10,7 +10,7 @@ * Contributors: * SAP SE - initial API and implementation *******************************************************************************/ -package org.eclipse.tycho.p2.target.facade; +package org.eclipse.tycho.targetplatform; public class TargetDefinitionSyntaxException extends RuntimeException { diff --git a/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetPlatformArtifactResolver.java b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetPlatformArtifactResolver.java new file mode 100644 index 0000000000..07291d347d --- /dev/null +++ b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetPlatformArtifactResolver.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2022 Christoph Läubrich 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: + * Christoph Läubrich - initial API and implementation based on DefaultTargetPlatformConfigurationReader + *******************************************************************************/ +package org.eclipse.tycho.targetplatform; + +import java.io.File; +import java.util.List; + +import org.apache.commons.io.FilenameUtils; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.project.MavenProject; +import org.apache.maven.repository.RepositorySystem; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * This component resolves a given target artifact to a target platform file + * + */ +@Component(role = TargetPlatformArtifactResolver.class) +public class TargetPlatformArtifactResolver { + + private static final String TARGET_TYPE = "target"; + + @Requirement + private RepositorySystem repositorySystem; + + /** + * Resolves the target file artifact with the given coordinates, session and + * remote repositories + * + * @param groupId + * @param artifactId + * @param version + * @param classifier + * @param session + * @param remoteRepositories + * @return the target file for the specified artifact + * @throws TargetResolveException if resolving the target fails + */ + public File resolveTargetFile(String groupId, String artifactId, String version, String classifier, + MavenSession session, List remoteRepositories) throws TargetResolveException { + //check if target is part of reactor-build + for (MavenProject project : session.getProjects()) { + if (groupId.equals(project.getGroupId()) && artifactId.equals(project.getArtifactId()) + && version.equals(project.getVersion())) { + if (classifier == null) { + File[] targetFiles = TargetDefinitionFile + .listTargetFiles(project.getBasedir()); + if (targetFiles == null || targetFiles.length == 0) { + throw new TargetResolveException( + "No target definition file(s) found in project '" + project.getName() + "'."); + } + if (targetFiles.length == 1) { + return targetFiles[0]; + } + for (File targetFile : targetFiles) { + String baseName = FilenameUtils.getBaseName(targetFile.getName()); + if (baseName.equalsIgnoreCase(project.getArtifactId())) { + return targetFile; + } + } + throw new TargetResolveException("One target file must be named '" + project.getArtifactId() + + TargetDefinitionFile.FILE_EXTENSION + "' when multiple targets are present"); + } else { + File target = new File(project.getBasedir(), + classifier + TargetDefinitionFile.FILE_EXTENSION); + if (TargetDefinitionFile.isTargetFile(target)) { + return target; + } else { + throw new TargetResolveException("target definition file '" + target + + "' not found in project '" + project.getName() + "'."); + } + } + } + } + // resolve using maven + Artifact artifact = repositorySystem.createArtifactWithClassifier(groupId, artifactId, version, TARGET_TYPE, + classifier); + + ArtifactResolutionRequest request = new ArtifactResolutionRequest(); + request.setArtifact(artifact); + request.setLocalRepository(session.getLocalRepository()); + request.setRemoteRepositories(remoteRepositories); + repositorySystem.resolve(request); + + if (artifact.isResolved()) { + return artifact.getFile(); + } + throw new TargetResolveException("Could not resolve target platform specification artifact " + artifact); + } + +} diff --git a/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetResolveException.java b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetResolveException.java new file mode 100644 index 0000000000..27b960201e --- /dev/null +++ b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetResolveException.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2022 Christoph Läubrich 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: + * Christoph Läubrich - initial API and implementation based on DefaultTargetPlatformConfigurationReader + *******************************************************************************/ +package org.eclipse.tycho.targetplatform; + +public class TargetResolveException extends Exception { + + public TargetResolveException(String message) { + super(message); + } + +}