-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.gradle
89 lines (78 loc) · 3.2 KB
/
settings.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import org.gradle.internal.os.OperatingSystem
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2024'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
if (publicFolder == null) {
publicFolder = 'C:\\Users\\Public'
}
def homeRoot = new File(publicFolder, 'wpilib')
frcHome = new File(homeRoot, frcYear)
} else {
def userFolder = System.getProperty('user.home')
def homeRoot = new File(userFolder, 'wpilib')
frcHome = new File(homeRoot, frcYear)
}
def frcHomeMaven = new File(frcHome, 'maven')
maven {
name 'frcHome'
url frcHomeMaven
}
}
}
plugins {
id 'com.gradle.enterprise' version '3.14.1'
}
Properties props = System.getProperties();
props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true");
gradleEnterprise {
buildScan {
// Publish build scans after build or test for sharing or to look over later.
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
publishAlwaysIf(gradle.startParameter.taskNames.contains("build") || gradle.startParameter.taskNames.contains("test"))
// Run git commands in the background to add useful information to the build scan.
background {
// Check if the project is a git repository (and ensure git is installed)
def isGitRepo = false
try {
isGitRepo = 'git rev-parse --is-inside-work-tree'.execute().text.trim() == 'true'
} catch (ignored) {}
if (!isGitRepo) {
return
}
// Git commit id
def commitId = 'git rev-parse --verify HEAD'.execute().text.trim()
if (commitId) {
buildScan.value 'Git Commit ID', commitId
// Get remote URL and construct a link to the commit in the build scan
def repoUrl = 'git remote get-url origin'.execute().text.trim().replaceAll(/\.git$/, '').replaceAll(/^git@(.+):/, 'https://$1/')
if (repoUrl) {
buildScan.link 'Source', "$repoUrl/tree/$commitId"
}
}
// Git branch name
def branchName = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
if (branchName) {
buildScan.value 'Git Branch Name', branchName
}
// Git dirty local state
def status = 'git status --porcelain'.execute().text
if (status) {
buildScan.tag 'dirty'
buildScan.value 'Git Status', status
}
}
// Hide the user's local IP, hostname and username from the buld scan.
// Warning: The full path to the project folder may be leaked in the build scan if tests fail.
obfuscation {
username { name -> "user" }
hostname { host -> "localhost" }
ipAddresses { addresses -> addresses.collect { address -> "0.0.0.0"} }
}
}
}