aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Sievers2013-05-13 10:57:27 (EDT)
committerJan Sievers2013-05-15 07:46:06 (EDT)
commit830cc79b806eead4fd70db304474bd4333a6a159 (patch)
tree2ac8ddd631c3369a31479c42a8a100e84e3a9498
parentb10fb9575e68d56b1af25d169271efbdda1ea011 (diff)
downloadorg.eclipse.tycho-830cc79b806eead4fd70db304474bd4333a6a159.zip
org.eclipse.tycho-830cc79b806eead4fd70db304474bd4333a6a159.tar.gz
org.eclipse.tycho-830cc79b806eead4fd70db304474bd4333a6a159.tar.bz2
407676 add filter parameter to AssembleRepositoryMojorefs/changes/09/12809/2
Allow to set additional p2 filter properties during repository aggregation. Example configuration snippet: <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-p2-repository-plugin</artifactId> <version>${tycho-version}</version> <configuration> <profileProperties> <macosx-bundled>true</macosx-bundled> </profileProperties> </configuration> </plugin> Bug: 407676 Change-Id: Ia75c024dc68db4fc9e21a0938e98b314c6f7fcc2
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java7
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.tools.shared/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java6
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java9
-rw-r--r--tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java10
4 files changed, 24 insertions, 8 deletions
diff --git a/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java b/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java
index 6b664a7..e3af939 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java
@@ -120,8 +120,8 @@ public class MirrorApplicationServiceImpl implements MirrorApplicationService {
}
public void mirrorReactor(RepositoryReferences sources, DestinationRepositoryDescriptor destination,
- Collection<?> seedUnits, BuildContext context, boolean includeAllDependencies, boolean includePacked)
- throws FacadeException {
+ Collection<?> seedUnits, BuildContext context, boolean includeAllDependencies, boolean includePacked,
+ Map<String, String> filterProperties) throws FacadeException {
IProvisioningAgent agent = Activator.createProvisioningAgent(context.getTargetDirectory());
try {
final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, agent, includePacked);
@@ -135,6 +135,9 @@ public class MirrorApplicationServiceImpl implements MirrorApplicationService {
options.considerStrictDependencyOnly(!includeAllDependencies);
Map<String, String> filter = options.getFilter();
addFilterForFeatureJARs(filter);
+ if (filterProperties != null) {
+ filter.putAll(filterProperties);
+ }
filter.putAll(environment.toFilterProperties());
mirrorApp.setSlicingOptions(options);
diff --git a/tycho-bundles/org.eclipse.tycho.p2.tools.shared/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java b/tycho-bundles/org.eclipse.tycho.p2.tools.shared/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java
index 8d04fb4..683c792 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.tools.shared/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.tools.shared/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java
@@ -11,6 +11,7 @@
package org.eclipse.tycho.p2.tools.mirroring.facade;
import java.util.Collection;
+import java.util.Map;
import org.eclipse.tycho.BuildOutputDirectory;
import org.eclipse.tycho.p2.tools.BuildContext;
@@ -43,12 +44,15 @@ public interface MirrorApplicationService {
* Whether to include all transitive dependencies
* @param includePacked
* Whether to include packed artifacts
+ * @param filterProperties
+ * additional filter properties to be set in the p2 slicing options. May be
+ * <code>null</code>
* @throws FacadeException
* if a checked exception occurs while mirroring
*/
public void mirrorReactor(RepositoryReferences sources, DestinationRepositoryDescriptor destination,
Collection<?/* IInstallableUnit */> seedUnits, BuildContext context, boolean includeAllDependencies,
- boolean includePacked) throws FacadeException;
+ boolean includePacked, Map<String, String> filterProperties) throws FacadeException;
/**
* Copies installable units from the source repositories to the destination repository. The
diff --git a/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java b/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java
index 90b9a78..542943e 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java
@@ -85,7 +85,7 @@ public class MirrorApplicationServiceTest {
@Test
public void testMirrorFeatureWithContent() throws Exception {
subject.mirrorReactor(sourceRepos("patch", "e342"), destinationRepo, seedFor(SIMPLE_FEATURE_IU), context,
- false, false);
+ false, false, null);
logVerifier.expectNoWarnings();
assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar").exists());
@@ -95,7 +95,7 @@ public class MirrorApplicationServiceTest {
@Test
public void testMirrorPatch() throws Exception {
subject.mirrorReactor(sourceRepos("patch", "e352"), destinationRepo, seedFor(FEATURE_PATCH_IU), context, false,
- false);
+ false, null);
logVerifier.expectNoWarnings();
assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.5.0.v20090525.jar").exists());
@@ -105,7 +105,7 @@ public class MirrorApplicationServiceTest {
@Test
public void testMirrorFeatureAndPatch() throws Exception {
subject.mirrorReactor(sourceRepos("patch", "e352"), destinationRepo,
- seedFor(SIMPLE_FEATURE_IU, FEATURE_PATCH_IU), context, false, false);
+ seedFor(SIMPLE_FEATURE_IU, FEATURE_PATCH_IU), context, false, false, null);
assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.5.0.v20090525.jar").exists());
assertTrue(repoFile(destinationRepo, "features/" + SIMPLE_FEATURE + "_1.0.0.jar").exists());
@@ -123,7 +123,8 @@ public class MirrorApplicationServiceTest {
* since it is not easy to distinguish between patched and unpatched dependencies, only a
* warning is issued.
*/
- subject.mirrorReactor(sourceRepos("patch"), destinationRepo, seedFor(SIMPLE_FEATURE_IU), context, false, false);
+ subject.mirrorReactor(sourceRepos("patch"), destinationRepo, seedFor(SIMPLE_FEATURE_IU), context, false, false,
+ null);
logVerifier.expectWarning(not(is("")));
}
diff --git a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java
index a5c3ced..d6c2656 100644
--- a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java
+++ b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java
@@ -12,6 +12,7 @@ package org.eclipse.tycho.plugins.p2.repository;
import java.io.File;
import java.util.Collection;
+import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -73,6 +74,13 @@ public class AssembleRepositoryMojo extends AbstractRepositoryMojo implements Lo
*/
private String repositoryName;
+ /**
+ * Additional properties against which p2 filters are evaluated while aggregating.
+ *
+ * @parameter
+ */
+ private Map<String, String> profileProperties;
+
/** @component */
private RepositoryReferenceTool repositoryReferenceTool;
@@ -99,7 +107,7 @@ public class AssembleRepositoryMojo extends AbstractRepositoryMojo implements Lo
DestinationRepositoryDescriptor destinationRepoDescriptor = new DestinationRepositoryDescriptor(
destination, repositoryName, compress, !createArtifactRepository, true);
mirrorApp.mirrorReactor(sources, destinationRepoDescriptor, rootIUs, getBuildContext(),
- includeAllDependencies, configuration.isIncludePackedArtifacts());
+ includeAllDependencies, configuration.isIncludePackedArtifacts(), profileProperties);
} catch (FacadeException e) {
throw new MojoExecutionException("Could not assemble p2 repository", e);
}