Skip to content

Commit

Permalink
Allow to setup a Gradle Enterprise instance via an external script
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cortinico authored and facebook-github-bot committed Feb 16, 2022
1 parent 7e8cce3 commit f11dcfa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gradle/gradle-enterprise.gradle.kts.sample
Original file line number Diff line number Diff line change
@@ -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")
}
}
11 changes: 11 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit f11dcfa

Please sign in to comment.