Skip to content

Commit a9bb9c1

Browse files
authored
Merge pull request #28 from hejieehe/feat_6
feat: 增加Gitee和TSvn服务提供者 #6
2 parents 6c30bcc + 30a6ec0 commit a9bb9c1

File tree

456 files changed

+18125
-8167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

456 files changed

+18125
-8167
lines changed

.github/workflows/publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: |
4949
echo "GITHUB_REF=${GITHUB_REF}"
5050
chmod +x ./gradlew
51-
./gradlew clean publish closeSonatypeStagingRepository \
51+
./gradlew clean publishToSonatype closeSonatypeStagingRepository \
5252
-Dorg.gradle.parallel=false \
5353
-Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} \
5454
-Psigning.password='${{ secrets.SIGNING_PASSWORD }}' \

.github/workflows/publish-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: |
5050
echo "GITHUB_REF=${GITHUB_REF}"
5151
chmod +x ./gradlew
52-
./gradlew clean publish -Dsnapshot=true \
52+
./gradlew clean publishToSonatype -Dsnapshot=true \
5353
-Dorg.gradle.parallel=false \
5454
-Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} \
5555
-Psigning.password='${{ secrets.SIGNING_PASSWORD }}' \

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@
2020
##### 2025-05-20
2121
### 修复
2222
- bug: 增加异常错误码 #21 [链接](https://github.com/bkdevops-projects/devops-scm/issues/21)
23+
24+
25+
# 1.1.0
26+
##### 2025-04-20
27+
### 新增
28+
- feat: 增加Gitee和TSvn服务提供者 #6 [链接](https://github.com/bkdevops-projects/devops-scm/issues/6)

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ devops-scm提供了一套统一的源代码接口,使得开发者能够方便
1111
- devops-scm-sample: 使用示例
1212
- devops-scm-test: 测试工具类
1313

14+
[详情介绍](./doc/PROJECT_STRUCTURE.md)
15+
1416
## 快速开始
1517
### 引包
1618
- Maven: pom.xml
@@ -112,6 +114,11 @@ devops-scm提供了一套统一的源代码接口,使得开发者能够方便
112114
[CHANGELOG](CHANGELOG.md)
113115

114116
## 新增源码管理平台
117+
- [从零开始接入源码管理平台](./doc/ADD_PROVIDER.md)
118+
119+
120+
- [已有sdk,补充适配模块](./doc/ADD_PROVIDER_SIMPLIFICATION.md)
121+
115122

116123
## Contributing
117124
- [腾讯开源激励计划](https://opensource.tencent.com/contribution) 鼓励开发者的参与和贡献,期待你的加入

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,10 @@ subprojects {
102102
configFile = file("${rootDir}/config/checkstyle/tencent_checkstyle.xml")
103103
}
104104
}
105+
106+
// gitee 演示项目仅供参考,不参与打包等任务
107+
project("devops-scm-provider:devops-scm-provider-git:devops-scm-provider-gitee-simple") {
108+
tasks.all {
109+
enabled = false
110+
}
111+
}

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
object Release {
22
const val Group = "com.tencent.bk.devops.scm"
3-
const val Version = "1.0.3"
3+
const val Version = "1.1.0"
44
}
55

66
object Versions {
Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,18 @@
1+
import util.MavenUtil
2+
13
plugins {
24
id("io.github.gradle-nexus.publish-plugin")
35
}
46

57
nexusPublishing {
68
repositories {
7-
sonatype {
8-
// 正式包
9-
var mavenRepoDeployUrl = System.getProperty("mavenRepoDeployUrl")
10-
var mavenRepoUsername = System.getProperty("mavenRepoUsername")
11-
var mavenRepoPassword = System.getProperty("mavenRepoPassword")
12-
13-
if (mavenRepoDeployUrl == null) {
14-
mavenRepoDeployUrl = System.getenv("build_mavenRepoDeployUrl")
15-
}
16-
17-
if (mavenRepoUsername == null) {
18-
mavenRepoUsername = System.getenv("build_mavenRepoUsername")
19-
}
20-
21-
if (mavenRepoPassword == null) {
22-
mavenRepoPassword = System.getenv("build_mavenRepoPassword")
23-
}
24-
25-
if (mavenRepoDeployUrl == null) {
26-
mavenRepoDeployUrl = project.extra["MAVEN_REPO_DEPLOY_URL"]?.toString()
27-
}
28-
29-
if (mavenRepoUsername == null) {
30-
mavenRepoUsername = project.extra["MAVEN_REPO_USERNAME"]?.toString()
31-
}
32-
33-
if (mavenRepoPassword == null) {
34-
mavenRepoPassword = project.extra["MAVEN_REPO_PASSWORD"]?.toString()
35-
}
369

37-
// 快照包
38-
var snapshotMavenRepoDeployUrl = System.getProperty("snapshotMavenRepoDeployUrl")
39-
var snapshotMavenRepoUsername = System.getProperty("snapshotMavenRepoUsername")
40-
var snapshotMavenRepoPassword = System.getProperty("snapshotMavenRepoPassword")
41-
42-
if (snapshotMavenRepoDeployUrl == null) {
43-
snapshotMavenRepoDeployUrl = System.getenv("build_snapshotMavenRepoDeployUrl")
44-
}
45-
46-
if (snapshotMavenRepoUsername == null) {
47-
snapshotMavenRepoUsername = System.getenv("build_snapshotMavenRepoUsername")
48-
}
49-
50-
if (snapshotMavenRepoPassword == null) {
51-
snapshotMavenRepoPassword = System.getenv("build_snapshotMavenRepoPassword")
52-
}
53-
54-
if (snapshotMavenRepoDeployUrl == null) {
55-
snapshotMavenRepoDeployUrl = project.extra["MAVEN_REPO_SNAPSHOT_DEPLOY_URL"]?.toString()
56-
}
57-
58-
if (snapshotMavenRepoUsername == null) {
59-
snapshotMavenRepoUsername = project.extra["MAVEN_REPO_SNAPSHOT_USERNAME"]?.toString()
60-
}
61-
62-
if (snapshotMavenRepoPassword == null) {
63-
snapshotMavenRepoPassword = project.extra["MAVEN_REPO_SNAPSHOT_PASSWORD"]?.toString()
64-
}
10+
sonatype {
11+
nexusUrl.set(uri(MavenUtil.getUrl(project)))
12+
snapshotRepositoryUrl.set(uri(MavenUtil.getUrl(project)))
6513

66-
nexusUrl.set(uri(mavenRepoDeployUrl))
67-
snapshotRepositoryUrl.set(uri(snapshotMavenRepoDeployUrl))
68-
username.set(if (System.getProperty("snapshot") == "true") snapshotMavenRepoUsername else mavenRepoUsername)
69-
password.set(if (System.getProperty("snapshot") == "true") snapshotMavenRepoPassword else mavenRepoPassword)
14+
username.set(MavenUtil.getUserName(project))
15+
password.set(MavenUtil.getPassword(project))
7016
}
7117
}
7218
}

buildSrc/src/main/kotlin/plugins/task-deploy-to-maven.gradle.kts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2525
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626
*/
27+
import util.MavenUtil
2728
import java.net.URI
2829

2930
plugins {
@@ -105,13 +106,24 @@ publishing {
105106
}
106107
}
107108
}
109+
repositories {
110+
maven {
111+
name = "nexus3"
112+
url = URI(MavenUtil.getUrl(project))
113+
credentials {
114+
username = MavenUtil.getUserName(project)
115+
password = MavenUtil.getPassword(project)
116+
}
117+
}
118+
}
108119
}
109120

110121
signing {
111122
sign(publishing.publications["mavenJava"])
112123
}
113124

114-
val shouldPublish = project.the<SourceSetContainer>()["main"].allSource.files.isNotEmpty()
125+
val shouldPublish = project.the<SourceSetContainer>()["main"].allSource.files.isNotEmpty() ||
126+
!project.name.contains("devops-scm-provider-gitee-simple")
115127

116128
tasks.forEach {
117129
if (it.group == "publish") {
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
3+
*
4+
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
5+
*
6+
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
7+
*
8+
* A copy of the MIT License is included in this file.
9+
*
10+
*
11+
* Terms of the MIT License:
12+
* ---------------------------------------------------
13+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
14+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
15+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
16+
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
17+
*
18+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
19+
* the Software.
20+
*
21+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22+
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
23+
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26+
*/
27+
28+
package util
29+
30+
import org.gradle.api.Project
31+
import org.gradle.kotlin.dsl.extra
32+
33+
object MavenUtil {
34+
35+
fun getUrl(project: Project): String {
36+
return if (System.getProperty("snapshot") == "true") {
37+
System.getProperty("snapshotMavenRepoDeployUrl")
38+
?: System.getenv("build_snapshotMavenRepoDeployUrl")
39+
?: project.extra["MAVEN_REPO_SNAPSHOT_DEPLOY_URL"]?.toString()
40+
} else {
41+
System.getProperty("mavenRepoDeployUrl")
42+
?: System.getenv("build_mavenRepoDeployUrl")
43+
?: project.extra["MAVEN_REPO_DEPLOY_URL"]?.toString()
44+
} ?: ""
45+
}
46+
47+
fun getUserName(project: Project): String? {
48+
return if (System.getProperty("snapshot") == "true") {
49+
System.getProperty("snapshotMavenRepoUsername")
50+
?: System.getenv("build_snapshotMavenRepoUsername")
51+
?: project.extra["MAVEN_REPO_SNAPSHOT_USERNAME"]?.toString()
52+
} else {
53+
System.getProperty("mavenRepoUsername")
54+
?: System.getenv("build_mavenRepoUsername")
55+
?: project.extra["MAVEN_REPO_USERNAME"]?.toString()
56+
}
57+
}
58+
59+
fun getPassword(project: Project): String? {
60+
return if (System.getProperty("snapshot") == "true") {
61+
System.getProperty("snapshotMavenRepoPassword")
62+
?: System.getenv("build_snapshotMavenRepoPassword")
63+
?: project.extra["MAVEN_REPO_SNAPSHOT_PASSWORD"]?.toString()
64+
} else {
65+
System.getProperty("mavenRepoPassword")
66+
?: System.getenv("build_mavenRepoPassword")
67+
?: project.extra["MAVEN_REPO_PASSWORD"]?.toString()
68+
}
69+
}
70+
}

devops-scm-api/src/main/java/com/tencent/devops/scm/api/FileService.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)