-
Notifications
You must be signed in to change notification settings - Fork 7
/
task_deploy_to_maven.gradle
175 lines (149 loc) · 6.81 KB
/
task_deploy_to_maven.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
/*
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
*
* A copy of the MIT License is included in this file.
*
*
* Terms of the MIT License:
* ---------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
apply plugin: "maven-publish"
apply plugin: "signing"
task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
from sourceSets.main.kotlin
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}
javadoc {
description = "javadoc for git-checkout"
options.memberLevel = JavadocMemberLevel.PROTECTED
options.author = true
options.version = true
options.header = project.name
// 不检查:非标的javadoc注解不报错
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption("charset", "UTF-8")
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO
options.encoding = "UTF-8"
options.charSet = "UTF-8"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar
artifact javadocJar
pom {
name = "git-checkout-core"
description = "Tencent blueking git checkout core project"
url = "https://github.com/TencentBlueKing/ci-git-checkout.git"
licenses {
license {
name = "MIT"
url = "https://github.com/TencentBlueKing/ci-git-checkout/blob/master/LICENSE.txt"
distribution = "repo"
comments = "A business-friendly OSS license"
}
}
developers {
developer {
name = "bk-ci"
email = "[email protected]"
roles = ["Manager"]
url = "https://bk.tencent.com"
}
}
scm {
url = "https://github.com/TencentBlueKing/ci-git-checkout.git"
connection = "scm:git:https://github.com/TencentBlueKing/ci-git-checkout.git"
developerConnection = "scm:git:[email protected]:TencentBlueKing/ci-git-checkout.git"
}
}
}
}
repositories {
maven {
name "oss"
def mavenRepoDeployUrl = System.getProperty("mavenRepoDeployUrl")
def mavenRepoUsername = System.getProperty("mavenRepoUsername")
def mavenRepoPassword = System.getProperty("mavenRepoPassword")
if (mavenRepoDeployUrl == null) {
mavenRepoDeployUrl = System.getenv("build_mavenRepoDeployUrl")
}
if (mavenRepoUsername == null) {
mavenRepoUsername = System.getenv("build_mavenRepoUsername")
}
if (mavenRepoPassword == null) {
mavenRepoPassword = System.getenv("build_mavenRepoPassword")
}
if (mavenRepoDeployUrl == null) {
mavenRepoDeployUrl = MAVEN_REPO_DEPLOY_URL
}
if (mavenRepoUsername == null) {
mavenRepoUsername = MAVEN_REPO_USERNAME
}
if (mavenRepoPassword == null) {
mavenRepoPassword = MAVEN_REPO_PASSWORD
}
def snapshotMavenRepoDeployUrl = System.getProperty("snapshotMavenRepoDeployUrl")
def snapshotMavenRepoUsername = System.getProperty("snapshotMavenRepoUsername")
def snapshotMavenRepoPassword = System.getProperty("snapshotMavenRepoPassword")
if (snapshotMavenRepoDeployUrl == null) {
snapshotMavenRepoDeployUrl = System.getenv("build_snapshotMavenRepoDeployUrl")
}
if (snapshotMavenRepoUsername == null) {
snapshotMavenRepoUsername = System.getenv("build_snapshotMavenRepoUsername")
}
if (snapshotMavenRepoPassword == null) {
snapshotMavenRepoPassword = System.getenv("build_snapshotMavenRepoPassword")
}
if (mavenRepoDeployUrl == null) {
mavenRepoDeployUrl = MAVEN_REPO_SNAPSHOT_DEPLOY_URL
}
if (snapshotMavenRepoUsername == null) {
snapshotMavenRepoUsername = MAVEN_REPO_SNAPSHOT_USERNAME
}
if (snapshotMavenRepoPassword == null) {
snapshotMavenRepoPassword = MAVEN_REPO_SNAPSHOT_PASSWORD
}
url = System.getProperty("snapshot") == "true" ? snapshotMavenRepoDeployUrl : mavenRepoDeployUrl
println(url)
credentials {
username = System.getProperty("snapshot") == "true" ? snapshotMavenRepoUsername : mavenRepoUsername
password = System.getProperty("snapshot") == "true" ? snapshotMavenRepoPassword : mavenRepoPassword
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
publish.onlyIf { !sourceSets.main.allSource.files.isEmpty() }
generateMetadataFileForMavenJavaPublication.onlyIf { !sourceSets.main.allSource.files.isEmpty() }
generatePomFileForMavenJavaPublication.onlyIf { !sourceSets.main.allSource.files.isEmpty() }
publishMavenJavaPublicationToOssRepository.onlyIf { !sourceSets.main.allSource.files.isEmpty() }
publishMavenJavaPublicationToMavenLocal.onlyIf { !sourceSets.main.allSource.files.isEmpty() }
publishToMavenLocal.onlyIf { !sourceSets.main.allSource.files.isEmpty() }
signMavenJavaPublication.onlyIf { !sourceSets.main.allSource.files.isEmpty() }