Skip to content

Commit 9f74226

Browse files
committed
added plugin feature attribute
1 parent 4d9152d commit 9f74226

File tree

4 files changed

+29
-22
lines changed

4 files changed

+29
-22
lines changed

src/main/groovy/org/standardout/gradle/plugin/platform/internal/DefaultFeature.groovy

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@ import org.standardout.gradle.plugin.platform.internal.util.VersionUtil;
2121

2222

2323
class DefaultFeature implements Feature {
24-
24+
2525
String id
2626
String label
2727
String version
2828
String providerName
2929
String license
3030
String description
3131
String copyright
32+
String plugin
3233
List<BundleArtifact> bundles = []
3334
List<Feature> includedFeatures = []
3435
Project project
35-
36+
3637
private String finalVersion
3738

3839
@Override
@@ -42,15 +43,15 @@ class DefaultFeature implements Feature {
4243
}
4344
finalVersion
4445
}
45-
46+
4647
void setVersion(String version) {
4748
this.version = VersionUtil.toOsgiVersion(version).toString()
4849
}
4950

5051
String getProviderName() {
5152
providerName?:'Generated with bnd-platform'
5253
}
53-
54+
5455
@Override
5556
public Iterable<BundleArtifact> getBundles() {
5657
bundles == null ? [] : bundles

src/main/groovy/org/standardout/gradle/plugin/platform/internal/Feature.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
/**
2020
* Represents an Eclipse Update Site Feature.
21-
*
21+
*
2222
* The version, bundles and includedFeatures properties may only be accessed
2323
* after the feature configuration is complete.
2424
*/
2525
public interface Feature {
26-
26+
2727
public String getId();
28-
28+
2929
public String getLabel();
30-
30+
3131
public String getVersion();
32-
32+
3333
public String getProviderName();
3434

3535
public String getLicense();
@@ -38,8 +38,10 @@ public interface Feature {
3838

3939
public String getCopyright();
4040

41+
public String getPlugin();
42+
4143
public Iterable<BundleArtifact> getBundles();
42-
44+
4345
public Iterable<Feature> getIncludedFeatures();
4446

4547
public Iterable<RequiredFeature> getRequiredFeatures();

src/main/groovy/org/standardout/gradle/plugin/platform/internal/config/ArtifactFeature.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ArtifactFeature implements Feature {
4545
final String license
4646
final String description
4747
final String copyright
48+
final String plugin
4849

4950
/**
5051
* List of artifact references
@@ -74,6 +75,7 @@ class ArtifactFeature implements Feature {
7475
def license
7576
def description
7677
def copyright
78+
def plugin
7779

7880
// extract basic feature information from feature notation
7981
if (featureNotation instanceof Map) {
@@ -84,6 +86,7 @@ class ArtifactFeature implements Feature {
8486
license = featureNotation.license
8587
description = featureNotation.description
8688
copyright = featureNotation.copyright
89+
plugin = featureNotation.plugin
8790
}
8891
else {
8992
// assume String id and default values
@@ -106,6 +109,7 @@ class ArtifactFeature implements Feature {
106109
this.license = license ?: ""
107110
this.description = description ?: ""
108111
this.copyright = copyright ?: ""
112+
this.plugin = plugin ?: ""
109113

110114
// create masking delegate to be able to intercept internal call results
111115
Closure maskedConfig = null

src/main/groovy/org/standardout/gradle/plugin/platform/internal/util/FeatureUtil.groovy

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,31 @@ import org.standardout.gradle.plugin.platform.internal.BundleArtifact
2323
import org.standardout.gradle.plugin.platform.internal.Feature
2424

2525
class FeatureUtil {
26-
26+
2727
static void createFeatureXml(Feature feature, File target) {
2828
target.parentFile.mkdirs()
29-
29+
3030
target.withWriter('UTF-8'){ Writer w ->
3131
createFeatureXml(feature, w)
3232
}
3333
}
34-
34+
3535
static void createFeatureXml(Feature feature, OutputStream target) {
3636
Writer w = new OutputStreamWriter(target, 'UTF-8') //target.newWriter('UTF-8')
3737
createFeatureXml(feature, w)
3838
}
39-
39+
4040
static void createFeatureXml(Feature feature, Writer target) {
4141
def xml = new groovy.xml.MarkupBuilder(target)
4242
xml.setDoubleQuotes(true)
4343
xml.mkp.xmlDeclaration(version:'1.0', encoding: 'UTF-8')
44-
44+
4545
xml.feature(
4646
id: feature.id,
4747
label: feature.label,
4848
version: feature.version,
49-
'provider-name': feature.providerName
50-
// plugin: branding_plugin_id
49+
'provider-name': feature.providerName,
50+
plugin: feature.plugin
5151
) {
5252
if (feature.license) {
5353
license(feature.license)
@@ -78,7 +78,7 @@ class FeatureUtil {
7878
def version = included.version?:'0.0.0'
7979
includes(id: included.id, version: version)
8080
}
81-
81+
8282
// included bundles
8383
for (BundleArtifact artifact : feature.bundles.sort(true, { it.symbolicName })) {
8484
// define each plug-in
@@ -88,14 +88,14 @@ class FeatureUtil {
8888
'install-size': 0,
8989
version: artifact.modifiedVersion,
9090
unpack: false]
91-
91+
9292
// omit empty/null for os/arch/ws (may not be present)
9393
if(artifact.os) {
9494
paramMap.put('os', artifact.os)
9595
}
9696
if(artifact.arch) {
9797
paramMap.put('arch', artifact.arch)
98-
}
98+
}
9999
if(artifact.ws) {
100100
paramMap.put('ws', artifact.ws)
101101
}
@@ -104,11 +104,11 @@ class FeatureUtil {
104104
}
105105
}
106106
}
107-
107+
108108
static void createJar(Feature feature, def jarFile) {
109109
File target = jarFile as File
110110
target.parentFile.mkdirs()
111-
111+
112112
// create feature jar
113113
target.withOutputStream {
114114
ZipOutputStream zipStream = new ZipOutputStream(it)

0 commit comments

Comments
 (0)