Allow to setup a Gradle Enterprise instance via an external script

Summary:
This diff allows to setup a Gradle Enterprise instance
either locally or on CI via an external Gradle script.

I've create a `.sample` script that users can copy to
start setting up their GE instance, should they have one.

Moreover, it applies the `com.gradle.enterprise` Gradle
plugin by default. This has the positive side effect of
not invalidating build cache for the included build if
you happen to pass the `--scan` flag in OSS (as the
classpath isn't changed).

Changelog:
[Android] [Added] - Allow to setup a Gradle Enterprise instance via an external script

Reviewed By: mdvacca

Differential Revision: D33582388

fbshipit-source-id: 0c2f073cf7a8e39963b0adfc3b339b14c1e7759b
This commit is contained in:
Nicola Corti 2022-02-16 06:36:09 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 7e8cce3d2d
Коммит f11dcfaea1
2 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,17 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// You can use this script to configure the gradleEnterprise{} block in your build.
// You need to rename this file to ./gradle/gradle-enterprise.gradle.kts in order for
// this to be processed.
extensions.getByName("gradleEnterprise").withGroovyBuilder {
setProperty("server", "https://your-gradle-enterprise-instance.example.com")
getProperty("buildScan").withGroovyBuilder {
"publishAlways"()
"tag"(if(System.getenv("CI") != null) "CI" else "Local")
}
}

Просмотреть файл

@ -22,3 +22,14 @@ include(
// Include this to enable codegen Gradle plugin.
includeBuild("packages/react-native-gradle-plugin/")
rootProject.name = "react-native-github"
plugins {
id("com.gradle.enterprise").version("3.7.1")
}
// If you specify a file inside gradle/gradle-enterprise.gradle.kts
// you can configure your custom Gradle Enterprise instance
if (File("./gradle/gradle-enterprise.gradle.kts").exists()) {
apply(from = "./gradle/gradle-enterprise.gradle.kts")
}