2014-08-28 13:49:17 +00:00
|
|
|
From 03176de4589022cdb80672017080066b192116c8 Mon Sep 17 00:00:00 2001
|
2014-07-11 11:49:24 +00:00
|
|
|
From: Mat Booth <mat.booth@redhat.com>
|
|
|
|
Date: Thu, 10 Jul 2014 15:26:50 +0100
|
|
|
|
Subject: [PATCH] Add "running env only" option to the p2-director-plugin.
|
|
|
|
|
|
|
|
This options allows you to restrict assembling and archiving products
|
|
|
|
to only the current running target environment.
|
|
|
|
---
|
2014-08-28 13:49:17 +00:00
|
|
|
.../tycho/plugins/p2/director/AbstractProductMojo.java | 16 ++++++++++++++++
|
|
|
|
.../eclipse/tycho/plugins/p2/director/DirectorMojo.java | 3 +++
|
|
|
|
.../tycho/plugins/p2/director/ProductArchiverMojo.java | 3 +++
|
|
|
|
3 files changed, 22 insertions(+)
|
2014-07-11 11:49:24 +00:00
|
|
|
|
|
|
|
diff --git a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/AbstractProductMojo.java b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/AbstractProductMojo.java
|
2014-08-28 13:49:17 +00:00
|
|
|
index c34cb72..a2e2f72 100644
|
2014-07-11 11:49:24 +00:00
|
|
|
--- a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/AbstractProductMojo.java
|
|
|
|
+++ b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/AbstractProductMojo.java
|
2014-08-28 13:49:17 +00:00
|
|
|
@@ -112,6 +112,15 @@ abstract class AbstractProductMojo extends AbstractMojo {
|
|
|
|
@Parameter(property = "p2.timeout", defaultValue = "0")
|
|
|
|
private int forkedProcessTimeoutInSeconds;
|
2014-07-11 11:49:24 +00:00
|
|
|
|
2014-08-28 13:49:17 +00:00
|
|
|
+ /**
|
2014-07-11 11:49:24 +00:00
|
|
|
+ * <p>
|
|
|
|
+ * Assemble and archive product installations for the running environment only. Setting this to
|
|
|
|
+ * true will omit all target environments that do not exactly match the running environment.
|
|
|
|
+ * </p>
|
|
|
|
+ */
|
2014-08-28 13:49:17 +00:00
|
|
|
+ @Parameter(defaultValue = "false", property = "director.running.env.only")
|
2014-07-11 11:49:24 +00:00
|
|
|
+ private boolean runningEnvOnly;
|
|
|
|
+
|
2014-08-28 13:49:17 +00:00
|
|
|
int getForkedProcessTimeoutInSeconds() {
|
|
|
|
return forkedProcessTimeoutInSeconds;
|
|
|
|
}
|
|
|
|
@@ -148,4 +157,11 @@ abstract class AbstractProductMojo extends AbstractMojo {
|
2014-07-11 11:49:24 +00:00
|
|
|
static String getOsWsArch(TargetEnvironment env, char separator) {
|
|
|
|
return env.getOs() + separator + env.getWs() + separator + env.getArch();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return true if the product should be built for the given target environment, false otherwise
|
|
|
|
+ */
|
|
|
|
+ boolean buildForEnv(TargetEnvironment env) {
|
|
|
|
+ return !runningEnvOnly || TargetEnvironment.getRunningEnvironment().equals(env);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java
|
2014-07-25 15:45:40 +00:00
|
|
|
index 8bd539f..f95ce7e 100644
|
2014-07-11 11:49:24 +00:00
|
|
|
--- a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java
|
|
|
|
+++ b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java
|
2014-07-25 15:45:40 +00:00
|
|
|
@@ -114,6 +114,9 @@ public final class DirectorMojo extends AbstractProductMojo {
|
2014-07-11 11:49:24 +00:00
|
|
|
RepositoryReferences sources = getSourceRepositories();
|
|
|
|
for (Product product : products) {
|
|
|
|
for (TargetEnvironment env : getEnvironments()) {
|
|
|
|
+ if (!buildForEnv(env)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
DirectorRuntime.Command command = director.newInstallCommand();
|
|
|
|
|
|
|
|
File destination = getProductMaterializeDirectory(product, env);
|
|
|
|
diff --git a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java
|
2014-07-25 15:45:40 +00:00
|
|
|
index 6a5c967..0e8df2a 100644
|
2014-07-11 11:49:24 +00:00
|
|
|
--- a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java
|
|
|
|
+++ b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java
|
2014-07-25 15:45:40 +00:00
|
|
|
@@ -129,6 +129,9 @@ public final class ProductArchiverMojo extends AbstractProductMojo {
|
2014-07-11 11:49:24 +00:00
|
|
|
|
|
|
|
for (Product product : config.getProducts()) {
|
|
|
|
for (TargetEnvironment env : getEnvironments()) {
|
|
|
|
+ if (!buildForEnv(env)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
String format = formats != null ? formats.get(env.getOs()) : DEFAULT_ARCHIVE_FORMAT;
|
|
|
|
if (format != null) {
|
|
|
|
format = format.trim();
|
|
|
|
--
|
2014-07-25 15:45:40 +00:00
|
|
|
1.9.3
|
2014-07-11 11:49:24 +00:00
|
|
|
|