Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ import org.standardout.gradle.plugin.platform.internal.util.VersionUtil;


class DefaultFeature implements Feature {

String id
String label
String version
String providerName
String license
String description
String copyright
String plugin
List<BundleArtifact> bundles = []
List<Feature> includedFeatures = []
Project project

private String finalVersion

@Override
Expand All @@ -42,15 +43,15 @@ class DefaultFeature implements Feature {
}
finalVersion
}

void setVersion(String version) {
this.version = VersionUtil.toOsgiVersion(version).toString()
}

String getProviderName() {
providerName?:'Generated with bnd-platform'
}

@Override
public Iterable<BundleArtifact> getBundles() {
bundles == null ? [] : bundles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

/**
* Represents an Eclipse Update Site Feature.
*
*
* The version, bundles and includedFeatures properties may only be accessed
* after the feature configuration is complete.
*/
public interface Feature {

public String getId();

public String getLabel();

public String getVersion();

public String getProviderName();

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

public String getCopyright();

public String getPlugin();

public Iterable<BundleArtifact> getBundles();

public Iterable<Feature> getIncludedFeatures();

public Iterable<RequiredFeature> getRequiredFeatures();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ArtifactFeature implements Feature {
final String license
final String description
final String copyright
final String plugin

/**
* List of artifact references
Expand Down Expand Up @@ -74,6 +75,7 @@ class ArtifactFeature implements Feature {
def license
def description
def copyright
def plugin

// extract basic feature information from feature notation
if (featureNotation instanceof Map) {
Expand All @@ -84,6 +86,7 @@ class ArtifactFeature implements Feature {
license = featureNotation.license
description = featureNotation.description
copyright = featureNotation.copyright
plugin = featureNotation.plugin
}
else {
// assume String id and default values
Expand All @@ -106,6 +109,7 @@ class ArtifactFeature implements Feature {
this.license = license ?: ""
this.description = description ?: ""
this.copyright = copyright ?: ""
this.plugin = plugin ?: ""

// create masking delegate to be able to intercept internal call results
Closure maskedConfig = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,31 @@ import org.standardout.gradle.plugin.platform.internal.BundleArtifact
import org.standardout.gradle.plugin.platform.internal.Feature

class FeatureUtil {

static void createFeatureXml(Feature feature, File target) {
target.parentFile.mkdirs()

target.withWriter('UTF-8'){ Writer w ->
createFeatureXml(feature, w)
}
}

static void createFeatureXml(Feature feature, OutputStream target) {
Writer w = new OutputStreamWriter(target, 'UTF-8') //target.newWriter('UTF-8')
createFeatureXml(feature, w)
}

static void createFeatureXml(Feature feature, Writer target) {
def xml = new groovy.xml.MarkupBuilder(target)
xml.setDoubleQuotes(true)
xml.mkp.xmlDeclaration(version:'1.0', encoding: 'UTF-8')

xml.feature(
id: feature.id,
label: feature.label,
version: feature.version,
'provider-name': feature.providerName
// plugin: branding_plugin_id
'provider-name': feature.providerName,
plugin: feature.plugin
) {
if (feature.license) {
license(feature.license)
Expand Down Expand Up @@ -78,7 +78,7 @@ class FeatureUtil {
def version = included.version?:'0.0.0'
includes(id: included.id, version: version)
}

// included bundles
for (BundleArtifact artifact : feature.bundles.sort(true, { it.symbolicName })) {
// define each plug-in
Expand All @@ -88,14 +88,14 @@ class FeatureUtil {
'install-size': 0,
version: artifact.modifiedVersion,
unpack: false]

// omit empty/null for os/arch/ws (may not be present)
if(artifact.os) {
paramMap.put('os', artifact.os)
}
if(artifact.arch) {
paramMap.put('arch', artifact.arch)
}
}
if(artifact.ws) {
paramMap.put('ws', artifact.ws)
}
Expand All @@ -104,11 +104,11 @@ class FeatureUtil {
}
}
}

static void createJar(Feature feature, def jarFile) {
File target = jarFile as File
target.parentFile.mkdirs()

// create feature jar
target.withOutputStream {
ZipOutputStream zipStream = new ZipOutputStream(it)
Expand Down