Skip to content

Commit

Permalink
- Update Gradle build
Browse files Browse the repository at this point in the history
  • Loading branch information
zero88 committed Sep 10, 2018
1 parent eb94084 commit 025de7c
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
name: Save test results
command: |
mkdir -p ~/junit/
find . -type f -regex "./build/test-results/*.xml" -exec cp {} ~/junit/ \;
find . -type f -regex "./build/test-results/.+\.xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ subprojects {
sourceCompatibility = 1.8

dependencies {
compileOnly "org.projectlombok:lombok:1.18.0"
annotationProcessor "org.projectlombok:lombok:1.18.0"
compileOnly "org.projectlombok:lombok:1.18.2"
annotationProcessor "org.projectlombok:lombok:1.18.2"

testImplementation "junit:junit:4.12"
testImplementation "org.skyscreamer:jsonassert:1.2.3"
testCompileOnly "org.projectlombok:lombok:1.18.0"
testAnnotationProcessor "org.projectlombok:lombok:1.18.0"
testCompileOnly "org.projectlombok:lombok:1.18.2"
testAnnotationProcessor "org.projectlombok:lombok:1.18.2"
}

jacocoTestReport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void test_generate_by_empty_value() {
TokenGeneration tokenGeneration = new TokenGeneration();
String token = tokenGeneration.apply(null);
assertNotNull(token);
assertEquals(token, tokenGeneration.apply(null));
assertEquals(token, tokenGeneration.apply(token));
}

@Test
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Gradle properties
org.gradle.caching=true
org.gradle.parallel=true

# Project properties
title=Java OAuth libraries
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jul 31 11:47:57 ICT 2018
#Sun Sep 09 11:04:58 ICT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
48 changes: 34 additions & 14 deletions scripts/verification.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
apply plugin: "java"
apply plugin: "jacoco"

task testReportMerge(type: TestReport, group: "verification") {
dependsOn(subprojects.tasks.test)
reportOn subprojects.tasks.test
destinationDir testReportDir
}
def testFailures = []

task testResultMerge(type: Copy, group: "verification") {
dependsOn(subprojects.tasks.test)
into project.testResultsDir
subprojects {
from tasks.test
include "**/*.xml"
task testReport(type: TestReport, group: "verification") {
destinationDir = file(project.testReportDir)
reportOn subprojects.tasks.test
doLast {
if (!testFailures.isEmpty()) {
def errors = testFailures.inject("There were failing tests. " +
"See the report at: " + destinationDir.toPath().resolve("test/index.html").toUri()) {
acc, val -> acc + "\n" + "-" * 20 + "\n" + val
}
throw new TaskExecutionException(project.tasks.test, new Exception(errors))
}
}
includeEmptyDirs = false
}

test {
dependsOn(testResultMerge, testReportMerge)
def numProc = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
maxParallelForks = numProc.intValue()
ignoreFailures = true
finalizedBy("testReport")
subprojects {
test {
maxParallelForks = numProc.intValue()
ignoreFailures = true
finalizedBy("copyTestResult")
afterTest { descriptor, result ->
if (descriptor.parent && result.getResultType() == TestResult.ResultType.FAILURE) {
testFailures += "$descriptor.parent.name > $descriptor.name $result.resultType\n\t$result.exception"
}
}
}
task copyTestResult(type: Copy, group: "verification") {
into project.parent.testResultsDir
from testResultsDir
include "**/*.xml"
includeEmptyDirs = false
}
}
}

task jacocoMerge(type: JacocoMerge, group: "verification") {
Expand All @@ -34,7 +55,6 @@ jacocoTestReport {
xml.enabled = true
html.enabled = true
}

additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at https://docs.gradle.org/4.9/userguide/multi_project_builds.html
*/

rootProject.name = 'zero-oauth'
//include 'android'
include 'core'
Expand Down

0 comments on commit 025de7c

Please sign in to comment.