-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
64 lines (58 loc) · 2 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
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
plugins {
id "com.github.spotbugs" version "1.6.1" apply true
id "com.github.dcendents.android-maven" version "2.0" apply false
id "com.jfrog.bintray" version "1.7.3" apply false
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
def mavenDependencies(pom, depsArr) {
return pom.withXml {
def root = asNode()
def dependenciesNode = root.dependencies
if (!dependenciesNode) dependenciesNode = root.appendNode('dependencies')
depsArr.each {
def (groupIdName, artifactIdName, ver) = it
addDependencyNodeToPom(dependenciesNode, null, groupIdName, artifactIdName, ver)
}
}
}
static def addDependencyNodeToPom(dependenciesNode, scope, group, artifact, version) {
def dependencyNode = dependenciesNode.appendNode('dependency')
if (scope) dependencyNode.appendNode("scope", scope)
dependencyNode.appendNode("groupId", group)
dependencyNode.appendNode("artifactId", artifact)
dependencyNode.appendNode("version", version)
}
def addAllProjectDependenciesToPom(pom, configurations) {
pom.withXml {
def root = asNode()
def dependenciesNode = root.dependencies
if (!dependenciesNode) dependenciesNode = root.appendNode('dependencies')
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included.
if (it.name != 'unspecified' && it.version != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}