-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
185 lines (158 loc) · 5.33 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
177
178
179
180
181
182
183
184
185
import static org.gradle.kotlin.dsl.KotlinDependencyExtensionsKt.embeddedKotlinVersion
buildscript {
ext.kotlin_version = embeddedKotlinVersion
ext.booster_version = '3.0.0'
repositories {
mavenLocal()
google()
mavenCentral()
jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.10.2"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.2"
classpath "de.marcphilipp.gradle:nexus-publish-plugin:0.4.0"
}
}
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'de.marcphilipp.nexus-publish'
group = 'io.johnsonlee.translate'
version = '1.0.0'
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName project.version
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
defaultPublishConfig project.name.endsWith('-SNAPSHOT') ? 'debug' : 'release'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
repositories {
mavenLocal()
google()
mavenCentral()
jcenter()
}
dependencies {
kapt 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.core:core-ktx:1.3.2'
api 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
api 'androidx.activity:activity-ktx:1.1.0'
implementation 'com.google.mlkit:translate:16.1.1'
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.4.10.2")
}
def OSSRH_USERNAME = project.properties['OSSRH_USERNAME'] ?: System.getenv('OSSRH_USERNAME')
def OSSRH_PASSWORD = project.properties['OSSRH_PASSWORD'] ?: System.getenv('OSSRH_PASSWORD')
dokkaHtml.configure {
dokkaSourceSets {
named("main") {
noAndroidSdkLink.set(false)
}
}
}
task androidJavadocs(type: Javadoc, dependsOn: dokkaHtml) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}
exclude '**/R.html', '**/R.*.html', '**/index.html'
}
task androidJavadocsJar(type: Jar, dependsOn: dokkaHtml) {
archiveClassifier.set('javadoc')
from dokkaHtml.outputDirectory
}
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
}
debug(MavenPublication) {
from components.debug
}
withType(MavenPublication).configureEach {
groupId = project.group
artifactId = project.name
version = project.version
artifact androidSourcesJar
artifact androidJavadocsJar
pom {
name = project.name
url = "https://github.com/johnsonlee/${project.name}"
description = project.description ?: project.name
scm {
connection = "scm:git:git://github.com/johnsonlee/${project.name}.git"
developerConnection = "scm:git:[email protected]:johnsonlee/${project.name}.git"
url = "https://github.com/johnsonlee/${project.name}"
}
licenses {
license {
name = 'Apache License'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
}
}
withXml { xml ->
xml.asNode().appendNode('developers').appendNode('developer').with {
appendNode('id', 'johnsonlee')
appendNode('email', '[email protected]')
}
}
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username = OSSRH_USERNAME
password = OSSRH_PASSWORD
}
}
}
nexusStaging {
packageGroup = "io.johnsonlee"
username = OSSRH_USERNAME
password = OSSRH_PASSWORD
numberOfRetries = 50
delayBetweenRetriesInMillis = 3000
}
signing {
sign publishing.publications
}