-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retry: Fix auto-attach, log exception; fix project (#55)
- Loading branch information
Showing
19 changed files
with
341 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
import org.apache.tools.ant.filters.ReplaceTokens | ||
|
||
plugins { | ||
id 'io.codearte.nexus-staging' version '0.30.0' | ||
id 'net.researchgate.release' version '2.8.1' | ||
id 'java-library' | ||
id 'maven-publish' | ||
id 'jacoco' | ||
id 'signing' | ||
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' | ||
id 'pl.allegro.tech.build.axion-release' version '1.13.6' | ||
} | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'maven' | ||
apply plugin: 'jacoco' | ||
apply plugin: 'signing' | ||
|
||
compileJava.enabled = false | ||
processResources.enabled = false | ||
classes.enabled = false | ||
jar.enabled = false | ||
|
||
// remove default JAR artifact | ||
configurations.archives.artifacts.removeAll { it.provider.name == 'jar' } | ||
|
||
afterReleaseBuild.dependsOn uploadArchives | ||
|
||
group = 'com.nordstrom.tools' | ||
description = 'TestNG Foundation' | ||
|
||
|
@@ -29,6 +18,8 @@ if (!project.hasProperty('profile')) { | |
assert ['java7', 'java8'].contains(profile) | ||
} | ||
|
||
apply from: "${profile}Deps.gradle" | ||
|
||
def archiveVer = null | ||
def verBits = project.version.split('-') | ||
def javaVersion = 'j' + profile.charAt(4) | ||
|
@@ -45,53 +36,10 @@ if (verBits.length > 1) { | |
project.version = archiveVer | ||
|
||
def archiveBase = rootProject.name + '-' + archiveVer | ||
def buildRoot = null | ||
def libsDir = null | ||
|
||
switch ("${profile}") { | ||
case "java7": | ||
buildRoot = file('build-j7') | ||
libsDir = new File(buildRoot, 'libs') | ||
break | ||
case "java8": | ||
buildRoot = file('build-j8') | ||
libsDir = new File(buildRoot, 'libs') | ||
break | ||
} | ||
|
||
sourceSets { | ||
java7 { | ||
java { | ||
srcDirs = [ 'src/main/java', 'src/main/java-j7' ] | ||
outputDir = new File(buildRoot, 'classes') | ||
} | ||
resources { | ||
srcDirs = [ 'src/main/resources' ] | ||
} | ||
compileClasspath = sourceSets.main.output + configurations.java7Compile | ||
runtimeClasspath = output + compileClasspath + configurations.java7Runtime | ||
output.resourcesDir = "${buildRoot}/classes" | ||
} | ||
java8 { | ||
java { | ||
srcDirs = [ 'src/main/java', 'src/main/java-j8' ] | ||
outputDir = new File(buildRoot, 'classes-j8') | ||
} | ||
resources { | ||
srcDirs = [ 'src/main/resources' ] | ||
} | ||
compileClasspath = sourceSets.main.output + configurations.java8Compile | ||
runtimeClasspath = output + compileClasspath + configurations.java8Runtime | ||
output.resourcesDir = "${buildRoot}/classes-j8" | ||
} | ||
test { | ||
java { | ||
srcDirs = [ 'src/test/java', "src/test/java-${javaVersion}" ] | ||
outputDir = new File(buildRoot, "test-classes-${javaVersion}") | ||
} | ||
compileClasspath += sourceSets["${profile}"].output | ||
runtimeClasspath += sourceSets["${profile}"].output | ||
} | ||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
clean { | ||
|
@@ -100,8 +48,8 @@ clean { | |
} | ||
|
||
jacoco { | ||
toolVersion = '0.8.7' | ||
reportsDir = file("${buildDir}/customJacocoReportDir") | ||
toolVersion = '0.8.5' | ||
reportsDirectory = file("${buildDir}/customJacocoReportDir") | ||
} | ||
|
||
jacocoTestReport { | ||
|
@@ -112,15 +60,7 @@ jacocoTestReport { | |
} | ||
} | ||
|
||
task("${profile}Javadoc", type: Javadoc) { | ||
group 'Documentation' | ||
description "Generates Javadoc API documentation for the '${profile}' source code." | ||
|
||
source = sourceSets["${profile}"].allJava | ||
classpath = configurations.compile + configurations["${profile}Compile"] | ||
} | ||
|
||
task("${profile}Jar", type: Jar) { | ||
jar { | ||
group 'Build' | ||
description "Assembles a jar archive containing the '${profile}' classes, POM and Maven properties." | ||
|
||
|
@@ -129,7 +69,6 @@ task("${profile}Jar", type: Jar) { | |
def pomTokens = [projectVersion: archiveVer, projectTimestamp: timestamp, javaVersion: javaVersion] | ||
def propTokens = [projectVersion: archiveVer, projectGroupId: project.group, projectArtifactId: rootProject.name] | ||
|
||
from(sourceSets["${profile}"].output) { } | ||
from('.') { | ||
include('pom.xml') | ||
into(destPath) | ||
|
@@ -140,33 +79,33 @@ task("${profile}Jar", type: Jar) { | |
into(destPath) | ||
filter(ReplaceTokens, tokens: propTokens) | ||
} | ||
archiveName = archiveBase + '.jar' | ||
destinationDir = libsDir | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
archiveFileName = archiveBase + '.jar' | ||
destinationDirectory = libsDir | ||
} | ||
|
||
clean { | ||
delete buildRoot | ||
} | ||
|
||
task("${profile}SourcesJar", type: Jar) { | ||
sourcesJar { | ||
group 'Build' | ||
description "Assembles a jar archive containing the '${profile}' source files." | ||
|
||
classifier = 'sources' | ||
from sourceSets["${profile}"].allSource | ||
archiveName = archiveBase + '-sources.jar' | ||
destinationDir = libsDir | ||
from sourceSets.main.allSource | ||
archiveFileName = archiveBase + '-sources.jar' | ||
destinationDirectory = libsDir | ||
} | ||
|
||
task("${profile}JavadocJar", type: Jar, dependsOn: "${profile}Javadoc") { | ||
javadocJar { | ||
dependsOn javadoc | ||
group 'Build' | ||
description "Assembles a jar archive containing the '${profile}' JavaDoc files." | ||
|
||
classifier = 'javadoc' | ||
from tasks["${profile}Javadoc"].destinationDir | ||
archiveName = archiveBase + '-javadoc.jar' | ||
destinationDir = libsDir | ||
from javadoc.destinationDir | ||
archiveFileName = archiveBase + '-javadoc.jar' | ||
destinationDirectory = libsDir | ||
} | ||
|
||
test { | ||
|
@@ -177,115 +116,87 @@ test { | |
} | ||
|
||
artifacts { | ||
archives tasks["${profile}Jar"] | ||
archives tasks["${profile}SourcesJar"] | ||
archives tasks["${profile}JavadocJar"] | ||
} | ||
|
||
signing { | ||
sign configurations.archives | ||
} | ||
|
||
install { | ||
repositories { | ||
mavenInstaller { | ||
pom.scopeMappings.with { | ||
mappings.clear() | ||
addMapping(300, configurations.compile, 'compile') | ||
addMapping(300, configurations["${profile}Compile"], 'compile') | ||
} | ||
} | ||
} | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
beforeDeployment { MavenDeployment deployment -> | ||
signing.signPom(deployment) | ||
signArchives.filesToSign.each { | ||
def signOp = signing.sign(it) | ||
def single = signOp.singleSignature | ||
def matcher = it.name =~ /-(sources|javadoc)\.jar$/ | ||
single.name = 'testng-foundation' | ||
single.classifier = matcher.find() ? matcher.group(1) : null | ||
deployment.addArtifact(single) | ||
archives tasks['sourcesJar'] | ||
archives tasks['javadocJar'] | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from(components.java) | ||
pom { | ||
name = 'TestNG Foundation' | ||
groupId = project.group | ||
artifactId = rootProject.name | ||
version = archiveVer | ||
packaging = 'jar' | ||
description = 'TestNG Foundation is an automation framework designed to extend and enhance the capabilities provided by TestNG.' | ||
url = 'https://github.com/sbabcoc/TestNG-Foundation' | ||
|
||
scm { | ||
connection = 'scm:git:https://github.com/sbabcoc/TestNG-Foundation.git' | ||
developerConnection = 'scm:git:https://github.com/sbabcoc/TestNG-Foundation.git' | ||
url = 'https://github.com/sbabcoc/TestNG-Foundation/tree/master' | ||
tag = 'HEAD' | ||
} | ||
} | ||
|
||
repository(url: 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/') { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
|
||
snapshotRepository(url: 'https://s01.oss.sonatype.org/content/repositories/snapshots/') { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
pom.scopeMappings.with { | ||
mappings.clear() | ||
addMapping(300, configurations.compile, 'compile') | ||
addMapping(300, configurations["${profile}Compile"], 'compile') | ||
developers { | ||
developer { | ||
id = 'scoba' | ||
name = 'Scott Babcock' | ||
email = '[email protected]' | ||
organization = 'Nordstrom' | ||
organizationUrl = 'https://shop.nordstrom.com' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def installer = install.repositories.mavenInstaller | ||
def deployer = uploadArchives.repositories.mavenDeployer | ||
|
||
[installer, deployer]*.pom*.whenConfigured { pom -> | ||
pom.project { | ||
name 'TestNG Foundation' | ||
groupId project.group | ||
artifactId rootProject.name | ||
version archiveVer | ||
packaging 'jar' | ||
description 'TestNG Foundation is an automation framework designed to extend and enhance the capabilities provided by TestNG.' | ||
url 'https://github.com/sbabcoc/TestNG-Foundation' | ||
|
||
scm { | ||
connection 'scm:git:https://github.com/sbabcoc/TestNG-Foundation.git' | ||
developerConnection 'scm:git:https://github.com/sbabcoc/TestNG-Foundation.git' | ||
url 'https://github.com/sbabcoc/TestNG-Foundation/tree/master' | ||
tag 'HEAD' | ||
} | ||
signing { | ||
sign publishing.publications.mavenJava | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
task install { | ||
dependsOn publishToMavenLocal | ||
group publishToMavenLocal.group | ||
description '[alias] ' + publishToMavenLocal.description | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'scoba' | ||
name 'Scott Babcock' | ||
email '[email protected]' | ||
organization 'Nordstrom' | ||
organizationUrl 'https://shop.nordstrom.com' | ||
nexusPublishing { | ||
packageGroup = 'com.nordstrom' | ||
repositories { | ||
ossrh { | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
if (project.hasProperty('ossrhStagingProfileId')) { | ||
stagingProfileId = ossrhStagingProfileId | ||
} | ||
} | ||
} | ||
} | ||
|
||
nexusStaging { | ||
packageGroup = 'com.nordstrom' | ||
stagingProfileId = '76d943f622957' | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { url 'https://repo1.maven.org/maven2' } | ||
maven { url 'https://repo.maven.apache.org/maven2' } | ||
maven { url "${projectDir}/repo" } | ||
} | ||
|
||
dependencies { | ||
compile 'com.nordstrom.tools:java-utils:2.1.0' | ||
compile 'com.nordstrom.tools:settings:2.3.10' | ||
|
||
apply from: "${profile}Deps.gradle" | ||
|
||
testCompile configurations["${profile}Compile"] | ||
constraints { | ||
api 'com.nordstrom.tools:java-utils:2.1.0' | ||
api 'com.nordstrom.tools:settings:2.3.10' | ||
} | ||
api 'com.nordstrom.tools:java-utils' | ||
api 'com.nordstrom.tools:settings' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
profile=java8 | ||
version=3.0.7-SNAPSHOT | ||
org.gradle.java.installations.auto-detect=false | ||
org.gradle.java.installations.auto-download=false | ||
org.gradle.java.installations.fromEnv=JDK7_HOME,JDK8_HOME,JDK11_HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
sourceCompatibility = 1.7 | ||
targetCompatibility = 1.7 | ||
ext.buildRoot = file('build-j7') | ||
ext.libsDir = new File(buildRoot, 'libs') | ||
|
||
tasks.withType(JavaCompile) { | ||
options.bootstrapClasspath = files("${System.env.JDK7_HOME}/jre/lib/rt.jar") | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(7) | ||
} | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java { | ||
srcDirs = [ 'src/main/java', 'src/main-j7/java' ] | ||
outputDir = new File(buildRoot, 'classes') | ||
} | ||
output.resourcesDir = "${buildRoot}/classes" | ||
} | ||
test { | ||
java { | ||
srcDirs = [ 'src/test/java', 'src/test-j7/java' ] | ||
outputDir = new File(buildRoot, 'test-classes') | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
java7Compile configurations.compile | ||
java7Compile 'org.testng:testng:6.10' | ||
constraints { | ||
api 'org.testng:testng:6.10' | ||
} | ||
api 'org.testng:testng' | ||
} |
Oops, something went wrong.