summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAndreas Tschabuschnig2013-01-09 05:01:21 (EST)
committer Tobias Oberlies2013-02-19 10:04:12 (EST)
commit266d5cef48e4a3cea52ee0f68d5cbfdf280d6290 (patch)
treeb15f683be9c3afb9fe79877edec7e5f1675d88f4
parente3bdcd8c0514169d5e9a2a5b3410e09cd2d55f40 (diff)
downloadorg.eclipse.tycho-266d5cef48e4a3cea52ee0f68d5cbfdf280d6290.zip
org.eclipse.tycho-266d5cef48e4a3cea52ee0f68d5cbfdf280d6290.tar.gz
org.eclipse.tycho-266d5cef48e4a3cea52ee0f68d5cbfdf280d6290.tar.bz2
380120 Allow multiple targets in target-platform-configurationrefs/changes/17/9617/3
- The target platform configuration may now contain multiple <artifact> entries pointing to multiple target files. This can for example be used to add a target file with test artifacts in addition to the the target file with the productive dependencies. Bug: 380120 Change-Id: I264b8526912181c8f249b03455454e2f90ab932d
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/TargetPlatformConfiguration.java10
-rw-r--r--tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java13
-rw-r--r--tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2TargetPlatformResolver.java18
3 files changed, 23 insertions, 18 deletions
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 95ea3aa..25b976e 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
@@ -30,7 +30,7 @@ public class TargetPlatformConfiguration implements DependencyResolverConfigurat
private boolean implicitTargetEnvironment = true;
- private File target;
+ private final List<File> targets = new ArrayList<File>();
private String pomDependencies;
@@ -62,8 +62,8 @@ public class TargetPlatformConfiguration implements DependencyResolverConfigurat
return resolver;
}
- public File getTarget() {
- return target;
+ public List<File> getTargets() {
+ return Collections.unmodifiableList(targets);
}
public void addEnvironment(TargetEnvironment environment) {
@@ -74,8 +74,8 @@ public class TargetPlatformConfiguration implements DependencyResolverConfigurat
this.resolver = resolver;
}
- public void setTarget(File target) {
- this.target = target;
+ public void addTarget(File target) {
+ this.targets.add(target);
}
public void setPomDependencies(String pomDependencies) {
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 6b86cd0..63dba63 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
@@ -257,11 +257,18 @@ public class DefaultTargetPlatformConfigurationReader {
return;
}
- Xpp3Dom artifactDom = targetDom.getChild("artifact");
- if (artifactDom == null) {
+ Xpp3Dom[] artifactDomArray = targetDom.getChildren("artifact");
+ if (artifactDomArray == null || artifactDomArray.length == 0) {
return;
}
+ for (Xpp3Dom artifactDom : artifactDomArray) {
+ addTargetArtifact(result, session, project, artifactDom);
+ }
+ }
+
+ private void addTargetArtifact(TargetPlatformConfiguration result, MavenSession session, MavenProject project,
+ Xpp3Dom artifactDom) {
Xpp3Dom groupIdDom = artifactDom.getChild("groupId");
Xpp3Dom artifactIdDom = artifactDom.getChild("artifactId");
Xpp3Dom versionDom = artifactDom.getChild("version");
@@ -308,7 +315,7 @@ public class DefaultTargetPlatformConfigurationReader {
targetFile = artifact.getFile();
}
- result.setTarget(targetFile);
+ result.addTarget(targetFile);
}
private void setTargetPlatformResolver(TargetPlatformConfiguration result, Xpp3Dom configuration) {
diff --git a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2TargetPlatformResolver.java b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2TargetPlatformResolver.java
index 4de1f0a..d6cbc6d 100644
--- a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2TargetPlatformResolver.java
+++ b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2TargetPlatformResolver.java
@@ -201,8 +201,8 @@ public class P2TargetPlatformResolver extends AbstractTargetPlatformResolver imp
addEntireP2RepositoryToTargetPlatform(repository, tpBuilder, session);
}
- if (configuration.getTarget() != null) {
- addTargetFileContentToTargetPlatform(configuration, tpBuilder);
+ for (File file : configuration.getTargets()) {
+ addTargetFileContentToTargetPlatform(file, configuration.getEnvironments(), tpBuilder);
}
tpBuilder.addFilters(configuration.getFilters());
@@ -320,22 +320,20 @@ public class P2TargetPlatformResolver extends AbstractTargetPlatformResolver imp
}
}
- private void addTargetFileContentToTargetPlatform(TargetPlatformConfiguration configuration,
+ private void addTargetFileContentToTargetPlatform(File targetFile, List<TargetEnvironment> environments,
TargetPlatformBuilder resolutionContext) {
final TargetDefinitionFile target;
try {
- target = TargetDefinitionFile.read(configuration.getTarget());
- getLogger().debug("Adding target definition file \"" + configuration.getTarget() + "\"");
- resolutionContext.addTargetDefinition(target, configuration.getEnvironments());
+ target = TargetDefinitionFile.read(targetFile);
+ getLogger().debug("Adding target definition file \"" + targetFile + "\"");
+ resolutionContext.addTargetDefinition(target, environments);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (TargetDefinitionSyntaxException e) {
- throw new RuntimeException("Invalid syntax in target definition " + configuration.getTarget() + ": "
- + e.getMessage(), e);
+ throw new RuntimeException("Invalid syntax in target definition " + targetFile + ": " + e.getMessage(), e);
} catch (TargetDefinitionResolutionException e) {
- throw new RuntimeException("Failed to resolve target definition " + configuration.getTarget(), e);
+ throw new RuntimeException("Failed to resolve target definition " + targetFile, e);
}
-
}
public DependencyArtifacts resolveDependencies(final MavenSession session, final MavenProject project,