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

* feat(idea): set proxy repository for gradle plugins

* feat(idea): provide an option for whether to use the proxy repo

* chore: update copyright

* fix: rename the message key
This commit is contained in:
Samarium 2023-04-24 08:22:38 -06:00 committed by GitHub
parent b4bd1e74cf
commit f0bdd18d26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 53 additions and 11 deletions

View File

@ -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()
}

View File

@ -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()
}

View File

@ -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"

View File

@ -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>

View File

@ -1 +1,9 @@
pluginManagement {
repositories {
#if($USE_PROXY_REPO)
maven("https://maven.aliyun.com/repository/gradle-plugin")
#end
gradlePluginPortal()
}
}
rootProject.name = "$ARTIFACT_ID"

View File

@ -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.
@ -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

View File

@ -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.
@ -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 镜像

View File

@ -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,

View File

@ -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.
@ -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()

View File

@ -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.
@ -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()
@ -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")) {
@ -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
@ -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
)
)
}