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
|
buildscript {
repositories {
mavenCentral()
google()
}
}
plugins {
id 'com.github.sherter.google-java-format' version '0.9'
id 'maven-publish'
id 'signing'
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 26
targetSdkVersion 31
versionCode VERSION_CODE.toInteger()
versionName VERSION_NAME
// Need to set up some project properties to publish to bintray.
project.group = GROUP_ID
project.archivesBaseName = ARTIFACT_ID
project.version = VERSION_NAME
}
splits {
abi {
enable true
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "arm64-v8a", "armeabi-v7a", "armeabi"
universalApk true
}
}
lintOptions {
abortOnError false
checkAllWarnings true
warningsAsErrors true
disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'junit:junit:4.13.2'
implementation 'androidx.test:runner:1.4.0'
}
googleJavaFormat {
options style: 'AOSP'
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
failOnError false
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId GROUP_ID
artifactId ARTIFACT_ID
version VERSION_NAME
from components.release
artifact sourcesJar
artifact javadocJar
pom {
name = ARTIFACT_ID
description = 'Android library for triggering device-side ' +
'code from host-side Mobly tests.'
url = 'https://github.com/google/mobly-snippet-lib'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
name = 'The Mobly Team'
}
}
scm {
connection = 'https://github.com/google/mobly-snippet-lib.git'
url = 'https://github.com/google/mobly-snippet-lib'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
signing {
sign publishing.publications.release
}
}
// Open lint's HTML report in your default browser or viewer.
task openLintReport(type: Exec) {
def lint_report = "build/reports/lint-results-debug.html"
def cmd = "cat"
def platform = System.getProperty('os.name').toLowerCase(Locale.ROOT)
if (platform.contains("linux")) {
cmd = "xdg-open"
} else if (platform.contains("mac os x")) {
cmd = "open"
} else if (platform.contains("windows")) {
cmd = "launch"
}
commandLine cmd, lint_report
}
task presubmit {
dependsOn { ['googleJavaFormat', 'lint', 'openLintReport'] }
doLast {
println "Fix any lint issues you see. When it looks good, submit the pull request."
}
}
|