-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathbuild.gradle
More file actions
129 lines (116 loc) · 4.62 KB
/
build.gradle
File metadata and controls
129 lines (116 loc) · 4.62 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
plugins {
id 'application'
id 'maven-publish'
id 'signing'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.dokka' version '1.8.20'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
mainClassName = 'com.linkedin.dex.parser.DexParser'
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier = 'javadoc'
from dokkaJavadoc.outputDirectory
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
repositories {
mavenCentral()
}
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "com.github.ajalt.clikt:clikt:3.5.2"
testImplementation 'junit:junit:4.13.2'
}
task testParsing(dependsOn: ':test-app:assembleDebugAndroidTest', type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = 'com.linkedin.dex.parser.DexParser'
args "${rootProject.project('test-app').buildDir}/outputs/apk/androidTest/debug/test-app-debug-androidTest.apk", "$buildDir", "-A", "com.linkedin.parser.test.junit4.java.NonInheritedAnnotation"
doLast {
def validTests = file('ValidTestList.txt').readLines()
def parsedTests = file("$buildDir/AllTests.txt").readLines()
if (validTests != parsedTests) {
throw new GradleException("Parsed tests do not match expected tests: " + parsedTests)
}
}
}
check.dependsOn testParsing
// Configure the jvm tests so that apk will be present and in a consistent location
// When you run from the IDE, the working directory is different than when running through gradle
// To make sure we can run tests from either the IDE or gradle directly, we set it to be the same as IDE settings
// We also need to make sure the test apk is generated as part of the compile task, so the tests have their
// dependencies fulfilled
testClasses.dependsOn ':test-app:assembleDebugAndroidTest'
test {
workingDir project.getRootProject().getProjectDir()
}
publishing {
publications {
maven(MavenPublication) { publication ->
from components.java
artifact(shadowJar) {
classifier "fat"
}
// It would be nice to be able to use withJavadocJar() instead of defining the artifact
// manually, but Gradle doesn't expose a way to customize what task generates the
// javadoc and we need to use Dokka for Kotlin code.
artifact(javadocJar) {
classifier = 'javadoc'
}
pom {
name = 'Dex Test Parser'
description = 'Find all test methods in an Android instrumentation APK'
url = 'https://github.com/linkedin/dex-test-parser'
licenses {
license {
name = 'BSD 2-Clause License'
url = 'https://opensource.org/licenses/BSD-2-Clause'
}
}
developers {
developer {
id = 'com.linkedin'
name = 'LinkedIn Corp'
}
}
scm {
connection = 'scm:git:git://github.com/linkedin/dex-test-parser.git'
developerConnection = 'scm:git:ssh://github.com:linkedin/dex-test-parser.git'
url = 'https://github.com/linkedin/dex-test-parser/tree/main'
}
}
}
}
repositories {
def sonatypeUsername = System.getenv("SONATYPE_USER")
def sonatypePassword = System.getenv("SONATYPE_PASSWORD")
maven {
name = "sonatypeSnapshot"
url = "https://oss.sonatype.org/content/repositories/snapshots"
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
maven {
name = "mavenCentral"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}
// DEX_TEST_PARSER_GPG_PRIVATE_KEY should contain the armoured private key that
// starts with -----BEGIN PGP PRIVATE KEY BLOCK-----
// It can be obtained with gpg --armour --export-secret-keys KEY_ID
def signingKey = System.getenv("DEX_TEST_PARSER_GPG_PRIVATE_KEY")
def signingPassword = System.getenv("DEX_TEST_PARSER_GPG_PRIVATE_KEY_PASSWORD")
signing {
required { signingKey != null && signingPassword != null }
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}