1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-24 20:43:33 +08:00

[idea] feat: generate gradle-wrapper.properties and src/test directory ()

feat: generate gradle-wrapper.properties and src/test directory
This commit is contained in:
Samarium 2023-04-15 08:01:10 -06:00 committed by GitHub
parent 30b3472460
commit f28a1a0f0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 4 deletions

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

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 gradle-wrapper.properties for Mirai Console Plugin projects.</p>
</body>
</html>

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.
@ -26,6 +26,7 @@ object FT { // file template
const val SettingsGradleKts = "Plugin settings.gradle.kts"
const val SettingsGradle = "Plugin settings.gradle"
const val GradleWrapperProperties = "Gradle gradle-wrapper.properties"
const val GradleProperties = "Gradle gradle.properties"
const val PluginMainKt = "Plugin main class Kotlin.kt"

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.
@ -23,6 +23,7 @@ class FileTemplateRegistrar : com.intellij.ide.fileTemplates.FileTemplateGroupDe
addTemplate(FileTemplateDescriptor(FT.PluginMainJava))
addTemplate(FileTemplateDescriptor(FT.PluginMainService))
addTemplate(FileTemplateDescriptor(FT.GradleWrapperProperties))
addTemplate(FileTemplateDescriptor(FT.GradleProperties))
addTemplate(FileTemplateDescriptor(FT.SettingsGradleKts))

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.
@ -108,6 +108,10 @@ class MiraiModuleBuilder : StarterModuleBuilder() {
val model = starterContext.getUserData(MIRAI_PROJECT_MODEL_KEY)!!
val standardAssetsProvider = StandardAssetsProvider()
assets.add(GeneratorTemplateFile(
standardAssetsProvider.gradleWrapperPropertiesLocation,
ftManager.getCodeTemplate(FT.GradleWrapperProperties)
))
assets.addAll(standardAssetsProvider.getGradlewAssets())
model.buildSystemType.createBuildSystem(model)

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,9 @@ sealed class GradleProjectCreator(
collect(GeneratorEmptyDirectory("src/main/${model.languageType.sourceSetDirName}"))
collect(GeneratorEmptyDirectory("src/main/resources"))
collect(GeneratorEmptyDirectory("src/test/${model.languageType.sourceSetDirName}"))
collect(GeneratorEmptyDirectory("src/test/resources"))
collect(GeneratorTemplateFile(model.languageType.pluginMainClassFile(this)))
collect(GeneratorTemplateFile(".gitignore", getTemplate(FT.Gitignore)))