Skip to content

Commit

Permalink
chore(build): Add our own ide hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Sep 4, 2023
1 parent 98a9a13 commit aa127b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 13 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import com.diffplug.gradle.spotless.FormatExtension
import org.jetbrains.gradle.ext.settings
import org.jetbrains.gradle.ext.taskTriggers

plugins {
id("java-gradle-plugin")
`java-gradle-plugin`
alias(libs.plugins.indra)
alias(libs.plugins.indra.gradlePluginPublish)
alias(libs.plugins.indra.licenserSpotless)
alias(libs.plugins.indra.checkstyle)
alias(libs.plugins.pluginPublish)
alias(libs.plugins.spotless)
alias(libs.plugins.ideaExt)
eclipse
}

repositories {
Expand Down Expand Up @@ -67,7 +71,7 @@ dependencies {
checkstyle(libs.stylecheck)
}

// generated sources
// generated sources (blossom jr)
val templatesRoot = layout.projectDirectory.dir("src/main/java-templates")
val templateDest = layout.buildDirectory.dir("generated/sources/java-templates/")

Expand All @@ -86,6 +90,13 @@ val processTemplates = tasks.register("generateJavaTemplates", Sync::class) {
sourceSets.main {
java.srcDir(processTemplates.map { it.outputs })
}
eclipse.synchronizationTasks(processTemplates)
if (idea.project != null) {
setOf(idea.project.settings.taskTriggers.afterSync(processTemplates))
}
if (idea.module != null) {
idea.module.generatedSourceDirs.add(templateDest.get().asFile)
}

indra {
github("KyoriPowered", "blossom") {
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version = "1.0"

[versions]
checkstyle = "10.12.3"
ideaExt = "1.1.7"
indra = "3.1.3"
junit = "5.10.0"
mammoth = "1.3.1"
Expand All @@ -12,7 +13,7 @@ spotless = "6.21.0"
stylecheck = "0.2.1"

[libraries]
ideaExtPlugin = { module = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext", version = "1.1.7"}
ideaExtPlugin = { module = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext", version.ref = "ideaExt" }
mammoth = { module = "net.kyori:mammoth", version.ref = "mammoth" }
pebble = { module = "io.pebbletemplates:pebble", version.ref = "pebble" }
snakeyamlEngine = { module = "org.snakeyaml:snakeyaml-engine", version.ref = "snakeyaml" }
Expand All @@ -29,6 +30,7 @@ stylecheck = { module = "ca.stellardrift:stylecheck", version.ref = "stylecheck"
zCheckstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }

[plugins]
ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "ideaExt" }
indra = { id = "net.kyori.indra", version.ref = "indra" }
indra-checkstyle = { id = "net.kyori.indra.checkstyle", version.ref = "indra" }
indra-gradlePluginPublish = { id = "net.kyori.indra.publishing.gradle-plugin", version.ref = "indra" }
Expand Down

0 comments on commit aa127b5

Please sign in to comment.