User: kyle wood Date: 27 Mar 26 04:01 Revision: 2657f6a35aba1ccab88a5bd27e4d9635657b2902 Summary: Only update file header dates when they are modified Prevents the giant "year" update commits. TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10439&personal=false Index: buildSrc/src/main/kotlin/mcdev-core.gradle.kts =================================================================== --- buildSrc/src/main/kotlin/mcdev-core.gradle.kts (revision 2306d1094c094319331c9668134b1a5ca844ca44) +++ buildSrc/src/main/kotlin/mcdev-core.gradle.kts (revision 2657f6a35aba1ccab88a5bd27e4d9635657b2902) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -19,6 +19,7 @@ */ import org.cadixdev.gradle.licenser.header.HeaderStyle +import org.cadixdev.gradle.licenser.tasks.LicenseTask import org.gradle.accessors.dm.LibrariesForLibs import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode import org.jetbrains.kotlin.gradle.dsl.JvmTarget @@ -128,7 +129,30 @@ } license { - header.set(resources.text.fromFile(rootProject.layout.projectDirectory.file("copyright.txt"))) + header.set(resources.text.fromString($$""" + Minecraft Development for IntelliJ + + https://mcdev.io/ + + Copyright (C) ${year} minecraft-dev + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation, version 3.0 only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . + """.trimIndent())) + + properties { + set("year", "2026") + } + style["flex"] = HeaderStyle.BLOCK_COMMENT.format style["bnf"] = HeaderStyle.BLOCK_COMMENT.format @@ -136,6 +160,27 @@ include(endings.map { "**/*.$it" }) } +tasks.withType(LicenseTask::class).configureEach { + val changedFiles = if (rootProject.ext.has("changedFiles")) { + @Suppress("UNCHECKED_CAST") + rootProject.ext["changedFiles"] as Set + } else { + val unstagedFiles = git("diff", "--name-only").lines() + val stagedFiles = git("diff", "--staged", "--name-only").lines() + var changedFiles = (unstagedFiles + stagedFiles) + .filter { it.isNotBlank() } + .map(project::file) + .toSet() + rootProject.ext["changedFiles"] = changedFiles + changedFiles + } + doFirst { + files = files.filter { + it in changedFiles + } + } +} + idea { module { excludeDirs.add(file(intellijPlatform.sandboxContainer.get())) Index: buildSrc/src/main/kotlin/util.kt =================================================================== --- buildSrc/src/main/kotlin/util.kt (revision 2306d1094c094319331c9668134b1a5ca844ca44) +++ buildSrc/src/main/kotlin/util.kt (revision 2657f6a35aba1ccab88a5bd27e4d9635657b2902) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,6 +18,10 @@ * along with this program. If not, see . */ +import java.io.ByteArrayOutputStream +import java.io.InputStream +import java.io.OutputStream +import java.nio.charset.Charset import org.gradle.api.Project import org.gradle.api.tasks.TaskContainer import org.gradle.api.tasks.util.PatternFilterable @@ -65,3 +69,11 @@ this.grammarKit.setFrom(grammarKit) } } + +fun Project.git(vararg args: String): String { + val output = providers.exec { + commandLine("git", *args) + isIgnoreExitValue = true + } + return output.standardOutput.asText.get() +} Index: copyright.txt =================================================================== --- copyright.txt (revision 2306d1094c094319331c9668134b1a5ca844ca44) +++ copyright.txt (revision 2306d1094c094319331c9668134b1a5ca844ca44) @@ -1,17 +0,0 @@ -Minecraft Development for IntelliJ - -https://mcdev.io/ - -Copyright (C) 2025 minecraft-dev - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation, version 3.0 only. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with this program. If not, see .