[tycho/f21] Allow director plugin to only assemble products for the current arch
Mat Booth
mbooth at fedoraproject.org
Fri Jul 11 12:05:39 UTC 2014
commit 3acafa49222bffa306f8975438cdfc95c3ac9cf4
Author: Mat Booth <mat.booth at redhat.com>
Date: Fri Jul 11 12:49:24 2014 +0100
Allow director plugin to only assemble products for the current arch
- Drop some unneeded BR/Rs on surefire (maven-local pulls these in)
.gitignore | 1 +
tycho-running-env-only.patch | 77 ++++++++++++++++++++++++++++++++++++++++++
tycho.spec | 12 ++++--
3 files changed, 86 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 71a8af5..f87e835 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/org.eclipse.tycho-*
/tycho-*.xz
/tycho-*.bz2
+/tycho-*/
maven-repo.tar.xz
*.src.rpm
/noarch
diff --git a/tycho-running-env-only.patch b/tycho-running-env-only.patch
new file mode 100644
index 0000000..a8f2e7e
--- /dev/null
+++ b/tycho-running-env-only.patch
@@ -0,0 +1,77 @@
+From db3ae15ecb4c25d1da6c87946b9dca0a94f8ad9d Mon Sep 17 00:00:00 2001
+From: Mat Booth <mat.booth at 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.
+---
+ .../tycho/plugins/p2/director/AbstractProductMojo.java | 17 +++++++++++++++++
+ .../eclipse/tycho/plugins/p2/director/DirectorMojo.java | 3 +++
+ .../tycho/plugins/p2/director/ProductArchiverMojo.java | 3 +++
+ 3 files changed, 23 insertions(+)
+
+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
+index 78bc542..aacd244 100644
+--- 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
+@@ -110,6 +110,16 @@ abstract class AbstractProductMojo extends AbstractMojo {
+ */
+ private List<Product> products;
+
++ /**
++ * <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>
++ *
++ * @parameter expression="${director.running.env.only}"
++ */
++ private boolean runningEnvOnly;
++
+ MavenProject getProject() {
+ return project;
+ }
+@@ -142,4 +152,11 @@ abstract class AbstractProductMojo extends AbstractMojo {
+ 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
+index c3dd2fb..5ed00f3 100644
+--- 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
+@@ -116,6 +116,9 @@ public final class DirectorMojo extends AbstractProductMojo {
+ 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
+index d482cf5..611fa85 100644
+--- 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
+@@ -123,6 +123,9 @@ public final class ProductArchiverMojo extends AbstractProductMojo {
+
+ 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();
+--
+1.9.0
+
diff --git a/tycho.spec b/tycho.spec
index 64f992f..4ce3404 100644
--- a/tycho.spec
+++ b/tycho.spec
@@ -19,7 +19,7 @@
Name: tycho
Version: 0.20.0
-Release: 17%{?dist}
+Release: 18%{?dist}
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
Group: Development/Libraries
@@ -48,6 +48,8 @@ Patch4: %{name}-use-custom-resolver.patch
Patch5: %{name}-maven-delegation.patch
# Additional changes needed just for bootstrap build
Patch6: %{name}-fix-bootstrap-build.patch
+# Patch director plugin to only assemble products for the current arch
+Patch7: %{name}-running-env-only.patch
BuildArch: noarch
@@ -62,8 +64,6 @@ BuildRequires: maven-javadoc-plugin
BuildRequires: maven-release-plugin
BuildRequires: maven-resources-plugin
BuildRequires: maven-verifier
-BuildRequires: maven-surefire-plugin
-BuildRequires: maven-surefire-provider-junit
BuildRequires: objectweb-asm
BuildRequires: plexus-containers-component-metadata
BuildRequires: apache-commons-exec
@@ -97,7 +97,6 @@ Requires: maven-local
Requires: maven-clean-plugin
Requires: maven-dependency-plugin
Requires: maven-verifier
-Requires: maven-surefire-provider-junit
Requires: objectweb-asm
Requires: ecj
%if ! %{eclipse_bootstrap}
@@ -166,6 +165,7 @@ This package contains the API documentation for %{name}.
%patch3 -p1
%patch4 -p1
%patch5 -p1
+%patch7 -p1
find tycho-core -iname '*html' -delete
@@ -343,6 +343,10 @@ install -m 644 $osgiStateJarPath $RPM_BUILD_ROOT%{_javadir}/%{name}/osgi.compati
%{_javadocdir}/%{name}
%changelog
+* Fri Jul 11 2014 Mat Booth <mat.booth at redhat.com> - 0.20.0-18
+- Allow director plugin to only assemble products for the current arch
+- Drop some unneeded BR/Rs on surefire (maven-local pulls these in)
+
* Wed Jul 02 2014 Roland Grunberg <rgrunber at redhat.com> - 0.20.0-17
- Return non-existant expected local path when resolution fails.
- Resolves: rhbz#1114120
More information about the scm-commits
mailing list