-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.gradle
140 lines (117 loc) · 5.24 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
agp_version = "4.2.2"
kotlin_version = "1.8.0"
booster_version = "1.0.0-beta.6"
}
repositories {
mavenLocal()
// sonatype
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://oss.sonatype.org/content/repositories/public/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
mavenCentral()
google()
// aliyun maven
// mirror of google()
maven { url 'https://maven.aliyun.com/repository/google' }
// mirror of central & jcenter
maven { url 'https://maven.aliyun.com/repository/public' }
// mirror of gradlePluginPortal
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
// internal alibaba maven
maven {
allowInsecureProtocol = true
url 'http://mvnrepo.alibaba-inc.com/mvn/repository'
}
}
dependencies {
classpath "com.android.tools.build:gradle:${agp_version}"
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
classpath "io.github.aliyun-sls:android-gradle-plugin:$booster_version"
// classpath "com.didiglobal.booster:booster-transform-thread:$booster_version"
// classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
//apply plugin: 'io.github.gradle-nexus.publish-plugin'
//apply plugin: 'signing'
plugins {
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id 'com.android.library' version '4.2.2' apply false
}
allprojects { project ->
repositories {
mavenLocal()
// sonatype
// maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
// maven { url 'https://oss.sonatype.org/content/repositories/public/' }
// maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
mavenCentral()
google()
jcenter()
// aliyun maven
// mirror of google()
maven { url 'https://maven.aliyun.com/repository/google' }
// mirror of central & jcenter
maven { url 'https://maven.aliyun.com/repository/public' }
// mirror of gradlePluginPortal
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
// internal alibaba maven
maven { url 'http://mvnrepo.alibaba-inc.com/mvn/repository' }
}
}
HashMap getSonatypeUserAccount() {
HashMap accountMap = new HashMap()
def parsedSettingsXml
def settingsFile = "/home/admin/settings.xml"
def defaultSettingsFile = System.getProperty("user.home") + "/.m2/settings.xml"
println("============= getSonatypeUserAccount. settingsFile: ${settingsFile}, exists: ${file(settingsFile).exists()} ============= ")
println("============= getSonatypeUserAccount. defaultSettingsFile: ${defaultSettingsFile}, exists: ${file(defaultSettingsFile).exists()} ============= ")
if (file(settingsFile).exists() || file(defaultSettingsFile).exists()) {
if (file(settingsFile).exists()) {
println("============= getSonatypeUserAccount. settingsFile exists ============= ")
parsedSettingsXml = (new XmlParser()).parse(settingsFile);
} else if (file(defaultSettingsFile).exists()) {
println("============= getSonatypeUserAccount. defaultSettingsFile exists ============= ")
parsedSettingsXml = (new XmlParser()).parse(defaultSettingsFile);
}
//noinspection GroovyVariableNotAssigned
parsedSettingsXml.servers[0].server.each { server ->
if ("releases" == server.id.text()) {
accountMap.put("id", server.id.text())
accountMap.put("username", server.username.text())
accountMap.put("password", server.password.text())
}
}
} else {
accountMap.put("id", "releases")
accountMap.put("username", "admin")
accountMap.put("password", "screct")
}
println("============= getSonatypeUserAccount. username: ${accountMap.get("username")}, pswd: ${accountMap.get("password")} ============= ")
return accountMap
}
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") //注意地址
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
packageGroup = "io.github.aliyun-sls" //groupId,必填
def accountMap = getSonatypeUserAccount();
username = accountMap.get("username")
password = accountMap.get("password")
}
}
// useStaging.set(provider {
// project.nexusPublishing
// def release = publishing.publications.mavenPublication
// release.version.endsWith("-SNAPSHOT")
// val release: MavenPublication by publishing.publications
// release.version.endsWith("-SNAPSHOT")
// })
}
apply from: 'jacoco/project.gradle'