Skip to content

Commit

Permalink
Remove / comment out sections of build.gradle to enable it to build o…
Browse files Browse the repository at this point in the history
…n github action runner
  • Loading branch information
johnflavin committed Jun 5, 2024
1 parent ae8da1a commit 15cd3cb
Showing 1 changed file with 106 additions and 115 deletions.
221 changes: 106 additions & 115 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ buildscript {
plugins {
id "idea"
id "java"
id "maven-publish"
id "com.palantir.git-version" version "0.12.1"
id "io.spring.dependency-management" version "1.0.9.RELEASE"
id "io.franzbecker.gradle-lombok" version "4.0.0"
id "net.linguica.maven-settings" version "0.5"
}

group "org.nrg.xnatx.plugins"
Expand All @@ -26,7 +23,6 @@ def vJavassist = "3.21.0-GA"
def vAwaitility = "2.0.0"

repositories {
mavenLocal()
maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-release" }
maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot" }
mavenCentral()
Expand Down Expand Up @@ -207,44 +203,44 @@ tasks.register ( 'integrationTest', Test ) {
test
}

// Pulls in the Jenkins BUILD_NUMBER environment variable if available.
def buildDate = new Date()
def buildNumber = System.getenv().BUILD_NUMBER?.toInteger() ?: "Manual"
def isDirty, branchName, gitHash, gitHashFull, commitDistance, lastTag, isCleanTag

try {
def gitDetails = versionDetails()
isDirty = gitVersion().endsWith ".dirty"
branchName = gitDetails.branchName ?: "Unknown"
gitHash = gitDetails.gitHash
gitHashFull = gitDetails.gitHashFull
commitDistance = gitDetails.commitDistance
lastTag = gitDetails.lastTag
isCleanTag = gitDetails.isCleanTag
} catch (IllegalArgumentException e) {
logger.info "Got an error trying to read VCS metadata from git. It's possible this project is not under VCS control. Using placeholder values for manifest entries."
isDirty = true
branchName = "Unknown"
gitHash = "None"
gitHashFull = "None"
commitDistance = 0
lastTag = "None"
isCleanTag = false
}

ext.gitManifest = manifest {
attributes "Application-Name": pluginAppName,
"Build-Date": buildDate,
"Build-Number": buildNumber,
"Implementation-Version": project.version,
"Implementation-Sha": gitHash,
"Implementation-Sha-Full": gitHashFull,
"Implementation-Commit": commitDistance,
"Implementation-LastTag": lastTag,
"Implementation-Branch": branchName,
"Implementation-CleanTag": isCleanTag,
"Implementation-Dirty": isDirty
}
//// Pulls in the Jenkins BUILD_NUMBER environment variable if available.
//def buildDate = new Date()
//def buildNumber = System.getenv().BUILD_NUMBER?.toInteger() ?: "Manual"
//def isDirty, branchName, gitHash, gitHashFull, commitDistance, lastTag, isCleanTag
//
//try {
// def gitDetails = versionDetails()
// isDirty = gitVersion().endsWith ".dirty"
// branchName = gitDetails.branchName ?: "Unknown"
// gitHash = gitDetails.gitHash
// gitHashFull = gitDetails.gitHashFull
// commitDistance = gitDetails.commitDistance
// lastTag = gitDetails.lastTag
// isCleanTag = gitDetails.isCleanTag
//} catch (IllegalArgumentException e) {
// logger.info "Got an error trying to read VCS metadata from git. It's possible this project is not under VCS control. Using placeholder values for manifest entries."
// isDirty = true
// branchName = "Unknown"
// gitHash = "None"
// gitHashFull = "None"
// commitDistance = 0
// lastTag = "None"
// isCleanTag = false
//}
//
//ext.gitManifest = manifest {
// attributes "Application-Name": pluginAppName,
// "Build-Date": buildDate,
// "Build-Number": buildNumber,
// "Implementation-Version": project.version,
// "Implementation-Sha": gitHash,
// "Implementation-Sha-Full": gitHashFull,
// "Implementation-Commit": commitDistance,
// "Implementation-LastTag": lastTag,
// "Implementation-Branch": branchName,
// "Implementation-CleanTag": isCleanTag,
// "Implementation-Dirty": isDirty
//}

task fatJar(type: Jar) {
zip64 true
Expand All @@ -257,9 +253,9 @@ task fatJar(type: Jar) {
exclude "META-INF/*.RSA"
}
duplicatesStrategy "exclude"
manifest {
from gitManifest
}
// manifest {
// from gitManifest
// }
with jar
}

Expand All @@ -269,9 +265,9 @@ sourceSets.main.java {
}

jar{
manifest {
from gitManifest
}
// manifest {
// from gitManifest
// }
doLast {
if (!gradle.taskGraph.hasTask(":fatJar")) {
logger.warn 'WARNING: You should generally run fatJar instead of jar task for this plugin'
Expand All @@ -281,78 +277,73 @@ jar{

task sourceJar(type: Jar, dependsOn: classes) {
classifier = "sources"
manifest {
from gitManifest
}
// manifest {
// from gitManifest
// }
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
manifest {
from gitManifest
}
// manifest {
// from gitManifest
// }
from javadoc.destinationDir
}

publishing {
publications {
mavenJava(MavenPublication) {
artifacts {
artifact sourceJar
artifact javadocJar
artifact fatJar
}

pom.withXml {
def root = asNode()
root.appendNode("name", pluginAppName)
root.appendNode("description", "XNAT plugin for launching and managing containers.")
root.appendNode("url", "https://github.com/nrgxnat/container-service")
root.appendNode("inceptionYear", "2016")

def scm = root.appendNode("scm")
scm.appendNode("url", "https://github.com/nrgxnat/container-service")
scm.appendNode("connection", "scm:https://github.com/nrgxnat/container-service.git")
scm.appendNode("developerConnection", "scm:[email protected]:nrgxnat/container-service")

def license = root.appendNode("licenses").appendNode("license")
license.appendNode("name", "Simplified BSD 2-Clause License")
license.appendNode("url", "https://xnat.org/about/license.php")
license.appendNode("distribution", "repo")

def developers = root.appendNode("developers")
def flavin = developers.appendNode("developer")
flavin.appendNode("id", "jflavin")
flavin.appendNode("name", "John Flavin")
flavin.appendNode("email", "[email protected]")

def kelsey = developers.appendNode("developer")
kelsey.appendNode("id", "kelseym")
kelsey.appendNode("name", "Matt Kelsey")
kelsey.appendNode("email", "[email protected]")

def will = developers.appendNode("developer")
will.appendNode("id", "hortonw")
will.appendNode("name", "Will Horton")
will.appendNode("email", "[email protected]")
}
}
}
repositories {
maven {
if (project.version.endsWith("-SNAPSHOT")) {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
} else {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
}
// The value for name must match <id> in ~/.m2/settings.xml
name = "XNAT_Artifactory"
}
}
}

def propertyWithDefault(def String property, def Object value) {
hasProperty(property) ? getProperty(property) : value
}

//publishing {
// publications {
// mavenJava(MavenPublication) {
// artifacts {
// artifact sourceJar
// artifact javadocJar
// artifact fatJar
// }
//
// pom.withXml {
// def root = asNode()
// root.appendNode("name", pluginAppName)
// root.appendNode("description", "XNAT plugin for launching and managing containers.")
// root.appendNode("url", "https://github.com/nrgxnat/container-service")
// root.appendNode("inceptionYear", "2016")
//
// def scm = root.appendNode("scm")
// scm.appendNode("url", "https://github.com/nrgxnat/container-service")
// scm.appendNode("connection", "scm:https://github.com/nrgxnat/container-service.git")
// scm.appendNode("developerConnection", "scm:[email protected]:nrgxnat/container-service")
//
// def license = root.appendNode("licenses").appendNode("license")
// license.appendNode("name", "Simplified BSD 2-Clause License")
// license.appendNode("url", "https://xnat.org/about/license.php")
// license.appendNode("distribution", "repo")
//
// def developers = root.appendNode("developers")
// def flavin = developers.appendNode("developer")
// flavin.appendNode("id", "jflavin")
// flavin.appendNode("name", "John Flavin")
// flavin.appendNode("email", "[email protected]")
//
// def kelsey = developers.appendNode("developer")
// kelsey.appendNode("id", "kelseym")
// kelsey.appendNode("name", "Matt Kelsey")
// kelsey.appendNode("email", "[email protected]")
//
// def will = developers.appendNode("developer")
// will.appendNode("id", "hortonw")
// will.appendNode("name", "Will Horton")
// will.appendNode("email", "[email protected]")
// }
// }
// }
// repositories {
// maven {
// if (project.version.endsWith("-SNAPSHOT")) {
// url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
// } else {
// url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
// }
// // The value for name must match <id> in ~/.m2/settings.xml
// name = "XNAT_Artifactory"
// }
// }
//}

0 comments on commit 15cd3cb

Please sign in to comment.