-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle.kts
94 lines (81 loc) · 4.05 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
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
90
91
92
93
94
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven(url = "https://maven.google.com")
maven(url = "https://storage.googleapis.com/r8-releases/raw")
google()
mavenCentral()
}
dependencies {
// Required manually provide Android's dependencies here that CodeQL's autobuild works correctly
// https://github.com/github/codeql-action/issues/1417#issuecomment-1737158409
classpath("com.android.tools.build:gradle:${libs.versions.gradleVersion.get()}")
classpath(libs.kotlin.plugin)
classpath(libs.navigation.safe.args.plugin)
// Required to support for sealed classes until AGP 8.2
// https://issuetracker.google.com/issues/227160052#comment37
classpath(libs.tools.r8)
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id("base")
id("signing")
id("maven-publish")
}
allprojects {
repositories {
mavenLocal() // look into local .m2 cache.
google()
mavenCentral()
}
}
subprojects {
// apply publishing plugins to all subprojects to global control of publishing repositories.
apply(plugin = "base")
apply(plugin = "signing")
apply(plugin = "maven-publish")
val isReleaseVersion = !version.toString().lowercase().endsWith("snapshot")
tasks {
// Always run tests as part of the `build` task.
findByName("test")?.apply {
named("check") {
dependsOn(named("test"))
}
}
}
// Setup global publishing repository settings.
signing {
useGpgCmd()
sign(publishing.publications)
}
publishing {
repositories {
maven {
// Dynamically select either Maven Central or na Internal repository depending on the value of uploadcare.publish.type / UPLOADCARE_PUBLISH_TYPE
name = "selected"
// Allow deploying to a custom repository (for testing purposes)
val publishInternally = project.findProperty("uploadcare.publish.type")?.toString() == "internal"
val repositoryUrl = if (isReleaseVersion) {
val releaseMavenCentral = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val releaseInternal = (project.findProperty("uploadcare.publish.internal.release") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_RELEASE") ?: "") as String
if (releaseInternal != "" && publishInternally) releaseInternal else releaseMavenCentral
} else {
val snapshotMavenCentral = "https://oss.sonatype.org/content/repositories/snapshots/"
val snapshotInternal = (project.findProperty("uploadcare.publish.internal.snapshot") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_SNAPSHOT") ?: "") as String
if (snapshotInternal != "" && publishInternally) snapshotInternal else snapshotMavenCentral
}
url = uri(repositoryUrl)
credentials {
val mavenCentralUser = (project.findProperty("uploadcare.publish.sonatype.user") ?: System.getenv("UPLOADCARE_PUBLISH_SONATYPE_USER") ?: "") as String
val mavenCentralPass = (project.findProperty("uploadcare.publish.sonatype.pass") ?: System.getenv("UPLOADCARE_PUBLISH_SONATYPE_PASS") ?: "") as String
val internalUser = (project.findProperty("uploadcare.publish.internal.user") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_USER") ?: "") as String
val internalPass = (project.findProperty("uploadcare.publish.internal.pass") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_PASS") ?: "") as String
username = if (publishInternally) internalUser else mavenCentralUser
password = if (publishInternally) internalPass else mavenCentralPass
}
}
}
}
}