diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractArtifactDependencyWalker.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractArtifactDependencyWalker.java index c6c67144f8..befe4e65d2 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractArtifactDependencyWalker.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractArtifactDependencyWalker.java @@ -19,6 +19,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.Stack; @@ -99,10 +100,10 @@ protected void traverseFeature(File location, Feature feature, FeatureRef featur } protected ArtifactDescriptor getArtifact(File location, String id) { - Map artifacts = this.artifacts.getArtifact(location); - if (artifacts != null) { - for (ArtifactDescriptor artifact : artifacts.values()) { - if (id.equals(artifact.getKey().getId())) { + for (ArtifactDescriptor artifact : this.artifacts.getArtifacts()) { + if (id.equals(artifact.getKey().getId())) { + File other = getLocation(artifact); + if (Objects.equals(location, other)) { return artifact; } } @@ -179,8 +180,7 @@ protected void traverseFeature(FeatureRef ref, ArtifactDependencyVisitor visitor visited.enter(artifact); try { - File location = artifact.getLocation(true); - + File location = getLocation(artifact); Feature feature = Feature.loadFeature(location); traverseFeature(location, feature, ref, visitor, visited); } finally { @@ -191,6 +191,15 @@ protected void traverseFeature(FeatureRef ref, ArtifactDependencyVisitor visitor } } + private File getLocation(ArtifactDescriptor artifact) { + ReactorProject mavenProject = artifact.getMavenProject(); + if (mavenProject != null) { + return mavenProject.getBasedir(); + } else { + return artifact.getLocation(true); + } + } + private void traversePlugin(PluginRef ref, ArtifactDependencyVisitor visitor, WalkbackPath visited) { if (!matchTargetEnvironment(ref)) { return; @@ -205,7 +214,7 @@ private void traversePlugin(PluginRef ref, ArtifactDependencyVisitor visitor, Wa return; } - File location = artifact.getLocation(true); + File location = getLocation(artifact); ReactorProject project = artifact.getMavenProject(); String classifier = artifact.getClassifier(); Collection installableUnits = artifact.getInstallableUnits(); diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java index 455109df5a..3c0fc4c62f 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java @@ -64,11 +64,9 @@ public ArtifactKey getKey() { @Override public File getLocation(boolean fetch) { - if (project != null) { - File basedir = project.getBasedir(); - if (basedir != null) { - return basedir; - } + File projectLocation = getProjectLocation(); + if (projectLocation != null) { + return projectLocation; } if (fetch && locationSupplier != null && (location == null || !location.exists())) { File file = locationSupplier.apply(this); @@ -79,16 +77,28 @@ public File getLocation(boolean fetch) { return location; } - @Override - public CompletableFuture fetchArtifact() { + private File getProjectLocation() { if (project != null) { + File packedArtifact = project.getArtifact(); + if (packedArtifact != null && packedArtifact.isFile()) { + return packedArtifact; + } //TODO this really looks wrong! It should the file of the artifact (if present!) or the output directory, // but the basedir most likely only works for tycho ... File basedir = project.getBasedir(); if (basedir != null) { - return CompletableFuture.completedFuture(basedir); + return basedir; } } + return null; + } + + @Override + public CompletableFuture fetchArtifact() { + File projectLocation = getProjectLocation(); + if (projectLocation != null) { + return CompletableFuture.completedFuture(projectLocation); + } if (location != null && location.exists()) { return CompletableFuture.completedFuture(location); } @@ -109,19 +119,14 @@ public CompletableFuture fetchArtifact() { @Override public Optional getLocation() { - if (project != null) { - //TODO this really looks wrong! It should the file of the artifact (if present!) or the output directory, - // but the basedir most likely only works for tycho ... - File basedir = project.getBasedir(); - if (basedir != null) { - return Optional.of(basedir); - } + File projectLocation = getProjectLocation(); + if (projectLocation != null) { + return Optional.of(projectLocation); } if (location != null) { //TODO actually location.exists() should be used here! But some code has problems with that! return Optional.of(location); } - // TODO Auto-generated method stub return Optional.empty(); } diff --git a/tycho-its/projects/multiPlatform.reactor/deployablefeature/pom.xml b/tycho-its/projects/multiPlatform.reactor/deployablefeature/pom.xml index 75ec7baded..0866a076a1 100644 --- a/tycho-its/projects/multiPlatform.reactor/deployablefeature/pom.xml +++ b/tycho-its/projects/multiPlatform.reactor/deployablefeature/pom.xml @@ -14,6 +14,7 @@ org.eclipse.tycho tycho-packaging-plugin + ${tycho-version} true diff --git a/tycho-its/projects/multiPlatform.reactor/pom.xml b/tycho-its/projects/multiPlatform.reactor/pom.xml index 1dc78b9b7a..706d26d909 100644 --- a/tycho-its/projects/multiPlatform.reactor/pom.xml +++ b/tycho-its/projects/multiPlatform.reactor/pom.xml @@ -5,6 +5,9 @@ mpr.parent 0.0.1-SNAPSHOT pom + + UTF-8 + bundle feature @@ -35,7 +38,6 @@ target-platform-configuration ${tycho-version} - p2 win32