forked from konrad-jamrozik/droidmate
-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
196 lines (167 loc) · 6.18 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import java.nio.file.Files
import java.nio.file.Paths
// DroidMate, an automated execution generator for Android apps.
// Copyright (C) 2012-2018. Saarland University
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Current Maintainers:
// Nataniel Borges Jr. <nataniel dot borges at cispa dot saarland>
// Jenny Hotzkow <jenny dot hotzkow at cispa dot saarland>
//
buildscript {
repositories {
mavenCentral()
jcenter()
}
apply from: file("${rootProject.projectDir}/versions.gradle") // contains kotlin_version
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.kotlin_version}"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' // for jitpack gradle support?
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
}
}
apply plugin: 'com.github.johnrengelman.shadow'
apply from: file("${rootProject.projectDir}/versions.gradle")
wrapper{
gradleVersion = '5.6.4' //define what gradle wrapper version is to be used on wrapper initialization (only if there is no wrapper yet or 'gradlew wrapper' is called)
}
allprojects {
group = "org.droidmate"
version = "2.1.2"
/* Merge all the build directories into one. */
// buildDir = rootProject.file('build') //TODO that means the apk/class paths are changing
repositories {
maven { url = "https://soot-build.cs.upb.de/nexus/repository/soot-release/" }
maven { url = "https://soot-build.cs.upb.de/nexus/repository/soot-snapshot/" }
maven { url = 'https://jitpack.io' }
jcenter()
mavenCentral()
mavenLocal()
}
apply from: file("${rootProject.projectDir}/versions.gradle")
/* this is necessary as long as we do not publish the library into its own repository, since the CI server does not seam to support composite builds but only multi-project hierarchies */
configurations.all {
resolutionStrategy{
// force certain versions of dependencies (including transitive)
// *append new forced modules as comma separated strings
// force dmDriverLib
// cache dynamic versions for 10 minutes
dependencySubstitution {
def targetProject = findProject(":deviceDaemonLib")
if (targetProject != null) {
def substitution = substitute module("com.github.hotzkow:platformInterfaceLib") with project(":deviceDaemonLib")
if(substitution != null) {
// println "use composite build directory (deviceLib) instead of artifact from server"
substitution because "use local git submodule for development instead of external dependency"
}
}
if(findProject(":explorationModel") != null) {
// println "use composite build directory (explorationModel) instead of artifact from server"
substitute module("com.github.hotzkow:explorationModel") with project(":explorationModel")
}
}
cacheDynamicVersionsFor 10*60, 'seconds'
// don't cache changing modules at all
cacheChangingModulesFor 0, 'seconds'
}
}
}
apply from: file("project/log.gradle")
apply from: file("project/functions.gradle")
project.ext { // direct child projects would be childProjects
pcJvmTargets = subprojects.find() { it.name == 'pcComponents' }.subprojects
artifactModules = allprojects.findAll {
it.name in [ "droidmate-2", "core", "exploration", // internal artifacts
"deviceDaemonLib", "explorationModel" ] // external for platform independency
}
}
task Debug {
println("determine release artifacts")
println(artifactModules)
}
configure(artifactModules){
apply plugin: 'maven'
apply plugin: 'java'
task sourcesJar(type: Jar, dependsOn: "classes") {
classifier = 'sources'
from sourceSets.main.allJava
from sourceSets.main.allSource
from sourceSets.test.allSource
}
artifacts {
archives sourcesJar
}
}
configure(pcJvmTargets) {
apply from: file("${rootProject.projectDir}/versions.gradle")
apply plugin: "kotlin"
compileKotlin {
sourceCompatibility = project.ext.javaVersion
targetCompatibility = project.ext.javaVersion
kotlinOptions {
jvmTarget = project.ext.javaVersion
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation "org.jetbrains.kotlin:kotlin-reflect"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${project.ext.coroutines_version}"
implementation 'org.slf4j:slf4j-api:1.7.25'
}
}
apply plugin: 'application'
mainClassName = "org.droidmate.api.ExplorationAPI"
// Run by ':project:run'
(tasks.run as JavaExec).configure {
sourceSets.main.runtimeClasspath = classpath
workingDir rootDir
def argsFile = Paths.get("$rootDir/args.txt")
if (Files.exists(argsFile))
{
List<String> appArgs = argsFile.text.readLines().first().split(" ") as List<String>
args appArgs
}
}
apply plugin: "kotlin"
dependencies {
compile project(":project:pcComponents:core")
}
jar {
manifest {
attributes 'Main-Class': "org.droidmate.api.ExplorationAPI"
}
}
// include all dependencies (resolvedArtifacts) in publishing (i.e. for publishToMavenLocal)
apply plugin: 'maven-publish' //FIXME no longer working
task resolveDependencies{ doFirst {
configurations.compile.resolvedConfiguration.resolvedArtifacts.eachWithIndex { resolvedArtifact, n ->
println "artifact: ${resolvedArtifact.name}"
if (resolvedArtifact.name != "all")
project.publishing {
publications {
println ".m2 publish: $resolvedArtifact"
"mavenArtifact${resolvedArtifact.name}${n}"(MavenPublication) {
artifact(resolvedArtifact.file) {
groupId = resolvedArtifact.moduleVersion.id.group
artifactId = resolvedArtifact.moduleVersion.id.name
version = resolvedArtifact.moduleVersion.id.version
classifier = resolvedArtifact.classifier
}
}
}
}
}
}}
publish.dependsOn(resolveDependencies)