2023-03-15 21:52:13 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022 The CC: Tweaked Developers
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2022-11-06 10:28:49 +00:00
|
|
|
import org.jetbrains.gradle.ext.compiler
|
|
|
|
import org.jetbrains.gradle.ext.settings
|
2022-10-22 20:09:08 +00:00
|
|
|
|
|
|
|
plugins {
|
2022-11-17 09:26:57 +00:00
|
|
|
publishing
|
2022-10-22 20:09:08 +00:00
|
|
|
alias(libs.plugins.taskTree)
|
2022-11-17 09:26:57 +00:00
|
|
|
alias(libs.plugins.githubRelease)
|
2022-11-06 15:07:13 +00:00
|
|
|
id("org.jetbrains.gradle.plugin.idea-ext")
|
2022-11-17 09:26:57 +00:00
|
|
|
id("cc-tweaked")
|
2022-10-22 20:09:08 +00:00
|
|
|
}
|
2022-11-06 10:28:49 +00:00
|
|
|
|
2022-11-17 09:26:57 +00:00
|
|
|
val isUnstable = project.properties["isUnstable"] == "true"
|
|
|
|
val modVersion: String by extra
|
|
|
|
val mcVersion: String by extra
|
|
|
|
|
|
|
|
githubRelease {
|
|
|
|
token(findProperty("githubApiKey") as String? ?: "")
|
|
|
|
owner.set("cc-tweaked")
|
|
|
|
repo.set("CC-Tweaked")
|
|
|
|
targetCommitish.set(cct.gitBranch)
|
|
|
|
|
|
|
|
tagName.set("v$mcVersion-$modVersion")
|
|
|
|
releaseName.set("[$mcVersion] $modVersion")
|
|
|
|
body.set(
|
|
|
|
provider {
|
|
|
|
"## " + project(":core").file("src/main/resources/data/computercraft/lua/rom/help/whatsnew.md")
|
|
|
|
.readLines()
|
|
|
|
.takeWhile { it != "Type \"help changelog\" to see the full version history." }
|
|
|
|
.joinToString("\n").trim()
|
|
|
|
},
|
|
|
|
)
|
|
|
|
prerelease.set(isUnstable)
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.publish { dependsOn(tasks.githubRelease) }
|
|
|
|
|
2022-11-06 10:28:49 +00:00
|
|
|
idea.project.settings.compiler.javac {
|
|
|
|
// We want ErrorProne to be present when compiling via IntelliJ, as it offers some helpful warnings
|
|
|
|
// and errors. Loop through our source sets and find the appropriate flags.
|
|
|
|
moduleJavacAdditionalOptions = subprojects
|
|
|
|
.asSequence()
|
|
|
|
.map { evaluationDependsOn(it.path) }
|
|
|
|
.flatMap { project ->
|
|
|
|
val sourceSets = project.extensions.findByType(SourceSetContainer::class) ?: return@flatMap sequenceOf()
|
|
|
|
sourceSets.asSequence().map { sourceSet ->
|
|
|
|
val name = "${idea.project.name}.${project.name}.${sourceSet.name}"
|
|
|
|
val compile = project.tasks.named(sourceSet.compileJavaTaskName, JavaCompile::class).get()
|
|
|
|
name to compile.options.allCompilerArgs.joinToString(" ") { if (it.contains(" ")) "\"$it\"" else it }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.toMap()
|
|
|
|
}
|