aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-13 13:40:50 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-13 13:40:50 +0100
commitd267913e206f5f7bfc16607c0dc058290e6b556f (patch)
treeae586ff39bb970f51b84f89c7e0b96130e9f4e3b /build.gradle.kts
parentdb87e5293846e27dc684dd141744390ae6e8bc67 (diff)
downloadFirmament-d267913e206f5f7bfc16607c0dc058290e6b556f.tar.gz
Firmament-d267913e206f5f7bfc16607c0dc058290e6b556f.tar.bz2
Firmament-d267913e206f5f7bfc16607c0dc058290e6b556f.zip
test: Add sack util test
Diffstat (limited to 'build.gradle.kts')
-rw-r--r--build.gradle.kts33
1 files changed, 32 insertions, 1 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 7887641..53b0b87 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,6 +7,8 @@
*/
import com.google.devtools.ksp.gradle.KspTaskJvm
+import com.google.gson.Gson
+import com.google.gson.JsonObject
import moe.nea.licenseextractificator.LicenseDiscoveryTask
import moe.nea.mcautotranslations.gradle.CollectTranslations
import net.fabricmc.loom.LoomGradleExtension
@@ -219,7 +221,8 @@ val configuredSourceSet = createIsolatedSourceSet("configured",
val sodiumSourceSet = createIsolatedSourceSet("sodium")
val citResewnSourceSet = createIsolatedSourceSet("citresewn", isEnabled = false) // TODO: Wait for update
val yaclSourceSet = createIsolatedSourceSet("yacl")
-val explosiveEnhancementSourceSet = createIsolatedSourceSet("explosiveEnhancement", isEnabled = false) // TODO: wait for their port
+val explosiveEnhancementSourceSet =
+ createIsolatedSourceSet("explosiveEnhancement", isEnabled = false) // TODO: wait for their port
val wildfireGenderSourceSet = createIsolatedSourceSet("wildfireGender", isEnabled = false) // TODO: wait on their port
val modmenuSourceSet = createIsolatedSourceSet("modmenu")
val reiSourceSet = createIsolatedSourceSet("rei")
@@ -344,7 +347,35 @@ mcAutoTranslations {
translationFunctionResolved.set("moe.nea.firmament.util.trResolved")
}
+val downloadTestRepo by tasks.registering(RepoDownload::class) {
+ this.hash.set(project.property("firmament.compiletimerepohash") as String)
+}
+
+val updateTestRepo by tasks.registering {
+ outputs.upToDateWhen { false }
+ doLast {
+ val propertiesFile = rootProject.file("gradle.properties")
+ val json =
+ Gson().fromJson(uri("https://api.github.com/repos/NotEnoughUpdates/NotEnoughUpdates-REPO/branches/master")
+ .toURL().readText(), JsonObject::class.java)
+ val latestSha = json["commit"].asJsonObject["sha"].asString
+ var text = propertiesFile.readText()
+ text = text.replace("firmament\\.compiletimerepohash=[^\n]*".toRegex(),
+ "firmament.compiletimerepohash=$latestSha")
+ propertiesFile.writeText(text)
+ }
+}
+
+
tasks.test {
+ val wd =file("build/testWorkDir")
+ workingDir(wd)
+ dependsOn(downloadTestRepo)
+ doFirst {
+ wd.mkdirs()
+ wd.resolve("config").deleteRecursively()
+ systemProperty("firmament.testrepo", downloadTestRepo.flatMap { it.outputDirectory.asFile }.map { it.absolutePath }.get())
+ }
useJUnitPlatform()
}