-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.gradle
91 lines (82 loc) · 3.25 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
apply plugin: "maven-publish"
apply plugin: "signing"
// Because the components are created only during the afterEvaluate phase, you must
// configure your publications using the afterEvaluate() lifecycle method.
afterEvaluate {
task sourceJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier.set("sources")
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
// https://docs.gradle.org/current/userguide/publishing_maven.html
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// The default Maven POM identifying attributes are mapped as follows:
// groupId - project.group
// artifactId - project.name
// version - project.version
from components.java
artifact sourceJar
artifact javadocJar
pom {
name = 'muddy-plugin'
description = 'Muddy is an Android Plugin for simple encryption of string constants in android project.'
url = 'https://github.com/porum/Muddy'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'porum'
name = 'guobao.sun'
email = 'sunguobao12@gmail.com'
}
}
scm {
url = "https://github.com/porum/Muddy.git"
}
// if (project.name == "muddy-gradle-plugin") {
// withXml {
// def projectNode = asNode()
// def depsNode = projectNode.appendNode("dependencies")
// def depNode = depsNode.appendNode("dependency")
// depNode.appendNode("groupId", project.group)
// depNode.appendNode("artifactId", "muddy")
// depNode.appendNode("version", project.version)
// depNode.appendNode("scope", "compile")
// }
// }
}
}
}
repositories {
maven {
if (VERSION.endsWith("-SNAPSHOT")) {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
} else {
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials {
username sonatypeUserName
password sonatypePassword
}
}
}
}
signing {
sign publishing.publications.release
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
}