-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.gradle
More file actions
203 lines (176 loc) · 5.88 KB
/
build.gradle
File metadata and controls
203 lines (176 loc) · 5.88 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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
def loadProperties(String sourceFileName) {
def config = new Properties()
def propFile = new File(sourceFileName)
System.err.println("Loading property file: " + propFile.absolutePath)
if (propFile.canRead()) {
config.load(new FileInputStream(propFile))
for (Map.Entry property in config) {
System.out.println("setting " + property.key)
project.ext[property.key] = property.value
}
}
}
loadProperties("$rootDir/local.properties")
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://oss.sonatype.org/service/local/repositories/releases/content/' }
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://oss.sonatype.org/service/local/repositories/releases/content/' }
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
project(':android') {
apply plugin: 'com.android.library'
android {
compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 21
//noinspection OldTargetApi
targetSdkVersion 34
versionCode 200
versionName "${versionCode}"
multiDexEnabled true
}
lintOptions {
abortOnError false
disable "ResourceType"
warning 'NewApi', 'OnClick', 'EllipsizeMaxLines'
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
}
debug {
minifyEnabled false
shrinkResources false
}
}
}
}
configure(subprojects - project(':android')) {
apply plugin: 'java-library'
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
tasks.register('sourcesJar', Jar) {
dependsOn classes
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar
archives sourcesJar
}
}
subprojects {
version = "14.0.0_r2"
apply plugin: 'maven-publish'
publishing {
publications {
sonatype(MavenPublication) {
def isAndroid = false
if (project.name == "android") {
isAndroid = true
}
if (!isAndroid) {
from components.java
artifact sourcesJar
artifact javadocJar
}
afterEvaluate {
if (isAndroid) {
from components.release
}
groupId "com.rover12421.android.hide"
artifactId project.name
}
pom {
name = project.name
description = "Android Hidden API / $project.name"
url = 'https://shaka.rover.plus'
if (isAndroid) {
packaging = 'aar'
} else {
packaging = 'jar'
}
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/mit-license.php'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/rover12421/AndroidHideApi/tree/master'
connection = 'scm:git:git://github.com/rover12421/AndroidHideApi.git'
developerConnection = 'scm:git:git@github.com:rover12421/AndroidHideApi.git'
}
developers {
developer {
id = 'rover12421'
name = 'Rover12421'
email = 'rover12421@163.com'
}
}
}
}
}
repositories {
maven {
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username "${sonatypeUsername}"
password "${sonatypePassword}"
}
}
}
}
apply plugin: 'signing'
signing {
sign publishing.publications.sonatype
}
}
configure(subprojects - project(':android')) {
tasks.register('replace_jar') {
doLast {
def from = "${project.projectDir}/libs/classes.jar"
def des = "${project.buildDir}/libs/${project.name}-${project.version}.jar"
println "replace_jar : ${from}"
Files.copy(Paths.get(from), Paths.get(des), StandardCopyOption.REPLACE_EXISTING)
}
}
generatePomFileForSonatypePublication.dependsOn replace_jar
}