-
Notifications
You must be signed in to change notification settings - Fork 217
/
Copy pathbuild.gradle
186 lines (172 loc) · 6.51 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import groovy.xml.XmlUtil
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false // true by default
checkAllWarnings false
checkReleaseBuilds false
ignoreWarnings true // false by default
quiet true // false by default
}
}
dependencies {
compileOnly files('libs/classes.jar')
compileOnly rootProject.ext.libs.annotation
compileOnly rootProject.ext.libs.recyclerview
compileOnly rootProject.ext.libs.viewpager
compileOnly rootProject.ext.libs.design
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier.set('sources')
}
task javadoc(type: Javadoc) {
failOnError false
options.encoding = 'UTF-8'
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}
// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
install {
repositories.mavenInstaller {
pom {
project {
packaging 'aar'
name 'SmoothRefreshLayout-Core'
groupId rootProject.ext.bintray['groupId']
url rootProject.ext.bintray['siteUrl']
version rootProject.ext.bintray['libVersion']
artifactId 'srl-core'
description 'A highly efficient refresh library for Android, Can support all Views.'
licenses {
license {
name rootProject.ext.bintray['licenseName']
url rootProject.ext.bintray['licenseUrl']
}
}
developers {
developer {
id rootProject.ext.bintray['developerId']
name rootProject.ext.bintray['developerName']
email rootProject.ext.bintray['developerEmail']
}
}
scm {
connection rootProject.ext.bintray['gitUrl']
developerConnection rootProject.ext.bintray['gitUrl']
url rootProject.ext.bintray['siteUrl']
}
}
}
}
}
gradle.buildFinished { project ->
Thread.start {
def imlFile = file("../.idea/modules/core/SmoothRefreshLayout-master.core.iml")
println 'We need invoke the hidden api, so we must keep the custom jar in front of the android.jar'
try {
def parsedXml = (new XmlParser()).parse(imlFile)
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
def jdkName = jdkNode.attributes()['jdkName']
def jdkType = jdkNode.attributes()['jdkType']
parsedXml.component[1].remove(jdkNode)
new Node(parsedXml.component[1], 'orderEntry',
[
'type' : 'jdk',
'jdkName': jdkName,
'jdkType': jdkType
])
def text = XmlUtil.serialize(parsedXml)
imlFile.withWriter("UTF8") { writer ->
writer.write(text)
}
} catch (FileNotFoundException e) {
e.printStackTrace()
}
}
}
signing {
sign publishing.publications
}
publishing {
publications {
release(MavenPublication) {
groupId rootProject.ext.bintray['groupId']
artifactId 'srl-core'
version rootProject.ext.bintray['libVersion']
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact sourcesJar
artifact javadocJar
pom {
name = 'srl-core'
description = 'A highly efficient refresh library for Android, Can support all Views.'
url = rootProject.ext.bintray['siteUrl']
licenses {
license {
name = rootProject.ext.bintray['licenseName']
url = rootProject.ext.bintray['licenseUrl']
}
}
developers {
developer {
id = rootProject.ext.bintray['developerId']
name = rootProject.ext.bintray['developerName']
email = rootProject.ext.bintray['developerEmail']
}
}
scm {
connection = rootProject.ext.bintray['gitUrl']
developerConnection = rootProject.ext.bintray['gitUrl']
url = rootProject.ext.bintray['siteUrl']
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
project.configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
name = "sonatype"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
username = properties.getProperty("bintray.user")
password = properties.getProperty("bintray.key")
}
}
}
}