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: generate gradle-wrapper.properties and src/test directory #2622

Merged
merged 1 commit into from
Apr 15, 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
@@ -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
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 gradle-wrapper.properties for Mirai Console Plugin projects.</p>
</body>
</html>
3 changes: 2 additions & 1 deletion mirai-console/tools/intellij-plugin/src/assets/Assets.kt
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 All @@ -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"
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 All @@ -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))
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 @@ -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)
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,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)))
Expand Down