Skip to content

Commit

Permalink
Introduce jenkinsVersion property
Browse files Browse the repository at this point in the history
#148

Closes #152
  • Loading branch information
sghill committed May 27, 2020
1 parent ad2f304 commit ed077cb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ package org.jenkinsci.gradle.plugins.jpi
import hudson.util.VersionNumber
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.model.ReplacedBy
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Delete
import org.gradle.api.tasks.SourceSet
import org.gradle.util.ConfigureUtil
Expand All @@ -33,9 +35,11 @@ class JpiExtension {
final Project project
@Deprecated
Map<String, String> jenkinsWarCoordinates
final Property<String> jenkinsVersion

JpiExtension(Project project) {
this.project = project
this.jenkinsVersion = project.objects.property(String)
}

private String shortName
Expand Down Expand Up @@ -109,13 +113,20 @@ class JpiExtension {
/**
* Version of core that we depend on.
*/
@Deprecated
@ReplacedBy('jenkinsVersion')
private String coreVersion

@Deprecated
@ReplacedBy('jenkinsVersion')
String getCoreVersion() {
coreVersion
}

@Deprecated
@ReplacedBy('jenkinsVersion')
void setCoreVersion(String v) {
jenkinsVersion.convention(v)
this.coreVersion = v
def uiSamplesVersion = v
def testHarnessVersion = v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class JpiManifest extends Manifest {
def version = new VersionCalculator().calculate(project.version.toString())
mainAttributes.putValue('Plugin-Version', version.toString())

mainAttributes.putValue('Jenkins-Version', conv.coreVersion)
mainAttributes.putValue('Jenkins-Version', conv.jenkinsVersion.get())
mainAttributes.putValue('Minimum-Java-Version', javaPluginConvention.targetCompatibility.toString())

mainAttributes.putValue('Mask-Classes', conv.maskClasses)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ class JpiPlugin implements Plugin<Project> {

def serverRuntime = gradleProject.configurations.create('jenkinsServerRuntimeOnly') { Configuration c ->
c.withDependencies { DependencySet deps ->
deps.add(gradleProject.dependencies.create("org.jenkins-ci.main:jenkins-war:${ext.coreVersion}@war"))
def warNotation = "org.jenkins-ci.main:jenkins-war:${ext.jenkinsVersion.get()}@war"
deps.add(gradleProject.dependencies.create(warNotation))
}
}

Expand Down

0 comments on commit ed077cb

Please sign in to comment.