1
1
@file:Suppress(" UnstableApiUsage" )
2
2
3
+ var gprUser = System .getenv(" GIT_ACTOR" ) ? : " "
4
+ var gprKey = System .getenv(" GIT_TOKEN" ) ? : " "
5
+
6
+ val gprInfoFile = File (rootProject.projectDir, " signing.properties" )
7
+
8
+ if (gprInfoFile.exists()) {
9
+ val gprInfo = java.util.Properties ().apply {
10
+ gprInfoFile.inputStream().use { load(it) }
11
+ }
12
+
13
+ // 在构建时请在 signing.properties 中添加 gpr.user(github 用户名)和 gpr.key(GitHub 个人令牌密钥)
14
+ // 提交时请勿提交以上字段,以免个人账号泄露
15
+ //
16
+ // When constructing, add gpr.user (Github user name) and gpr.key (Github personal token key) to signing.propertiess.
17
+ // Do not submit the above fields when submitted to avoid leakage of personal accounts
18
+ gprUser = gprInfo.getProperty(" gpr.user" ) ? : " "
19
+ gprKey = gprInfo.getProperty(" gpr.key" ) ? : " "
20
+
21
+ if (gprUser.isEmpty() || gprKey.isEmpty()) {
22
+ throw GradleException (" \' gpr.user\' and \' gpr.key\' must be set in \' signing.properties\' " )
23
+ }
24
+ }
25
+
3
26
enableFeaturePreview(" TYPESAFE_PROJECT_ACCESSORS" )
4
27
5
28
pluginManagement {
@@ -12,22 +35,16 @@ pluginManagement {
12
35
13
36
dependencyResolutionManagement {
14
37
repositoriesMode = RepositoriesMode .FAIL_ON_PROJECT_REPOS
15
- // 在构建时请在 gradle.properties 中添加 gpr.user(github 用户名)和 gpr.key(GitHub 个人令牌密钥)
16
- // 提交时请勿提交以上字段,以免个人账号泄露
17
- //
18
- // When constructing, add GPR.USER (Github user name) and GPR.KEY (Github personal token key) to Gradle.properties.
19
- // Do not submit the above fields when submitted to avoid leakage of personal accounts
20
- val gprUser = settings.providers.gradleProperty(" gpr.user" )
21
- val gprKey = settings.providers.gradleProperty(" gpr.key" )
38
+
22
39
repositories {
23
40
google()
24
41
mavenCentral()
25
42
mavenLocal()
26
43
maven {
27
44
url = uri(" https://maven.pkg.github.com/ReChronoRain/HyperCeiler" )
28
45
credentials {
29
- username = gprUser.orNull ? : System .getenv( " GIT_ACTOR " )
30
- password = gprKey.orNull ? : System .getenv( " GIT_TOKEN " )
46
+ username = gprUser
47
+ password = gprKey
31
48
}
32
49
}
33
50
maven(" https://jitpack.io" )
0 commit comments