Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idea] feat: provide an option for whether to use the proxy repo #2636

Merged
merged 5 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ group = '$GROUP_ID'
version = '$VERSION'

repositories {
#if($USE_PROXY_REPO)maven { url 'https://maven.aliyun.com/repository/public' }#end

#if($USE_PROXY_REPO)
maven { url 'https://maven.aliyun.com/repository/public' }
#end
mavenCentral()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ group = "$GROUP_ID"
version = "$VERSION"

repositories {
#if($USE_PROXY_REPO)maven("https://maven.aliyun.com/repository/public")#end

#if($USE_PROXY_REPO)
maven("https://maven.aliyun.com/repository/public")
#end
mavenCentral()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pluginManagement {
repositories {
#if($USE_PROXY_REPO)
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
#end
gradlePluginPortal()
}
}
rootProject.name = "$ARTIFACT_ID"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!--
~ Copyright 2019-2023 Mamoe Technologies and contributors.
~
~ 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
~ Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
~
~ https://github.com/mamoe/mirai/blob/dev/LICENSE
-->

<html>
<body>
<p>This is a built-in file template used to create a new settings.gradle for Mirai Console Plugin projects.</p>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
pluginManagement {
repositories {
#if($USE_PROXY_REPO)
maven("https://maven.aliyun.com/repository/gradle-plugin")
#end
gradlePluginPortal()
}
}
rootProject.name = "$ARTIFACT_ID"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019-2022 Mamoe Technologies and contributors.
# Copyright 2019-2023 Mamoe Technologies and contributors.
#
# ???????? GNU AFFERO GENERAL PUBLIC LICENSE version 3 ??????, ?????????????.
# Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
Expand Down Expand Up @@ -37,3 +37,4 @@ validation.plugin.name.forbidden.character="{0}" is forbidden in plugin name
validation.illegal.plugin.id=Invalid plugin id "{0}"
validation.illegal.version=Invalid version.\n{0}
no.error.message=No error message
text.use.proxy.repo=Use Aliyun Maven repository
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019-2022 Mamoe Technologies and contributors.
# Copyright 2019-2023 Mamoe Technologies and contributors.
#
# ???????? GNU AFFERO GENERAL PUBLIC LICENSE version 3 ??????, ?????????????.
# Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
Expand Down Expand Up @@ -37,3 +37,4 @@ validation.plugin.name.forbidden.character=插件名称中不允许存在 "{0}"
validation.illegal.plugin.id=插件 ID 无效: "{0}"
validation.illegal.version=插件版本无效\n{0}
no.error.message=无错误信息
text.use.proxy.repo=使用阿里云 Maven 镜像
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class MiraiModuleBuilder : StarterModuleBuilder() {
"GROUP_ID" to projectCoordinates.groupId,
"VERSION" to projectCoordinates.version,
"PROJECT_NAME" to starterContext,
"USE_PROXY_REPO" to "true",
"USE_PROXY_REPO" to useProxyRepo,
"ARTIFACT_ID" to projectCoordinates.artifactId,
"MODULE_NAME" to projectCoordinates.moduleName,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 Mamoe Technologies and contributors.
* Copyright 2019-2023 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
Expand Down Expand Up @@ -38,7 +38,7 @@ class MiraiProjectModel(

val buildSystemType: BuildSystemType,
val languageType: LanguageType,

val useProxyRepo: Boolean,

val mainClassSimpleName: String = pluginCoordinates.run {
name.adjustToClassName() ?: id.substringAfterLast('.').adjustToClassName()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 Mamoe Technologies and contributors.
* Copyright 2019-2023 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
Expand Down Expand Up @@ -39,6 +39,7 @@ class MiraiProjectWizardInitialStep(contextProvider: StarterContextProvider) : S
private val pluginInfoProperty = propertyGraph.lazyProperty { "" }
private val miraiVersionKindProperty = propertyGraph.property(MiraiVersionKind.Stable)
private val miraiVersionProperty = propertyGraph.property("0.1.0")
private val useProxyRepoProperty = propertyGraph.property(true)

var pluginVersion by pluginVersionProperty.trim()
var pluginName by pluginNameProperty.trim()
Expand All @@ -54,6 +55,8 @@ class MiraiProjectWizardInitialStep(contextProvider: StarterContextProvider) : S

private lateinit var miraiVersionCell: Cell<ComboBox<String>>

var useProxyRepo by useProxyRepoProperty

override fun addFieldsAfter(layout: Panel) {
layout.group(message("title.plugin.description")) {
row(message("label.plugin.id")) {
Expand Down Expand Up @@ -141,6 +144,9 @@ class MiraiProjectWizardInitialStep(contextProvider: StarterContextProvider) : S
updateVersionItems(miraiVersionKindCell, miraiVersionCell)
rowComment(message("comment.mirai.version"))
}
row {
checkBox(message("text.use.proxy.repo")).enabled(true).bindSelected(useProxyRepoProperty)
}
}

// Update default values
Expand Down Expand Up @@ -181,7 +187,8 @@ class MiraiProjectWizardInitialStep(contextProvider: StarterContextProvider) : S
KOTLIN_STARTER_LANGUAGE -> LanguageType.Kotlin
JAVA_STARTER_LANGUAGE -> LanguageType.Java
else -> error("Unsupported language type: $language")
}
},
useProxyRepo = useProxyRepo
)
)
}
Expand Down