groovy git commit: Add opt-in to Gradle build scans

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

groovy git commit: Add opt-in to Gradle build scans

cchampeau
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 6a5632dcc -> ab0e4ebdc


Add opt-in to Gradle build scans


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/ab0e4ebd
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ab0e4ebd
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ab0e4ebd

Branch: refs/heads/GROOVY_2_6_X
Commit: ab0e4ebdcc06dfb34bf2a1d818fda1a8c6511107
Parents: 6a5632d
Author: Cedric Champeau <[hidden email]>
Authored: Thu Jun 7 13:17:40 2018 +0200
Committer: Cedric Champeau <[hidden email]>
Committed: Thu Jun 7 13:19:29 2018 +0200

----------------------------------------------------------------------
 build.gradle              |  5 ++--
 gradle/build-scans.gradle | 53 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/ab0e4ebd/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 94355eb..87c6db8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -50,14 +50,13 @@ buildscript {
 }
 
 plugins {
-    id 'com.gradle.build-scan' version '1.12.1'
+    id 'com.gradle.build-scan' version '1.13.4'
     id 'me.champeau.buildscan-recipes' version '0.2.3'
 }
 
 buildScan {
     licenseAgreementUrl = 'https://gradle.com/terms-of-service'
-    licenseAgree = 'yes'
-    publishAlways()
+    apply from: 'gradle/build-scans.gradle'
 }
 
 buildScanRecipes {

http://git-wip-us.apache.org/repos/asf/groovy/blob/ab0e4ebd/gradle/build-scans.gradle
----------------------------------------------------------------------
diff --git a/gradle/build-scans.gradle b/gradle/build-scans.gradle
new file mode 100644
index 0000000..44edca5
--- /dev/null
+++ b/gradle/build-scans.gradle
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+def acceptFile = new File(gradle.gradleUserHomeDir, "gradle-scans-license-agree.txt")
+def env = System.getenv()
+boolean isCI = env.CI || env.TRAVIS || env.TEAMCITY_VERSION
+boolean hasAccepted = isCI || env.GRADLE_SCANS_ACCEPT=='yes' || acceptFile.exists() && acceptFile.text.trim() == 'yes'
+boolean hasRefused = env.GRADLE_SCANS_ACCEPT=='no' || acceptFile.exists() && acceptFile.text.trim() == 'no'
+
+buildScan {
+    if (hasAccepted) {
+        licenseAgree = 'yes'
+        publishAlways()
+    } 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 `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