-
Notifications
You must be signed in to change notification settings - Fork 412
Expand file tree
/
Copy pathbuild.gradle
More file actions
103 lines (90 loc) · 3.76 KB
/
Copy pathbuild.gradle
File metadata and controls
103 lines (90 loc) · 3.76 KB
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
95
96
97
98
99
100
101
102
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: rootProject.file("dependencies.gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url = "https://central.sonatype.com/repository/maven-snapshots/" }
}
dependencies {
classpath deps.androidPlugin
classpath deps.kotlinGradlePlugin
classpath deps.gradleMavenPublishPlugin
classpath deps.benchmarkGradlePlugin
// Dokka is needed on classpath for vanniktech publish plugin
classpath deps.dokkaPlugin
classpath deps.kspGradlePlugin
classpath deps.ktlintGradlePlugin
// Note: This means that the gralde plugin used in the sample app is not built from source
// but downloaded form the repository at he version specified in the gradle.properties file.
// If you are making changes to the gradle plugin, you need to change the version in the
// gradle.properties file and run ./gradlew publishToMavenLocal in order to see the changes
// in the sample app.
classpath "com.airbnb:deeplinkdispatch-gradle-plugin:7.3.0-SNAPSHOT"
}
}
allprojects {
apply from: rootProject.file("dependencies.gradle")
repositories {
google()
mavenCentral()
maven { url = "https://central.sonatype.com/repository/maven-snapshots" }
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
allWarningsAsErrors = true
}
}
// Apply consistent JVM toolchain and target to all subprojects
subprojects {
afterEvaluate {
def toolchainVersion = rootProject.ext.jvmToolchainVersion
def targetVersion = rootProject.ext.jvmTargetVersion
// For Kotlin projects (both pure JVM and Android)
if (plugins.hasPlugin('org.jetbrains.kotlin.jvm') || plugins.hasPlugin('kotlin') ||
plugins.hasPlugin('kotlin-android') || plugins.hasPlugin('org.jetbrains.kotlin.android')) {
kotlin {
jvmToolchain(toolchainVersion)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.@Companion.fromTarget(targetVersion.toString())
}
}
}
// For Java-only projects (without Kotlin)
else if (plugins.hasPlugin('java') && !plugins.hasPlugin('kotlin-dsl')) {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(toolchainVersion)
}
}
}
// For Android projects, also set compileOptions
if (plugins.hasPlugin('com.android.library') || plugins.hasPlugin('com.android.application')) {
android {
compileOptions {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = JavaVersion.toVersion(targetVersion)
}
}
}
// For pure Java projects
if (plugins.hasPlugin('java') && !plugins.hasPlugin('kotlin-dsl')) {
java {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = JavaVersion.toVersion(targetVersion)
}
}
}
}
def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://central.sonatype.com/repository/maven-snapshots"
}