diff --git a/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/publisher/TychoFeaturesAndBundlesPublisherApplication.java b/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/publisher/TychoFeaturesAndBundlesPublisherApplication.java index 3199616dae..4558aed5a5 100644 --- a/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/publisher/TychoFeaturesAndBundlesPublisherApplication.java +++ b/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/publisher/TychoFeaturesAndBundlesPublisherApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Christoph Läubrich and others. + * Copyright (c) 2021, 2022 Christoph Läubrich and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -36,6 +36,7 @@ import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository; import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryFactory; import org.eclipse.equinox.internal.p2.updatesite.CategoryXMLAction; +import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; import org.eclipse.equinox.p2.publisher.AbstractPublisherAction; @@ -63,6 +64,8 @@ public class TychoFeaturesAndBundlesPublisherApplication extends AbstractPublish private URI categoryDefinition; private String[] rules; private String publicKeys; + private boolean indexArtifacts = true; + private boolean publishArtifacts = true; @Override public Object run(PublisherInfo publisherInfo) throws Exception { @@ -87,6 +90,19 @@ public Object run(PublisherInfo publisherInfo) throws Exception { return run; } + @Override + protected void initialize(PublisherInfo publisherInfo) throws ProvisionException { + int artifactOptions = 0; + if (indexArtifacts) { + artifactOptions |= IPublisherInfo.A_INDEX; + } + if (publishArtifacts) { + artifactOptions |= IPublisherInfo.A_PUBLISH; + } + publisherInfo.setArtifactOptions(artifactOptions); + super.initialize(publisherInfo); + } + @Override protected void processParameter(String arg, String parameter, PublisherInfo publisherInfo) throws URISyntaxException { @@ -134,6 +150,12 @@ protected void processParameter(String arg, String parameter, PublisherInfo publ throw new URISyntaxException(parameter, "can't read public key file: " + e); } } + if (arg.equalsIgnoreCase("-aindex")) { + indexArtifacts = Boolean.parseBoolean(parameter); + } + if (arg.equalsIgnoreCase("-apublish")) { + publishArtifacts = Boolean.parseBoolean(parameter); + } } private String[] getArrayFromFile(String parameter) { diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/MavenP2SiteTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/MavenP2SiteTest.java index cc022e4e48..99a8c3e6f0 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/MavenP2SiteTest.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/MavenP2SiteTest.java @@ -56,6 +56,10 @@ public void testDeployIgnore() throws Exception { assertFalse("artifact is deployed but should't", artifacts.contains("id='org.eclipse.tycho.it.ignoreme'")); assertFalse("artifact is deployed but should't", artifacts.contains("id='org.eclipse.tycho.it.ignoreme-property'")); + assertFalse("There should be no plugins folder!", + new File(verifier.getBasedir(), "site/target/repository/plugins/").exists()); + assertFalse("There should be no features folder!", + new File(verifier.getBasedir(), "site/target/repository/features/").exists()); } @Test diff --git a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java index 9a5ef9226d..239b55dbb5 100644 --- a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java +++ b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Christoph Läubrich and others. + * Copyright (c) 2021, 2022 Christoph Läubrich and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -339,6 +339,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { launcher.setApplicationName("org.eclipse.tycho.p2.tools.publisher.TychoFeaturesAndBundlesPublisher"); launcher.addArguments("-artifactRepository", destination.toURI().toString(), // "-metadataRepository", destination.toURI().toString(), // + "-apublish", "false", // "-bundles", // bundlesFile.getAbsolutePath(), // "-advices", //