blob: 3492848d273e59b0ce7b9b4c18e498311af5d46f (
plain)
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
|
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
plugins {
id 'com.github.sherter.google-java-format' version '0.6'
}
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 11
targetSdkVersion 24
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
}
lintOptions {
abortOnError true
checkAllWarnings true
warningsAsErrors true
}
}
dependencies {
compile 'com.android.support.test:runner:0.5'
}
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))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
// bintray packaging information
install {
repositories.mavenInstaller {
pom.project {
name ARTIFACT_ID
description
'Android library for triggering device-side code from ' +
'host-side Mobly tests.'
url 'https://github.com/google/mobly-snippet-lib'
packaging 'aar'
groupId GROUP_ID
artifactId ARTIFACT_ID
version VERSION_NAME
name ARTIFACT_ID
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
connection 'https://github.com/google/mobly-snippet-lib.git'
url 'https://github.com/google/mobly-snippet-lib'
}
}
}
}
// Try loading bintray.properties. It's okay if this fails; we might not be
// uploading.
def bintrayPropFile = project.rootProject.file('bintray.properties')
if (bintrayPropFile.exists()) {
Properties prop = new Properties()
prop.load(new FileInputStream(bintrayPropFile))
project.ext.bintrayUser = prop.user
project.ext.bintrayKey = prop.key
} else {
project.ext.bintrayUser = null
project.ext.bintrayKey = null
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(bintrayUpload)) {
if (project.bintrayUser == null || project.bintrayKey == null) {
if (bintrayPropFile.exists()) {
throw new IllegalArgumentException(
bintrayPropFile.toString()
+ ' does not contain "user" or "key" props')
} else {
throw new FileNotFoundException(
'bintray.properties not found at path: ' + bintrayPropFile)
}
}
}
}
bintray {
user = project.bintrayUser
key = project.bintrayKey
configurations = ['archives']
pkg {
repo = 'mobly'
name = ARTIFACT_ID
userOrg = 'google'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/google/mobly-snippet-lib.git'
version {
name = VERSION_NAME
desc = 'Mobly Snippet Lib ' + VERSION_NAME
released = new Date()
vcsTag = VERSION_NAME
}
}
}
|