Skip to content

Commit

Permalink
Merge pull request #356 from aalmiray/gradle-build-scan
Browse files Browse the repository at this point in the history
Configure gradle build scan plugin
  • Loading branch information
nedtwigg authored Mar 14, 2019
2 parents 9843130 + da3b4df commit 2532984
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .ci/ci.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Do the Gradle build
./gradlew build || exit 1
./gradlew --scan build || exit 1
./gradlew npmTest || exit 1

if [ "$TRAVIS_REPO_SLUG" == "diffplug/spotless" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
Expand Down
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ buildscript {
classpath "org.ajoberstar:gradle-git:${VER_GRADLE_GIT}"
classpath "ch.raffael.pegdown-doclet:pegdown-doclet:${VER_PEGDOWN_DOCLET}"
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:${VER_SPOTBUGS_PLUGIN}"
classpath "com.gradle:build-scan-plugin:${VER_BUILDSCAN_PLUGIN}"
}
}

apply plugin: 'com.gradle.build-scan'
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
apply from: 'gradle/build-scans.gradle'
}

// root eclipse project
apply plugin: 'com.diffplug.gradle.eclipse.resourcefilters'
eclipseResourceFilters {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ VER_PLUGIN_PUBLISH=0.9.7
VER_GOOMPH=3.17.4
VER_GRADLE_GIT=1.6.0
VER_PEGDOWN_DOCLET=1.3
VER_BUILDSCAN_PLUGIN=1.16

# Used in multiple places
VER_DURIAN=1.2.0
Expand Down
40 changes: 40 additions & 0 deletions gradle/build-scans.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
File acceptFile = new File(gradle.gradleUserHomeDir, "build-scans/spotless/gradle-scans-license-agree.txt")
acceptFile.parentFile.mkdirs()
def env = System.getenv()
boolean isCI = env.CI || env.TRAVIS
boolean hasAccepted = isCI || env.SPOTLESS_GRADLE_SCANS_ACCEPT=='yes' || acceptFile.exists() && acceptFile.text.trim() == 'yes'
boolean hasRefused = env.SPOTLESS_GRADLE_SCANS_ACCEPT=='no' || acceptFile.exists() && acceptFile.text.trim() == 'no'

buildScan {
if (hasAccepted) {
termsOfServiceAgree = 'yes'
} else if (!hasRefused) {
gradle.buildFinished {
println """
This build uses Gradle Build Scans to gather statistics, share information about
failures, environmental issues, dependencies resolved during the build and more.
Build scans will be published after each build, if you accept the terms of
service, and in particular the privacy policy.
Please read
https://gradle.com/terms-of-service
https://gradle.com/legal/privacy
and then:
- set the `SPOTLESS_GRADLE_SCANS_ACCEPT` to `yes`/`no` if you agree with/refuse the TOS
- or create the ${acceptFile} file with `yes`/`no` in it if you agree with/refuse
echo 'yes' >> ${acceptFile}
or
echo 'no' >> ${acceptFile}
And we'll not bother you again. Note that build scans are only made public if
you share the URL at the end of the build.
"""
}
}
}
3 changes: 3 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* Updated default npm package version of internally used typescript package from 2.9.2 to 3.3.3 and tslint package from 5.1.0 to 5.12.0 (both used by `tsfmt`)
* Updated default eclipse-wtp from 4.7.3a to 4.7.3b ([#371](https://github.com/diffplug/spotless/pull/371)).
* Default behavior of XML formatter changed to ignore external URIs ([#369](https://github.com/diffplug/spotless/issues/369)).
* Configured `buìld-scan` plugin in build ([#356](https://github.com/diffplug/spotless/pull/356)).
* Runs on every CI build automatically.
* Users need to opt-in on their local machine.

### Version 3.19.0 - March 11th 2018 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-plugin-gradle/3.19.0/), [jcenter](https://bintray.com/diffplug/opensource/spotless-plugin-gradle/3.19.0))

Expand Down

0 comments on commit 2532984

Please sign in to comment.