-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
112 lines (99 loc) · 2.6 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
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
allprojects {
ext {
shortVersion = '0.0.3'
isSnapshot = true
gitCommit = getGitCommit()
buildDate = getDatestamp()
sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
isReleaseVersion = !isSnapshot
signingRequired = isReleaseVersion
sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
}
group = 'eu.geekplace.iesp'
version = shortVersion
if (isSnapshot) {
version += '-SNAPSHOT'
}
}
subprojects {
apply plugin: 'maven'
apply plugin: 'signing'
uploadArchives {
repositories {
mavenDeployer {
if (signingRequired) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: project.sonatypeStagingUrl) {
if (sonatypeCredentialsAvailable) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
snapshotRepository(url: project.sonatypeSnapshotUrl) {
if (sonatypeCredentialsAvailable) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
pom.project {
name 'IESP'
description 'Android library to import/export SharedPreferences'
url 'http://iesp.geekplace.eu'
scm {
url 'https://github.com/flowdalic/iesp'
connection 'scm:git@github.com:flowdalic/iesp.git'
developerConnection 'scm:git@github.com:flowdalic/iesp.git'
}
licenses {
license {
name 'The MIT license (MIT)'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
developers {
developer {
id 'flow'
name 'Florian Schmaus'
}
}
}
}
}
}
signing {
useGpgCmd()
required { signingRequired }
sign configurations.archives
}
}
def getGitCommit() {
def dotGit = new File("$projectDir/.git")
if (!dotGit.isDirectory()) return 'non-git build'
def cmd = 'git describe --tags --dirty=+'
def proc = cmd.execute()
def gitCommit = proc.text.trim()
if (gitCommit.isEmpty()) {
cmd = 'git rev-parse HEAD'
proc = cmd.execute()
gitCommit = proc.text.trim()
}
assert !gitCommit.isEmpty()
gitCommit
}
// Returns only the date in yyyy-MM-dd format, as otherwise, with
// hh:mm:ss information, the manifest files would change with every
// build, causing unnecessary rebuilds.
def getDatestamp() {
def date = new Date()
return date.format('yyyy-MM-dd')
}