Skip to content

Commit

Permalink
disable signing, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
robserm committed Nov 25, 2024
1 parent 3a86ec6 commit 775e2e9
Showing 1 changed file with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ import org.standardout.gradle.plugin.platform.internal.util.VersionUtil;

/**
* Represents the configuration of a platform feature.
*
*
* @author Simon Templer
*/
class ArtifactFeature implements Feature {

final Project project

final String id
final String label
final String version
Expand All @@ -50,7 +50,7 @@ class ArtifactFeature implements Feature {
* List of artifact references
*/
final List<ArtifactsMatch> configArtifacts = []

/**
* List of included features IDs
*/
Expand All @@ -62,11 +62,11 @@ class ArtifactFeature implements Feature {
List<RequiredFeature> requiredFeatures = []

private String finalVersion

ArtifactFeature(Project project, def featureNotation,
Closure featureClosure) {
this.project = project

def id
def label
def version
Expand All @@ -88,7 +88,7 @@ class ArtifactFeature implements Feature {
else {
// assume String id and default values
String featureString = featureNotation as String

//XXX support some kind of pattern?
// for now just assume it's the id
id = featureString
Expand All @@ -97,8 +97,8 @@ class ArtifactFeature implements Feature {
if (!id) {
throw new IllegalStateException('A feature ID must be provided when defining a feature')
}
// default values and source adaptions

// default values and source adaptions
this.version = VersionUtil.toOsgiVersion(((version ?: project.platform.featureVersion) ?: project.version) ?: '1.0.0').toString()
this.providerName = providerName ?: project.platform.featureProvider
this.id = id
Expand All @@ -117,43 +117,43 @@ class ArtifactFeature implements Feature {
configClone.resolveStrategy = Closure.DELEGATE_FIRST
configClone()
}

maskedConfig.delegate = project.platform // delegate is the platform extension
maskedConfig()

// save feature configuration
project.platform.features[this.id] = this
}
@Override

@Override
public String getVersion() {
if (!finalVersion) {
finalVersion = VersionUtil.addQualifier(version, this, project)
}
finalVersion
}

Iterable<BundleArtifact> getBundles() {
/*
* Attention: a call to this method can only yield a sensible
* result after the artifacts map has been populated by the
* respective Gradle task.
*/

// collect all artifacts that match the respective condition
def artifacts = project.platform.artifacts.values().findAll { BundleArtifact artifact ->
configArtifacts.any { ArtifactsMatch match ->
match.acceptArtifact(artifact)
}
}

// collect transitive dependencies
transitiveArtifacts(artifacts)
}

private Iterable<BundleArtifact> transitiveArtifacts(Collection<BundleArtifact> artifacts) {
Map<String, BundleArtifact> allArtifacts = [:]

artifacts.each { BundleArtifact artifact ->
if (artifact instanceof DependencyArtifact) {
artifact.representedDependencies.each { ResolvedDependency dep ->
Expand All @@ -164,35 +164,35 @@ class ArtifactFeature implements Feature {
}
}
}

// in any case, add the bundle itself
allArtifacts[artifact.id] = artifact
}


// artifact bundles
allArtifacts.values().findAll { BundleArtifact ba ->
!ba.isSource()
}
}
}

/**
* Find bundle artifact representations for resolved artifacts.
*/
private Collection<BundleArtifact> findArtifacts(Iterable<ResolvedArtifact> arts) {
def result = []

arts.each { ResolvedArtifact ra ->
def id = "${ra.moduleVersion.id.group}:${ra.moduleVersion.id.name}:${ra.moduleVersion.id.version}"
def ba = project.platform.artifacts[id]
if (ba != null) {
result << ba
}
}

result
}

Iterable<Feature> getIncludedFeatures() {
// resolve feature IDs
configFeatures.collect {
Expand Down Expand Up @@ -232,15 +232,15 @@ class ArtifactFeature implements Feature {
* is asked first, and we cannot intercept the call.
* Thus as an alternative, 'plugin' can (should) be called instead
* of 'bundle' inside feature.
*
*
* XXX an alternative would be having some kind of feature stack in
* the extension, but this requires then the bundle method in the
* extension to add the bundle to the feature.
* extension to add the bundle to the feature.
*/
if (name == 'plugin') name = 'bundle'

def result = orgDelegate."$name"(*args)

// intercept result
if (result instanceof ArtifactsMatch) {
// bundle or merge
Expand All @@ -249,7 +249,7 @@ class ArtifactFeature implements Feature {
if (result instanceof Feature) {
feature.configFeatures << feature.id
}

result
}

Expand All @@ -263,11 +263,11 @@ class ArtifactFeature implements Feature {
orgDelegate."$name"
}
}

@Override
void setProperty(String name, def value) {
orgDelegate."$name" = value
}
}

}

0 comments on commit 775e2e9

Please sign in to comment.