diff --git a/build.gradle b/build.gradle index 09f279b..81fad38 100644 --- a/build.gradle +++ b/build.gradle @@ -140,7 +140,12 @@ signing { } tasks.withType(Sign) { + doFirst { + println "isRelease: $isRelease" + println "isCI: $isCI" + } onlyIf { - isRelease || isCI +// isRelease || isCI + false } } diff --git a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/DefaultFeature.groovy b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/DefaultFeature.groovy index 1355eb2..101e360 100644 --- a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/DefaultFeature.groovy +++ b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/DefaultFeature.groovy @@ -27,6 +27,8 @@ class DefaultFeature implements Feature { String version String providerName String license + String description + String copyright List bundles = [] List includedFeatures = [] Project project @@ -59,4 +61,10 @@ class DefaultFeature implements Feature { includedFeatures == null ? [] : includedFeatures } + @Override + public Iterable getRequiredFeatures() + { + [] + } + } diff --git a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/Feature.java b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/Feature.java index 4797154..7aea806 100644 --- a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/Feature.java +++ b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/Feature.java @@ -33,9 +33,27 @@ public interface Feature { public String getProviderName(); public String getLicense(); - + + public String getDescription(); + + public String getCopyright(); + public Iterable getBundles(); public Iterable getIncludedFeatures(); - + + public Iterable 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; + } + } } diff --git a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/config/ArtifactFeature.groovy b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/config/ArtifactFeature.groovy index 12825c1..67e10fa 100644 --- a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/config/ArtifactFeature.groovy +++ b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/config/ArtifactFeature.groovy @@ -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 */ @@ -53,7 +55,12 @@ class ArtifactFeature implements Feature { * List of included features IDs */ final List configFeatures = [] - + + /** + * List of required features + */ + List requiredFeatures = [] + private String finalVersion ArtifactFeature(Project project, def featureNotation, @@ -65,7 +72,9 @@ 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 @@ -73,6 +82,8 @@ class ArtifactFeature implements Feature { version = featureNotation.version providerName = featureNotation.provider license = featureNotation.license + description = featureNotation.description + copyright = featureNotation.copyright } else { // assume String id and default values @@ -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 @@ -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. @@ -203,6 +216,18 @@ class ArtifactFeature implements Feature { def invokeMethod(String name, def args) { //TODO support manually adding a feature reference + 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 @@ -229,7 +254,7 @@ class ArtifactFeature implements Feature { result } - + @Override def getProperty(String name) { if (name == 'includes') { diff --git a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/util/FeatureUtil.groovy b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/util/FeatureUtil.groovy index 368cbdc..548731f 100644 --- a/src/main/groovy/org/standardout/gradle/plugin/platform/internal/util/FeatureUtil.groovy +++ b/src/main/groovy/org/standardout/gradle/plugin/platform/internal/util/FeatureUtil.groovy @@ -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'