This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
181 lines (146 loc) · 5.38 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-3'
repositories {
jcenter()
mavenCentral()
maven {
url = 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
//TODO https://github.com/Kotlin/dokka/issues/140
classpath 'org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.14-eap-3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
//copy core classes to the project gen folder
def includeCoreClasses = { Project p ->
p.android.libraryVariants.all { variant ->
def outputDir = p.file("$p.buildDir/generated/core/${variant.dirName}")
def packageName = variant.generateBuildConfig.appPackageName
def mergeTask = p.tasks.create(name: "merge${variant.name.capitalize()}CoreClasses", type: Copy) {
from(project(':core').android.sourceSets.main.java.srcDirs) {
filter { String line ->
if (line == 'package ru.solodovnikov.rxlocationmanager') {
"package $packageName"
} else {
line
}
}
eachFile {
path = "${packageName.replaceAll('\\.', '/')}/$name"
}
}
into outputDir
}
variant.registerJavaGeneratingTask mergeTask, outputDir
}
}
project(':core') {
apply from: '../base_project.gradle'
}
project(':rxlocationmanager-rxjava2') {
apply from: '../base_project.gradle'
apply from: '../coverage.gradle'
apply from: '../publish.gradle'
lib_name = 'Rx2LocationManager'
lib_description = 'Android library that helps to get location using standart LocationManager and RxJava2'
dependencies {
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
}
includeCoreClasses(it)
}
project(':rxlocationmanager') {
apply from: '../base_project.gradle'
apply from: '../coverage.gradle'
apply from: '../publish.gradle'
lib_name = 'RxLocationManager'
lib_description = 'Android library that helps to get location using standart LocationManager and RxJava'
dependencies {
compile 'io.reactivex:rxjava:1.3.0'
compile 'io.reactivex:rxandroid:1.2.1'
}
includeCoreClasses(it)
}
subprojects {
if (name.contains('sample')) {
prepareSample(it)
}
}
def prepareSample(Project p) {
def isKotlinSample = p.name.contains('kotlin')
def isRxJava2Sample = p.name.contains('rxjava2')
p.apply plugin: 'com.android.application'
if (isKotlinSample) {
p.apply plugin: 'kotlin-android'
}
p.android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "ru.solodovnikov.rxlocationmanager.sample"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
if (isKotlinSample) {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
}
p.dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
if (isKotlinSample) {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
if (isRxJava2Sample) {
compile project(':rxlocationmanager-rxjava2')
} else {
compile project(':rxlocationmanager')
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
def reportingSubprojects = [project(':rxlocationmanager-rxjava2'), project(':rxlocationmanager')]
apply plugin: 'jacoco'
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports', description: 'Generates an aggregate report from all subprojects') {
dependsOn = reportingSubprojects.jacocoTestReport
classDirectories = files(reportingSubprojects.jacocoTestReport.classDirectories)
additionalSourceDirs = files(reportingSubprojects.jacocoTestReport.additionalSourceDirs)
sourceDirectories = files(reportingSubprojects.jacocoTestReport.additionalSourceDirs)
executionData = files(reportingSubprojects.jacocoTestReport.executionData)
reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
}
apply plugin: 'com.github.kt3k.coveralls'
coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
sourceDirs = reportingSubprojects.android.sourceSets.main.java.srcDirs.flatten()
}