forked from Meisolsson/GitHubSdk
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
104 lines (91 loc) · 3.81 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.novoda:bintray-release:0.8.0'
}
}
ext{
def versionMajor = 0
def versionMinor = 5
def versionPatch = 1
VERSION_NAME = "${versionMajor}.${versionMinor}.${versionPatch}"
VERSION_CODE = versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100
GROUP_NAME = "com.github.meisolsson"
ARTIFACT_ID = "githubsdk"
PROJECT_DESCRIPTION = 'A SDK for GitHub built with Retrofit, Auto Value and Moshi'
SITE_URL = 'https://github.com/Meisolsson/GitHubSdk'
GIT_URL = 'https://github.com/Meisolsson/GitHubSdk.git'
IS_UPLOADING = project.getGradle().startParameter.taskNames.any{it.contains('bintrayUpload')}
}
allprojects {
repositories {
jcenter()
google()
}
group = GROUP_NAME
version = VERSION_NAME
if (IS_UPLOADING && project.name in ['library']) {
println project.name
apply plugin: 'maven'
gradle.taskGraph.whenReady { taskGraph ->
taskGraph.getAllTasks().find {
it.path == ":$project.name:generatePomFileForReleasePublication"
}.doLast {
file("build/publications/release/pom-default.xml").delete()
pom {
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
if(it.name == 'unspecified')
return
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
dependencyNode.appendNode('scope', 'runtime')
}
}
//noinspection GroovyAssignabilityCheck
project {
name ARTIFACT_ID
description PROJECT_DESCRIPTION
url SITE_URL
inceptionYear 2016
packaging 'aar'
artifactId ARTIFACT_ID
version VERSION_NAME
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'olssonhenrik'
name 'Henrik Olsson'
email '[email protected]'
}
}
scm {
connection GIT_URL
developerConnection GIT_URL
url SITE_URL
}
}
}.writeTo("build/publications/release/pom-default.xml")
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}