forked from mozilla-mobile/android-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle
76 lines (63 loc) · 2.55 KB
/
publish.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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
def libRepoName = properties.libRepositoryName
def libUrl = properties.libUrl
def libVcsUrl = properties.libVcsUrl
def libLicense = properties.libLicense
def libLicenseUrl = properties.libLicenseUrl
// Must match the implementation in components/tooling/glean-gradle-plugin/build.gradle
static def getLocalPublicationTimestamp() {
def date = new Date()
return date.format('yyyyMMddHHmmss')
}
ext.configurePublish = { groupIdArg, artifactIdArg, descriptionArg ->
apply plugin: 'digital.wup.android-maven-publish'
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
publishing {
publications {
aar(MavenPublication) {
from components.android
artifact sourcesJar
pom {
groupId = groupIdArg
artifactId = artifactIdArg
description = descriptionArg
// 'local' is for streamlining local publication workflow.
version = config.componentsVersion + (project.hasProperty('snapshot') ? '-SNAPSHOT' : (project.hasProperty('local') ? '-local' + getLocalPublicationTimestamp() : ''))
licenses {
license {
name = libLicense
url = libLicenseUrl
}
}
developers {
developer {
name = 'Mozilla Android Components Team'
email = '[email protected]'
}
}
scm {
connection = libVcsUrl
developerConnection = libVcsUrl
url = libUrl
}
}
}
}
repositories {
maven {
url = "$buildDir/maven"
}
}
}
task renameSnapshotArtifacts(type: Exec) {
dependsOn publish
def renameScript = "${rootDir}/automation/taskcluster/rename_snapshot_artifacts.py"
def mavenBuildDir = "${project.buildDir}/maven"
commandLine 'python', renameScript, '--path', mavenBuildDir, '--timestamp', (project.hasProperty('timestamp') ? timestamp : '')
}
}