mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-24 02:40:13 +08:00
[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:
parent
b4bd1e74cf
commit
f0bdd18d26
@ -9,8 +9,9 @@ group = '$GROUP_ID'
|
|||||||
version = '$VERSION'
|
version = '$VERSION'
|
||||||
|
|
||||||
repositories {
|
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()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,9 @@ group = "$GROUP_ID"
|
|||||||
version = "$VERSION"
|
version = "$VERSION"
|
||||||
|
|
||||||
repositories {
|
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()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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"
|
@ -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>
|
@ -1 +1,9 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
#if($USE_PROXY_REPO)
|
||||||
|
maven("https://maven.aliyun.com/repository/gradle-plugin")
|
||||||
|
#end
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
rootProject.name = "$ARTIFACT_ID"
|
rootProject.name = "$ARTIFACT_ID"
|
@ -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 ??????, ?????????????.
|
# ???????? 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.
|
# 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.plugin.id=Invalid plugin id "{0}"
|
||||||
validation.illegal.version=Invalid version.\n{0}
|
validation.illegal.version=Invalid version.\n{0}
|
||||||
no.error.message=No error message
|
no.error.message=No error message
|
||||||
|
text.use.proxy.repo=Use Aliyun Maven repository
|
||||||
|
@ -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 ??????, ?????????????.
|
# ???????? 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.
|
# 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.plugin.id=插件 ID 无效: "{0}"
|
||||||
validation.illegal.version=插件版本无效\n{0}
|
validation.illegal.version=插件版本无效\n{0}
|
||||||
no.error.message=无错误信息
|
no.error.message=无错误信息
|
||||||
|
text.use.proxy.repo=使用阿里云 Maven 镜像
|
||||||
|
@ -82,7 +82,7 @@ class MiraiModuleBuilder : StarterModuleBuilder() {
|
|||||||
"GROUP_ID" to projectCoordinates.groupId,
|
"GROUP_ID" to projectCoordinates.groupId,
|
||||||
"VERSION" to projectCoordinates.version,
|
"VERSION" to projectCoordinates.version,
|
||||||
"PROJECT_NAME" to starterContext,
|
"PROJECT_NAME" to starterContext,
|
||||||
"USE_PROXY_REPO" to "true",
|
"USE_PROXY_REPO" to useProxyRepo,
|
||||||
"ARTIFACT_ID" to projectCoordinates.artifactId,
|
"ARTIFACT_ID" to projectCoordinates.artifactId,
|
||||||
"MODULE_NAME" to projectCoordinates.moduleName,
|
"MODULE_NAME" to projectCoordinates.moduleName,
|
||||||
|
|
||||||
|
@ -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 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 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.
|
* 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 buildSystemType: BuildSystemType,
|
||||||
val languageType: LanguageType,
|
val languageType: LanguageType,
|
||||||
|
val useProxyRepo: Boolean,
|
||||||
|
|
||||||
val mainClassSimpleName: String = pluginCoordinates.run {
|
val mainClassSimpleName: String = pluginCoordinates.run {
|
||||||
name.adjustToClassName() ?: id.substringAfterLast('.').adjustToClassName()
|
name.adjustToClassName() ?: id.substringAfterLast('.').adjustToClassName()
|
||||||
|
@ -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 许可证的约束, 可以在以下链接找到该许可证.
|
* 此源代码的使用受 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.
|
* 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 pluginInfoProperty = propertyGraph.lazyProperty { "" }
|
||||||
private val miraiVersionKindProperty = propertyGraph.property(MiraiVersionKind.Stable)
|
private val miraiVersionKindProperty = propertyGraph.property(MiraiVersionKind.Stable)
|
||||||
private val miraiVersionProperty = propertyGraph.property("0.1.0")
|
private val miraiVersionProperty = propertyGraph.property("0.1.0")
|
||||||
|
private val useProxyRepoProperty = propertyGraph.property(true)
|
||||||
|
|
||||||
var pluginVersion by pluginVersionProperty.trim()
|
var pluginVersion by pluginVersionProperty.trim()
|
||||||
var pluginName by pluginNameProperty.trim()
|
var pluginName by pluginNameProperty.trim()
|
||||||
@ -54,6 +55,8 @@ class MiraiProjectWizardInitialStep(contextProvider: StarterContextProvider) : S
|
|||||||
|
|
||||||
private lateinit var miraiVersionCell: Cell<ComboBox<String>>
|
private lateinit var miraiVersionCell: Cell<ComboBox<String>>
|
||||||
|
|
||||||
|
var useProxyRepo by useProxyRepoProperty
|
||||||
|
|
||||||
override fun addFieldsAfter(layout: Panel) {
|
override fun addFieldsAfter(layout: Panel) {
|
||||||
layout.group(message("title.plugin.description")) {
|
layout.group(message("title.plugin.description")) {
|
||||||
row(message("label.plugin.id")) {
|
row(message("label.plugin.id")) {
|
||||||
@ -141,6 +144,9 @@ class MiraiProjectWizardInitialStep(contextProvider: StarterContextProvider) : S
|
|||||||
updateVersionItems(miraiVersionKindCell, miraiVersionCell)
|
updateVersionItems(miraiVersionKindCell, miraiVersionCell)
|
||||||
rowComment(message("comment.mirai.version"))
|
rowComment(message("comment.mirai.version"))
|
||||||
}
|
}
|
||||||
|
row {
|
||||||
|
checkBox(message("text.use.proxy.repo")).enabled(true).bindSelected(useProxyRepoProperty)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update default values
|
// Update default values
|
||||||
@ -181,7 +187,8 @@ class MiraiProjectWizardInitialStep(contextProvider: StarterContextProvider) : S
|
|||||||
KOTLIN_STARTER_LANGUAGE -> LanguageType.Kotlin
|
KOTLIN_STARTER_LANGUAGE -> LanguageType.Kotlin
|
||||||
JAVA_STARTER_LANGUAGE -> LanguageType.Java
|
JAVA_STARTER_LANGUAGE -> LanguageType.Java
|
||||||
else -> error("Unsupported language type: $language")
|
else -> error("Unsupported language type: $language")
|
||||||
}
|
},
|
||||||
|
useProxyRepo = useProxyRepo
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user