-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.gradle
176 lines (149 loc) · 4.53 KB
/
build.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
google()
}
ext.agpVersion = "7.2.0"
ext.kotlinVersion = "1.4.31"
dependencies {
classpath "com.android.tools.build:gradle:$agpVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.17.1"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.1.0"
}
}
// Gradle plugins
plugins {
id "java-gradle-plugin"
id "groovy"
id 'maven-publish'
id "com.gradle.plugin-publish" version "0.15.0"
id "com.vanniktech.maven.publish" version "0.15.1"
id "com.github.hierynomus.license" version "0.16.1"
}
apply plugin: "org.jetbrains.kotlin.jvm"
apply plugin: "org.jetbrains.kotlin.kapt"
apply plugin: "io.gitlab.arturbosch.detekt"
apply plugin: "org.jlleitschuh.gradle.ktlint"
allprojects {
repositories {
mavenCentral()
google()
}
}
sourceSets {
main {
java {
srcDir("build/generated/source/kapt/main")
}
}
}
// Repositories for dependencies
repositories {
mavenCentral()
google()
}
compileGroovy {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
// compile groovy first, see
// https://docs.gradle.org/6.1-rc-1/release-notes.html#compilation-order
tasks.named("compileGroovy") {
classpath = sourceSets.main.compileClasspath
}
tasks.named("compileKotlin") {
classpath += files(sourceSets.main.groovy.classesDirectory)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
// Several of these need to be kept as 'compile' for license checking to work
// as otherwise the downloadLicenses task misses these deps
// Build dependencies
dependencies {
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.3"
compileOnly "com.android.tools.build:gradle:$agpVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
// For uploading proguard/ndk files
compile "com.squareup.okhttp3:okhttp:4.8.0"
compile "com.squareup.retrofit2:retrofit:2.9.0"
compile "com.squareup.retrofit2:converter-moshi:2.9.0"
compile "com.squareup.retrofit2:converter-scalars:2.9.0"
// For serialization of shared data
compile "com.squareup.moshi:moshi:1.9.3"
// For multiple I/O use cases
compile "com.squareup.okio:okio:2.7.0"
testImplementation "com.android.tools.build:gradle:$agpVersion"
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:2.28.2"
testImplementation "com.squareup.okhttp3:mockwebserver:4.8.0"
testImplementation "com.squareup.okhttp3:logging-interceptor:4.8.0"
testImplementation "com.google.truth:truth:1.0.1"
}
// Gradle plugin publishing settings (plugins.gradle.com)
pluginBundle {
website = POM_URL
vcsUrl = POM_SCM_URL
plugins {
androidGradlePlugin {
id = "com.bugsnag.android.gradle"
displayName = POM_NAME
description = POM_DESCRIPTION
tags = ["bugsnag", "proguard", "android", "upload"]
}
}
mavenCoordinates {
groupId = GROUP
artifactId = POM_ARTIFACT_ID
}
}
publishing {
repositories {
maven {
name = "Sonatype"
if (VERSION_NAME.contains("SNAPSHOT")) {
url = "https://oss.sonatype.org/content/repositories/snapshots/"
} else {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials {
username = project.hasProperty("NEXUS_USERNAME") ? "$NEXUS_USERNAME" : System.getenv("NEXUS_USERNAME")
password = project.hasProperty("NEXUS_PASSWORD") ? "$NEXUS_PASSWORD" : System.getenv("NEXUS_PASSWORD")
}
}
}
}
// license checking
license {
header rootProject.file("LICENSE")
ignoreFailures true
}
downloadLicenses {
dependencyConfiguration "compile"
}
sourceSets {
main.java.srcDirs += "src/main/kotlin"
}
detekt {
input = files("src/main/kotlin")
baseline = file("detekt-baseline.xml")
reports {
html {
enabled = true
}
}
}
ktlint {
filter {
exclude { element -> element.file.path.contains("/generated/") }
}
}
sourceCompatibility = JavaVersion.VERSION_1_8
// see https://github.com/asciidoctor/asciidoctorj/pull/862
Signature.metaClass.getToSignArtifact = { ->
return (delegate as Signature).source
}