Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added missing items to feature #152

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ signing {
}

tasks.withType(Sign) {
doFirst {
println "isRelease: $isRelease"
println "isCI: $isCI"
}
onlyIf {
isRelease || isCI
// isRelease || isCI
false
Comment on lines +143 to +149
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude these changes.

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class DefaultFeature implements Feature {
String version
String providerName
String license
String description
String copyright
List<BundleArtifact> bundles = []
List<Feature> includedFeatures = []
Project project
Expand Down Expand Up @@ -59,4 +61,10 @@ class DefaultFeature implements Feature {
includedFeatures == null ? [] : includedFeatures
}

@Override
public Iterable<RequiredFeature> getRequiredFeatures()
{
[]
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,27 @@ public interface Feature {
public String getProviderName();

public String getLicense();


public String getDescription();

public String getCopyright();

public Iterable<BundleArtifact> getBundles();

public Iterable<Feature> getIncludedFeatures();


public Iterable<RequiredFeature> getRequiredFeatures();

class RequiredFeature {
public final String featureName;
public final String version;
public final String match;


public RequiredFeature(String featureName, String version, String match) {
this.featureName = featureName;
this.version = version;
this.match = match;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class ArtifactFeature implements Feature {
final String version
final String providerName
final String license

final String description
final String copyright

/**
* List of artifact references
*/
Expand All @@ -53,7 +55,12 @@ class ArtifactFeature implements Feature {
* List of included features IDs
*/
final List<String> configFeatures = []


/**
* List of required features
*/
List<RequiredFeature> requiredFeatures = []

private String finalVersion

ArtifactFeature(Project project, def featureNotation,
Expand All @@ -65,14 +72,18 @@ class ArtifactFeature implements Feature {
def version
def providerName
def license

def description
def copyright

// extract basic feature information from feature notation
if (featureNotation instanceof Map) {
id = featureNotation.id
label = featureNotation.name
version = featureNotation.version
providerName = featureNotation.provider
license = featureNotation.license
description = featureNotation.description
copyright = featureNotation.copyright
}
else {
// assume String id and default values
Expand All @@ -93,7 +104,9 @@ class ArtifactFeature implements Feature {
this.id = id
this.label = label ?: id
this.license = license ?: ""

this.description = description ?: ""
this.copyright = copyright ?: ""

// create masking delegate to be able to intercept internal call results
Closure maskedConfig = null
CustomConfigDelegate maskingDelegate = null
Expand Down Expand Up @@ -186,7 +199,7 @@ class ArtifactFeature implements Feature {
project.platform.features[it]
}.findAll()
}

/**
* Delegate for the configuration closure to intercept calls
* for the feature configuration.
Expand All @@ -203,6 +216,18 @@ class ArtifactFeature implements Feature {
def invokeMethod(String name, def args) {
//TODO support manually adding a feature reference
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the TODO can be removed then?


if (name == "requires") {
def requiredNotation = args[0]
if (requiredNotation instanceof Map) {
def featureName = requiredNotation.featureName
def version = requiredNotation.version
def match = requiredNotation.match
def required = new RequiredFeature(featureName, version, match)
feature.requiredFeatures.add(required)
}
return
}

/*
* If there are further nested closures inside features
* that have OWNER_FIRST resolve strategy, the PlatformPluginExtension
Expand All @@ -229,7 +254,7 @@ class ArtifactFeature implements Feature {

result
}

@Override
def getProperty(String name) {
if (name == 'includes') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,27 @@ class FeatureUtil {
if (feature.license) {
license(feature.license)
}

if (feature.description) {
description(feature.description)
}

if (feature.copyright) {
copyright(feature.copyright)
}

if (!feature.requiredFeatures.isEmpty()) {
requires() {
//required features
for (Feature.RequiredFeature required : feature.requiredFeatures.sort(true, { it.featureName })) {
def version = required.version?:'0.0.0'
def match = required.match?:"greaterOrEqual"
xml.import(feature: required.featureName, version: version, match:match)
}
}
}


// included features
for (Feature included : feature.includedFeatures.sort(true, { it.id })) {
def version = included.version?:'0.0.0'
Expand Down