Skip to content

Commit

Permalink
Fix processResources error
Browse files Browse the repository at this point in the history
  • Loading branch information
srnyx committed Jun 25, 2023
1 parent afb1248 commit b603fd9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/kotlin/xyz/srnyx/gradlegalaxy/utility/Scripts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ fun Project.addJavadocSourcesJars(javadocClassifier: String? = null, sourcesClas
*
* @param replacements A [Map] of all the replacements
*/
fun Project.addReplacementsTask(replacements: Map<String, String> = getDefaultReplacements()) {
fun Project.addReplacementsTask(files: Set<String> = setOf("plugin.yml"), replacements: Map<String, String> = getDefaultReplacements()) {
tasks.named<Copy>("processResources") {
outputs.upToDateWhen { false }
filesMatching("**/*.yml") {
filesMatching(files) {
expand(if (replacements == getSentinelReplacements()) getDefaultReplacements() else replacements)
}
}
Expand Down Expand Up @@ -213,12 +213,13 @@ fun Project.setupMC(
version: String = project.version.toString(),
description: String? = project.description,
javaVersion: JavaVersion? = null,
replacementFiles: Set<String>? = setOf("plugin.yml"),
replacements: Map<String, String>? = getSentinelReplacements(),
textEncoding: String? = "UTF-8",
archiveClassifier: String? = "",
) {
setupJava(group, version, description, javaVersion, textEncoding, archiveClassifier)
replacements?.let(::addReplacementsTask)
if (replacementFiles != null && replacements != null) addReplacementsTask(replacementFiles, replacements)
}

/**
Expand All @@ -244,14 +245,15 @@ fun Project.setupAnnoyingAPI(
version: String = project.version.toString(),
description: String? = project.description,
javaVersion: JavaVersion? = null,
replacementFiles: Set<String>? = setOf("plugin.yml"),
replacements: Map<String, String>? = getSentinelReplacements(),
textEncoding: String? = "UTF-8",
archiveClassifier: String? = "",
configuration: String = "implementation",
configurationAction: Action<ExternalModuleDependency> = Action {}
): ExternalModuleDependency {
check(hasShadowPlugin()) { "Shadow plugin is required for Annoying API!" }
setupMC(group, version, description, javaVersion, replacements, textEncoding, archiveClassifier)
setupMC(group, version, description, javaVersion, replacementFiles, replacements, textEncoding, archiveClassifier)
return annoyingAPI(annoyingAPIVersion, configuration, configurationAction)
}

Expand Down

0 comments on commit b603fd9

Please sign in to comment.