-
Notifications
You must be signed in to change notification settings - Fork 150
/
publish.gradle
105 lines (95 loc) · 3.65 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
apply plugin: 'maven'
apply plugin: 'signing'
def DEBUG = false
def VERSION = '1.5.1'
def GROUP = 'com.smallsoho.mobcase'
def ARTIFACT = 'McImage'
Properties properties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}
static def isSnapshot(def version) {
return version.endsWith("SNAPSHOT")
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
if (DEBUG) {
repository(url: uri("${buildDir}/libs"))
} else {
if (isSnapshot(VERSION)) {
repository(url: uri(properties.getProperty('MAVEN_SNAPSHOT_REPO'))) {
authentication(
userName: properties.getProperty('MAVEN_USER_NAME'),
password: properties.getProperty('MAVEN_PASSWORD')
)
}
} else {
repository(url: uri(properties.getProperty('MAVEN_RELEASE_REPO'))) {
authentication(
userName: properties.getProperty('MAVEN_USER_NAME'),
password: properties.getProperty('MAVEN_PASSWORD')
)
}
}
}
pom {
groupId = GROUP
artifactId = ARTIFACT
version = VERSION
project {
name = "McImage"
packaging = "aar"
description = "McImage is a Non-invasive plugin for compress all res in your project."
url = "https://github.com/smallSohoSolo/McImage"
scm {
connection "https://github.com/smallSohoSolo/McImage"
developerConnection "https://github.com/smallSohoSolo/McImage"
url "https://github.com/smallSohoSolo/McImage"
}
licenses {
license {
name "Apache-2.0 License"
url "https://github.com/smallSohoSolo/McImage/blob/master/LICENSE"
distribution "A permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code."
}
}
developers {
developer {
id "smallSohoSolo"
name "smallSohosolo"
}
}
}
}
}
}
}
afterEvaluate { project ->
if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}
artifacts {
archives androidSourcesJar
}
} else {
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
}
}
signing {
sign configurations.archives
}