-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpublish.gradle
More file actions
76 lines (68 loc) · 3.06 KB
/
Copy pathpublish.gradle
File metadata and controls
76 lines (68 loc) · 3.06 KB
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
apply plugin: 'maven-publish' //https://docs.gradle.org/current/userguide/publishing_maven.html
apply plugin: 'com.jfrog.bintray' //https://github.com/bintray/gradle-bintray-plugin
def REPOSITORY_NAME = "android"
def LIBRARY_VERSION = "0.9.4"
def LIBRARY_GROUP_ID = "com.actonica.devmenu"
def SITE_URL = "https://gitlab.actonica.ru/Actonica/developermenu.android"
def GIT_URL = "https://gitlab.actonica.ru/Actonica/developermenu.android.git"
def DEVELOPER_ID = "actonica"
def LIBRARY_LICENSES = ["Apache-2.0"]
version = LIBRARY_VERSION
group = LIBRARY_GROUP_ID
project.afterEvaluate {
publishing {
publications {
ModuleArtifact(MavenPublication) {
artifact project.tasks.getByName("bundleReleaseAar") //aar
artifact project.tasks.getByName("androidSourcesJar") //sources
groupId LIBRARY_GROUP_ID
artifactId moduleArtifactId
version "$version"
//the POM file generated does not include the dependency chain so it must be explicitly added using this
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
bintray {
user = "$System.env.BINTRAY_USER"
key = "$System.env.BINTRAY_KEY"
configurations = ['archives']
publications = ['ModuleArtifact']
publish = true //Whether version should be auto published after an upload
pkg {
repo = REPOSITORY_NAME
name = moduleArtifactId
userOrg = DEVELOPER_ID
desc = moduleDescription
publicDownloadNumbers = true
licenses = LIBRARY_LICENSES
vcsUrl = GIT_URL
websiteUrl = SITE_URL
version {
name = this.version
desc = moduleDescription
//Date of the version release. Can accept one of the following formats: Date in the format of 'yyyy-MM-dd'T'HH:mm:ss.SSSZZ' java.util.Date instance
released = new Date()
vcsTag = this.version
}
}
}
}
//Archive java sources to jar
task('androidSourcesJar', type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
bintrayUpload.dependsOn(['assemble', 'androidSourcesJar', 'generatePomFileForModuleArtifactPublication'])