Skip to content

Commit

Permalink
p2-maven-site includes bundles in the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed May 5, 2022
1 parent 6466560 commit 7210f30
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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", //
Expand Down

0 comments on commit 7210f30

Please sign in to comment.