Skip to content

Commit 6def66d

Browse files
committed
p2-maven-site includes bundles in the repository
Fix #932
1 parent 8c1d88a commit 6def66d

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/publisher/TychoFeaturesAndBundlesPublisherApplication.java

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2021 Christoph Läubrich and others.
2+
* Copyright (c) 2021, 2022 Christoph Läubrich and others.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -36,6 +36,7 @@
3636
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
3737
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryFactory;
3838
import org.eclipse.equinox.internal.p2.updatesite.CategoryXMLAction;
39+
import org.eclipse.equinox.p2.core.ProvisionException;
3940
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
4041
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
4142
import org.eclipse.equinox.p2.publisher.AbstractPublisherAction;
@@ -63,6 +64,8 @@ public class TychoFeaturesAndBundlesPublisherApplication extends AbstractPublish
6364
private URI categoryDefinition;
6465
private String[] rules;
6566
private String publicKeys;
67+
private boolean indexArtifacts = true;
68+
private boolean publishArtifacts = true;
6669

6770
@Override
6871
public Object run(PublisherInfo publisherInfo) throws Exception {
@@ -87,6 +90,19 @@ public Object run(PublisherInfo publisherInfo) throws Exception {
8790
return run;
8891
}
8992

93+
@Override
94+
protected void initialize(PublisherInfo publisherInfo) throws ProvisionException {
95+
int artifactOptions = 0;
96+
if (indexArtifacts) {
97+
artifactOptions |= IPublisherInfo.A_INDEX;
98+
}
99+
if (publishArtifacts) {
100+
artifactOptions |= IPublisherInfo.A_PUBLISH;
101+
}
102+
publisherInfo.setArtifactOptions(artifactOptions);
103+
super.initialize(publisherInfo);
104+
}
105+
90106
@Override
91107
protected void processParameter(String arg, String parameter, PublisherInfo publisherInfo)
92108
throws URISyntaxException {
@@ -134,6 +150,12 @@ protected void processParameter(String arg, String parameter, PublisherInfo publ
134150
throw new URISyntaxException(parameter, "can't read public key file: " + e);
135151
}
136152
}
153+
if (arg.equalsIgnoreCase("-aindex")) {
154+
indexArtifacts = Boolean.parseBoolean(parameter);
155+
}
156+
if (arg.equalsIgnoreCase("-apublish")) {
157+
publishArtifacts = Boolean.parseBoolean(parameter);
158+
}
137159
}
138160

139161
private String[] getArrayFromFile(String parameter) {

tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/MavenP2SiteTest.java

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public void testDeployIgnore() throws Exception {
5656
assertFalse("artifact is deployed but should't", artifacts.contains("id='org.eclipse.tycho.it.ignoreme'"));
5757
assertFalse("artifact is deployed but should't",
5858
artifacts.contains("id='org.eclipse.tycho.it.ignoreme-property'"));
59+
assertFalse("There should be no plugins folder!",
60+
new File(verifier.getBasedir(), "site/target/repository/plugins/").exists());
61+
assertFalse("There should be no features folder!",
62+
new File(verifier.getBasedir(), "site/target/repository/features/").exists());
5963
}
6064

6165
@Test

tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2021 Christoph Läubrich and others.
2+
* Copyright (c) 2021, 2022 Christoph Läubrich and others.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
@@ -339,6 +339,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
339339
launcher.setApplicationName("org.eclipse.tycho.p2.tools.publisher.TychoFeaturesAndBundlesPublisher");
340340
launcher.addArguments("-artifactRepository", destination.toURI().toString(), //
341341
"-metadataRepository", destination.toURI().toString(), //
342+
"-apublish", "false", //
342343
"-bundles", //
343344
bundlesFile.getAbsolutePath(), //
344345
"-advices", //

0 commit comments

Comments
 (0)