1
1
/*******************************************************************************
2
- * Copyright (c) 2021 Christoph Läubrich and others.
2
+ * Copyright (c) 2021, 2022 Christoph Läubrich and others.
3
3
* This program and the accompanying materials
4
4
* are made available under the terms of the Eclipse Public License 2.0
5
5
* which accompanies this distribution, and is available at
36
36
import org .eclipse .equinox .internal .p2 .artifact .repository .simple .SimpleArtifactRepository ;
37
37
import org .eclipse .equinox .internal .p2 .artifact .repository .simple .SimpleArtifactRepositoryFactory ;
38
38
import org .eclipse .equinox .internal .p2 .updatesite .CategoryXMLAction ;
39
+ import org .eclipse .equinox .p2 .core .ProvisionException ;
39
40
import org .eclipse .equinox .p2 .metadata .IInstallableUnit ;
40
41
import org .eclipse .equinox .p2 .metadata .MetadataFactory .InstallableUnitDescription ;
41
42
import org .eclipse .equinox .p2 .publisher .AbstractPublisherAction ;
@@ -63,6 +64,8 @@ public class TychoFeaturesAndBundlesPublisherApplication extends AbstractPublish
63
64
private URI categoryDefinition ;
64
65
private String [] rules ;
65
66
private String publicKeys ;
67
+ private boolean indexArtifacts = true ;
68
+ private boolean publishArtifacts = true ;
66
69
67
70
@ Override
68
71
public Object run (PublisherInfo publisherInfo ) throws Exception {
@@ -87,6 +90,19 @@ public Object run(PublisherInfo publisherInfo) throws Exception {
87
90
return run ;
88
91
}
89
92
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
+
90
106
@ Override
91
107
protected void processParameter (String arg , String parameter , PublisherInfo publisherInfo )
92
108
throws URISyntaxException {
@@ -134,6 +150,12 @@ protected void processParameter(String arg, String parameter, PublisherInfo publ
134
150
throw new URISyntaxException (parameter , "can't read public key file: " + e );
135
151
}
136
152
}
153
+ if (arg .equalsIgnoreCase ("-aindex" )) {
154
+ indexArtifacts = Boolean .parseBoolean (parameter );
155
+ }
156
+ if (arg .equalsIgnoreCase ("-apublish" )) {
157
+ publishArtifacts = Boolean .parseBoolean (parameter );
158
+ }
137
159
}
138
160
139
161
private String [] getArrayFromFile (String parameter ) {
0 commit comments