Skip to content

Commit f11dcfa

Browse files
cortinicofacebook-github-bot
authored andcommitted
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
1 parent 7e8cce3 commit f11dcfa

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// You can use this script to configure the gradleEnterprise{} block in your build.
9+
// You need to rename this file to ./gradle/gradle-enterprise.gradle.kts in order for
10+
// this to be processed.
11+
extensions.getByName("gradleEnterprise").withGroovyBuilder {
12+
setProperty("server", "https://your-gradle-enterprise-instance.example.com")
13+
getProperty("buildScan").withGroovyBuilder {
14+
"publishAlways"()
15+
"tag"(if(System.getenv("CI") != null) "CI" else "Local")
16+
}
17+
}

settings.gradle.kts

+11
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,14 @@ include(
2222
// Include this to enable codegen Gradle plugin.
2323
includeBuild("packages/react-native-gradle-plugin/")
2424

25+
rootProject.name = "react-native-github"
26+
27+
plugins {
28+
id("com.gradle.enterprise").version("3.7.1")
29+
}
30+
31+
// If you specify a file inside gradle/gradle-enterprise.gradle.kts
32+
// you can configure your custom Gradle Enterprise instance
33+
if (File("./gradle/gradle-enterprise.gradle.kts").exists()) {
34+
apply(from = "./gradle/gradle-enterprise.gradle.kts")
35+
}

0 commit comments

Comments
 (0)