Allow director plugin to only assemble products for the current arch

- Drop some unneeded BR/Rs on surefire (maven-local pulls these in)
This commit is contained in:
Mat Booth 2014-07-11 12:49:24 +01:00
parent b41d1a7646
commit 3acafa4922
3 changed files with 86 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
/org.eclipse.tycho-*
/tycho-*.xz
/tycho-*.bz2
/tycho-*/
maven-repo.tar.xz
*.src.rpm
/noarch

View File

@ -0,0 +1,77 @@
From db3ae15ecb4c25d1da6c87946b9dca0a94f8ad9d Mon Sep 17 00:00:00 2001
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.
---
.../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

View File

@ -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@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@redhat.com> - 0.20.0-17
- Return non-existant expected local path when resolution fails.
- Resolves: rhbz#1114120