2023-03-15 21:52:13 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022 The CC: Tweaked Developers
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2022-11-04 22:31:56 +00:00
|
|
|
plugins {
|
|
|
|
`java-library`
|
|
|
|
`java-test-fixtures`
|
|
|
|
|
|
|
|
id("cc-tweaked.kotlin-convention")
|
|
|
|
id("cc-tweaked.java-convention")
|
|
|
|
id("cc-tweaked.publishing")
|
|
|
|
id("cc-tweaked")
|
|
|
|
}
|
|
|
|
|
|
|
|
val modVersion: String by extra
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
api(project(":core-api"))
|
|
|
|
implementation(libs.cobalt)
|
|
|
|
implementation(libs.fastutil)
|
|
|
|
implementation(libs.guava)
|
2023-03-29 08:30:29 +00:00
|
|
|
implementation(libs.jzlib)
|
2022-11-04 22:31:56 +00:00
|
|
|
implementation(libs.netty.http)
|
2023-06-06 18:58:24 +00:00
|
|
|
implementation(libs.netty.socks)
|
|
|
|
implementation(libs.netty.proxy)
|
2022-11-04 22:31:56 +00:00
|
|
|
implementation(libs.slf4j)
|
|
|
|
|
|
|
|
testFixturesImplementation(libs.slf4j)
|
2023-01-17 20:28:31 +00:00
|
|
|
testFixturesApi(platform(libs.kotlin.platform))
|
2022-11-04 22:31:56 +00:00
|
|
|
testFixturesApi(libs.bundles.test)
|
|
|
|
testFixturesApi(libs.bundles.kotlin)
|
|
|
|
|
Replace ASM generation with MethodHandles
This is the second time I've rewritten our class generation in a little
over a month. Oh dear!
Back in d562a051c7b3b114d6821c4a3a5d9d025a782f0a we started using method
handles inside our generated ASM, effectively replacing a direct call
with .invokeExact on a constant method handle.
This goes one step further and removes our ASM entirely, building up a
MethodHandle that checks arguments and then wraps the return value.
Rather than generating a class, we just return a new LuaFunction
instance that invokeExacts the method handle.
This is definitely slower than what we had before, but in the order of
8ns vs 12ns (in the worst case, sometimes they're much more comparable),
so I'm not too worried in practice.
However, generation of the actual method is now a bit faster. I've not
done any proper benchmarking, but it's about 20-30% faster.
This also gives us a bit more flexibility in the future, for instance
uisng bound MethodHandles in generation (e.g. for instance methods on
GenericSources). Not something I'm planning on doing right now, but is
an option.
2023-10-11 19:05:20 +00:00
|
|
|
testImplementation(libs.asm)
|
2022-11-04 22:31:56 +00:00
|
|
|
testImplementation(libs.bundles.test)
|
|
|
|
testRuntimeOnly(libs.bundles.testRuntime)
|
2022-12-15 17:53:50 +00:00
|
|
|
testRuntimeOnly(libs.slf4j.simple)
|
2022-11-04 22:31:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.processResources {
|
|
|
|
inputs.property("gitHash", cct.gitHash)
|
|
|
|
|
2023-01-06 09:34:07 +00:00
|
|
|
filesMatching("data/computercraft/lua/rom/help/credits.md") {
|
2022-12-13 20:31:59 +00:00
|
|
|
expand(mapOf("gitContributors" to cct.gitContributors.map { it.joinToString("\n") }.get()))
|
2022-11-04 22:31:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.test {
|
|
|
|
systemProperty("cct.test-files", buildDir.resolve("tmp/testFiles").absolutePath)
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.testFixturesJar {
|
|
|
|
manifest {
|
|
|
|
// Ensure the test fixtures jar loads as a mod. Thanks FML >_>.
|
|
|
|
attributes("FMLModType" to "GAMELIBRARY")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val checkChangelog by tasks.registering(cc.tweaked.gradle.CheckChangelog::class) {
|
|
|
|
version.set(modVersion)
|
|
|
|
whatsNew.set(file("src/main/resources/data/computercraft/lua/rom/help/whatsnew.md"))
|
|
|
|
changelog.set(file("src/main/resources/data/computercraft/lua/rom/help/changelog.md"))
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.check { dependsOn(checkChangelog) }
|