-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
executable file
·62 lines (54 loc) · 1.82 KB
/
build.gradle.kts
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
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
buildscript {
repositories {
mavenCentral()
google()
mavenLocal()
}
dependencies {
classpath(BuildPlugins.kotlin)
classpath(BuildPlugins.detekt)
}
}
subprojects {
repositories {
mavenCentral()
google()
mavenLocal()
}
}
tasks.register("installPreCommitHook", Copy::class) {
from("tools/scripts/pre-commit")
into(".git/hooks")
fileMode = 0b000_111_111_111
}
tasks {
val installPreCommitHook by existing
getByName("prepareKotlinBuildScriptModel").dependsOn(installPreCommitHook)
}
val ossrhUsername by extra(getValueFromEnvOrProperties("OSSRH_USERNAME"))
val ossrhPassword by extra(getValueFromEnvOrProperties("OSSRH_PASSWORD"))
val mStagingProfileId by extra(getValueFromEnvOrProperties("SONATYPE_STAGING_PROFILE_ID"))
val signingKeyId by extra(getValueFromEnvOrProperties("SIGNING_KEY_ID"))
val signingPassword by extra(getValueFromEnvOrProperties("SIGNING_PASSWORD"))
val signingKey by extra(getValueFromEnvOrProperties("SIGNING_KEY"))
// Set up Sonatype repository
nexusPublishing {
repositories {
sonatype {
stagingProfileId.set(mStagingProfileId.toString())
username.set(ossrhUsername.toString())
password.set(ossrhPassword.toString())
// Add these lines if using new Sonatype infra
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
fun getValueFromEnvOrProperties(name: String): Any? {
val localProperties =
com.android.build.gradle.internal.cxx.configure.gradleLocalProperties(rootDir)
return System.getenv(name) ?: localProperties[name]
}