-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathbuild.gradle
More file actions
107 lines (93 loc) · 2.96 KB
/
build.gradle
File metadata and controls
107 lines (93 loc) · 2.96 KB
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
import proguard.gradle.ProGuardTask
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
sourceCompatibility = 1.8
targetCompatibility = 1.8
buildscript {
ext {
lintVersion = '30.1.3'
}
repositories {
mavenCentral()
google()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.android.tools.build:gradle:$gradle_version"
classpath 'com.guardsquare:proguard-gradle:7.3.0'
}
}
repositories {
google()
maven {
url "https://mvnrepository.com/artifact/com.android.tools.lint/lint-tests"
}
}
configurations {
lintBuild
lintJar
}
dependencies {
lintBuild files(jar)
lintJar files('libs/mparticle-min.jar')
lintJar project(':tooling:common')
implementation configurations.lintJar
compileOnly "com.android.tools.lint:lint-api:$lintVersion"
compileOnly "com.android.tools.lint:lint-checks:$lintVersion"
compileOnly 'org.codehaus.groovy:groovy-all:3.0.17'
testImplementation 'junit:junit:4.13.2'
testImplementation "com.android.tools.lint:lint:$lintVersion"
testImplementation "com.android.tools.lint:lint-tests:$lintVersion"
testImplementation "com.android.tools:testutils:$lintVersion"
}
jar {
dependsOn(":tooling:common:jar")
archiveName 'lint.jar'
manifest {
attributes 'Manifest-Version': 1.0
attributes 'Lint-Registry-v2': 'com.mparticle.lints.MParticleIssueRegistry'
attributes 'Lint-Registry': 'com.mparticle.lints.MParticleIssueRegistry'
}
from {
configurations.lintJar.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
def targetBuildType = "release"
rootProject.project('android-core').android.buildTypes.all {
def theBuildType = it.name
if (rootProject.project('android-core').tasks.findByName("compile${theBuildType.capitalize()}JavaWithJavac")) {
targetBuildType = theBuildType
}
}
task zipSources(type: Jar) {
def fileName = "$project.rootDir/android-core/build/intermediates/javac/${targetBuildType}/classes"
from(fileTree(dir: fileName)) {
destinationDir new File("$project.projectDir/libs")
archiveName "mparticle.jar"
}
outputs.upToDateWhen { false }
}
task proguardCore(type: ProGuardTask) {
configuration 'mparticle-core-proguard.pro'
injars 'libs/mparticle.jar'
outjars 'libs/mparticle-min.jar'
}
afterEvaluate {
compileKotlin.dependsOn proguardCore
proguardCore.dependsOn zipSources
zipSources.dependsOn ":android-core:compile${targetBuildType.capitalize()}JavaWithJavac"
}
task cleanTempLibraries {
File baseMParticle = file('libs/mparticle.jar')
File minifiedMParticle = file('libs/mparticle-min.jar')
if (baseMParticle.exists()) {
baseMParticle.delete()
}
if (minifiedMParticle.exists()) {
minifiedMParticle.delete()
}
}
project.tasks.findByName("clean").dependsOn cleanTempLibraries