/
build.gradle
145 lines (128 loc) · 4.59 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
plugins {
id "com.jfrog.bintray" version "1.7"
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
packagingOptions {
exclude 'error_prone/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}
}
configurations {
doclava
}
ext {
appCompatVersion = '27.1.1'
playServicesVersion = '12.0.0'
supportTestVersion = '1.0.1'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$appCompatVersion"
implementation "com.android.support:leanback-v17:$appCompatVersion"
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.2.1'
implementation "com.google.android.gms:play-services-ads:$playServicesVersion"
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.8.9'
testImplementation "org.robolectric:robolectric:3.8"
androidTestImplementation "com.android.support:support-annotations:$appCompatVersion"
androidTestImplementation "com.android.support.test:runner:$supportTestVersion"
androidTestImplementation "com.android.support.test:rules:$supportTestVersion"
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
doclava 'com.google.doclava:doclava:1.0.6'
}
/* Library release process:
*
* 1. Change package version
* 2. Run the following gradle commands in this order:
* generatePomFileForLibraryPublishPublication
* publishLibraryPublishPublicationToMavenLocal
* bintrayUpload
*/
def packageVersion = '0.4.1'
task sourceJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc, dependsOn: project.configurations.doclava) {
failOnError = false
title = null
source = android.sourceSets.main.java.srcDirs
options.doclet = "com.google.doclava.Doclava"
options.docletpath = configurations.doclava.files.asType(List)
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
afterEvaluate {
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
})
}
publishing {
publications {
libraryPublish(MavenPublication) {
groupId 'com.google.android.libraries.tv'
artifactId 'companionlibrary'
version packageVersion
artifacts = configurations.archives.artifacts
artifact sourceJar
artifact javadocJar
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.compile.allDependencies.each {
if(it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null)
{
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
// Optionally load keystore
if (file("$rootProject/keystore.properties").exists()) {
def keystorePropertiesFile = rootProject.file("keystore.properties");
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
bintray {
user = keystoreProperties['BINTRAY_USER']
key = keystoreProperties['BINTRAY_API_KEY']
publications = ['libraryPublish']
publish = true
pkg {
repo = 'tif-companion'
name = 'tif-companion'
userOrg = 'google'
version {
name = packageVersion
gpg {
sign = true
}
}
}
}
} else {
println "Warning: keystore file does not exist. Library revision cannot be published."
}