diff --git a/build.gradle b/build.gradle index 9b0d79a4bc..b6bde6e24f 100644 --- a/build.gradle +++ b/build.gradle @@ -103,6 +103,11 @@ def projectPom = { } } +buildScan { + termsOfServiceUrl = 'https://gradle.com/terms-of-service' + apply from: 'gradle/build-scans.gradle' +} + configurations { shadow } diff --git a/gradle/build-scans.gradle b/gradle/build-scans.gradle index 12dbd08c05..1df4e7292b 100644 --- a/gradle/build-scans.gradle +++ b/gradle/build-scans.gradle @@ -1,4 +1,29 @@ +def acceptFile = new File(gradle.gradleUserHomeDir, "build-scans/aeron/gradle-scans-license-agree.txt") +def env = System.getenv() +boolean isCI = env.CI || env.TRAVIS +boolean hasAccepted = isCI || env.AERON_GRADLE_SCANS_ACCEPT=='yes' || acceptFile.exists() && acceptFile.text.trim() == 'yes' +boolean hasRefused = env.AERON_GRADLE_SCANS_ACCEPT=='no' || acceptFile.exists() && acceptFile.text.trim() == 'no' + buildScan { - termsOfServiceUrl = 'https://gradle.com/terms-of-service' - termsOfServiceAgree = 'yes' + 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 `AERON_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 +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. +""" + } + } } \ No newline at end of file