1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 12:10:30 +00:00

Move dan200.computercraft.core into a separate module

This is a very big diff in changed files, but very small in actual
changes.
This commit is contained in:
Jonathan Coates 2022-11-04 22:31:56 +00:00
parent a17b001950
commit acc254a1ef
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
766 changed files with 193 additions and 131 deletions

View File

@ -49,8 +49,7 @@ repos:
exclude: |
(?x)^(
src/generated|
src/test/resources/test-rom/data/json-parsing/|
projects/core/src/test/resources/test-rom/data/json-parsing/|
src/testMod/server-files/|
config/idea/|
.*\.dfpwm
)

View File

@ -26,12 +26,15 @@ val isStable = true
val modVersion: String by extra
val mcVersion: String by extra
val allProjects = listOf(":core-api").map { evaluationDependsOn(it) }
val allProjects = listOf(":core-api", ":core").map { evaluationDependsOn(it) }
cct {
allProjects.forEach { externalSources(it) }
}
java.registerFeature("extraMods") { usingSourceSet(sourceSets.main.get()) }
java {
withJavadocJar()
registerFeature("extraMods") { usingSourceSet(sourceSets.main.get()) }
}
sourceSets {
main {
@ -154,17 +157,20 @@ dependencies {
"extraModsRuntimeOnly"(fg.deobf("mezz.jei:jei-1.19.2-forge:11.3.0.262"))
"extraModsCompileOnly"(fg.deobf("maven.modrinth:oculus:1.2.5"))
implementation(project(":core-api"))
implementation(project(":core"))
"shade"(libs.cobalt)
"shade"("io.netty:netty-codec-http:4.1.76.Final")
"shade"(libs.netty.http)
testFixturesApi(libs.bundles.test)
testFixturesApi(libs.bundles.kotlin)
testImplementation(testFixtures(project(":core")))
testImplementation(libs.bundles.test)
testImplementation(libs.bundles.kotlin)
testRuntimeOnly(libs.bundles.testRuntime)
testModImplementation(testFixtures(project(":core")))
"cctJavadoc"(libs.cctJavadoc)
}
@ -192,6 +198,8 @@ val luaJavadoc by tasks.registering(Javadoc::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
source(sourceSets.main.get().java)
source(project(":core").sourceSets.main.get().java)
setDestinationDir(buildDir.resolve("docs/luaJavadoc"))
classpath = sourceSets.main.get().compileClasspath
@ -209,11 +217,6 @@ val luaJavadoc by tasks.registering(Javadoc::class) {
tasks.processResources {
inputs.property("modVersion", modVersion)
inputs.property("forgeVersion", libs.versions.forge.get())
inputs.property("gitHash", cct.gitHash)
filesMatching("data/computercraft/lua/rom/help/credits.txt") {
expand(mapOf("gitContributors" to cct.gitContributors.get().joinToString("\n")))
}
filesMatching("META-INF/mods.toml") {
expand(mapOf("forgeVersion" to libs.versions.forge.get(), "file" to mapOf("jarVersion" to modVersion)))
@ -229,11 +232,14 @@ tasks.jar {
tasks.shadowJar {
finalizedBy("reobfShadowJar")
archiveClassifier.set("")
from(allProjects.map { zipTree(it.tasks.jar.get().archiveFile) })
configurations = listOf(project.configurations["shade"])
relocate("org.squiddev.cobalt", "cc.tweaked.internal.cobalt")
minimize()
relocate("io.netty.handler.codec.http", "cc.tweaked.internal.netty")
// TODO: minimize(): Would be good to support once our build scripts are stabilised.
}
tasks.assemble { dependsOn("shadowJar") }
@ -351,14 +357,6 @@ tasks.check { dependsOn(runGametest) }
// Upload tasks
val checkChangelog by tasks.registering(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) }
val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) {
group = PublishingPlugin.PUBLISH_TASK_GROUP
description = "Upload artifacts to CurseForge"

View File

@ -28,7 +28,6 @@ java {
}
withSourcesJar()
withJavadocJar()
}
repositories {

View File

@ -3,9 +3,9 @@
(sources
/doc/
/build/docs/luaJavadoc/
/src/main/resources/*/computercraft/lua/bios.lua
/src/main/resources/*/computercraft/lua/rom/
/src/test/resources/test-rom
/projects/core/src/main/resources/data/computercraft/lua/bios.lua
/projects/core/src/main/resources/data/computercraft/lua/rom/
/projects/core/src/test/resources/test-rom
/src/web/mount)
@ -34,13 +34,13 @@
/doc/stub/
/build/docs/luaJavadoc/
/src/main/resources/*/computercraft/lua/rom/apis/
/src/main/resources/*/computercraft/lua/rom/apis/command/
/src/main/resources/*/computercraft/lua/rom/apis/turtle/
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/command/
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/turtle/
/src/main/resources/*/computercraft/lua/rom/modules/main/
/src/main/resources/*/computercraft/lua/rom/modules/command/
/src/main/resources/*/computercraft/lua/rom/modules/turtle/))
/projects/core/src/main/resources/data/computercraft/lua/rom/modules/main/
/projects/core/src/main/resources/data/computercraft/lua/rom/modules/command/
/projects/core/src/main/resources/data/computercraft/lua/rom/modules/turtle/))
(at /
(linters
@ -80,8 +80,8 @@
;; We disable the unused global linter in bios.lua and the APIs. In the future
;; hopefully we'll get illuaminate to handle this.
(at
(/src/main/resources/*/computercraft/lua/bios.lua
/src/main/resources/*/computercraft/lua/rom/apis/)
(/projects/core/src/main/resources/data/computercraft/lua/bios.lua
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/)
(linters -var:unused-global)
(lint (allow-toplevel-global true)))
@ -93,18 +93,18 @@
;; Suppress warnings for currently undocumented modules.
(at
(; Lua APIs
/src/main/resources/*/computercraft/lua/rom/apis/io.lua
/src/main/resources/*/computercraft/lua/rom/apis/window.lua)
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/io.lua
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/window.lua)
(linters -doc:undocumented -doc:undocumented-arg -doc:undocumented-return))
;; Suppress warnings for various APIs using its own deprecated members.
(at
(/src/main/resources/*/computercraft/lua/bios.lua
/src/main/resources/*/computercraft/lua/rom/apis/turtle/turtle.lua)
(/projects/core/src/main/resources/data/computercraft/lua/bios.lua
/projects/core/src/main/resources/data/computercraft/lua/rom/apis/turtle/turtle.lua)
(linters -var:deprecated))
(at /src/test/resources/test-rom
(at /projects/core/src/test/resources/test-rom
; We should still be able to test deprecated members.
(linters -var:deprecated)

View File

@ -0,0 +1,55 @@
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)
implementation(libs.netty.http)
implementation(libs.slf4j)
implementation(libs.asm)
testFixturesImplementation(libs.slf4j)
testFixturesApi(libs.bundles.test)
testFixturesApi(libs.bundles.kotlin)
testImplementation(libs.bundles.test)
testRuntimeOnly(libs.bundles.testRuntime)
}
tasks.processResources {
inputs.property("gitHash", cct.gitHash)
filesMatching("data/computercraft/lua/rom/help/credits.txt") {
expand(mapOf("gitContributors" to cct.gitContributors.get()))
}
}
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) }

View File

@ -9,7 +9,7 @@ import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.ILuaAPI;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.shared.util.StringUtil;
import dan200.computercraft.core.util.StringUtil;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;

View File

@ -16,7 +16,7 @@ import dan200.computercraft.core.asm.LuaMethod;
import dan200.computercraft.core.asm.PeripheralMethod;
import dan200.computercraft.core.computer.ComputerSide;
import dan200.computercraft.core.metrics.Metrics;
import dan200.computercraft.shared.util.LuaUtil;
import dan200.computercraft.core.util.LuaUtil;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

View File

@ -10,7 +10,7 @@ import dan200.computercraft.api.lua.ILuaAPI;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.core.util.Colour;
import javax.annotation.Nonnull;

View File

@ -8,10 +8,9 @@ package dan200.computercraft.core.apis;
import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.core.terminal.Palette;
import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.shared.util.Palette;
import dan200.computercraft.shared.util.StringUtil;
import org.apache.commons.lang3.ArrayUtils;
import dan200.computercraft.core.util.StringUtil;
import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
@ -336,7 +335,8 @@ public abstract class TermMethods {
var colour = 15 - parseColour(colourArg);
var terminal = getTerminal();
synchronized (terminal) {
return ArrayUtils.toObject(terminal.getPalette().getColour(colour));
var colourValues = terminal.getPalette().getColour(colour);
return new Object[]{ colourValues[0], colourValues[1], colourValues[2] };
}
}

View File

@ -9,7 +9,7 @@ import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.core.filesystem.TrackingCloseable;
import dan200.computercraft.shared.util.StringUtil;
import dan200.computercraft.core.util.StringUtil;
import javax.annotation.Nonnull;
import java.io.BufferedWriter;

View File

@ -8,7 +8,7 @@ package dan200.computercraft.core.apis.handles;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.core.filesystem.TrackingCloseable;
import dan200.computercraft.shared.util.IoUtil;
import dan200.computercraft.core.util.IoUtil;
import javax.annotation.Nonnull;
import java.io.IOException;

View File

@ -9,7 +9,7 @@ import dan200.computercraft.core.CoreConfig;
import dan200.computercraft.core.apis.http.options.Action;
import dan200.computercraft.core.apis.http.options.AddressRule;
import dan200.computercraft.core.apis.http.options.Options;
import dan200.computercraft.shared.util.ThreadUtils;
import dan200.computercraft.core.util.ThreadUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ConnectTimeoutException;
import io.netty.channel.EventLoopGroup;

View File

@ -5,7 +5,7 @@
*/
package dan200.computercraft.core.apis.http;
import dan200.computercraft.shared.util.IoUtil;
import dan200.computercraft.core.util.IoUtil;
import io.netty.channel.ChannelFuture;
import java.io.Closeable;

View File

@ -13,7 +13,7 @@ import dan200.computercraft.core.apis.http.NetworkUtils;
import dan200.computercraft.core.apis.http.Resource;
import dan200.computercraft.core.apis.http.ResourceGroup;
import dan200.computercraft.core.apis.http.options.Options;
import dan200.computercraft.shared.util.IoUtil;
import dan200.computercraft.core.util.IoUtil;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;

View File

@ -9,7 +9,7 @@ import com.google.common.base.Objects;
import dan200.computercraft.api.lua.*;
import dan200.computercraft.core.apis.http.options.Options;
import dan200.computercraft.core.metrics.Metrics;
import dan200.computercraft.shared.util.StringUtil;
import dan200.computercraft.core.util.StringUtil;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;

View File

@ -17,8 +17,8 @@ import dan200.computercraft.core.lua.ILuaMachine;
import dan200.computercraft.core.lua.MachineEnvironment;
import dan200.computercraft.core.metrics.Metrics;
import dan200.computercraft.core.metrics.MetricsObserver;
import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.IoUtil;
import dan200.computercraft.core.util.Colour;
import dan200.computercraft.core.util.IoUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -9,7 +9,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.errorprone.annotations.concurrent.GuardedBy;
import dan200.computercraft.core.ComputerContext;
import dan200.computercraft.core.Logging;
import dan200.computercraft.shared.util.ThreadUtils;
import dan200.computercraft.core.util.ThreadUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -10,7 +10,7 @@ import dan200.computercraft.api.filesystem.IFileSystem;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.api.filesystem.IWritableMount;
import dan200.computercraft.core.CoreConfig;
import dan200.computercraft.shared.util.IoUtil;
import dan200.computercraft.core.util.IoUtil;
import javax.annotation.Nonnull;
import java.io.Closeable;

View File

@ -5,7 +5,7 @@
*/
package dan200.computercraft.core.filesystem;
import dan200.computercraft.shared.util.IoUtil;
import dan200.computercraft.core.util.IoUtil;
import javax.annotation.Nonnull;
import java.io.Closeable;

View File

@ -11,7 +11,7 @@ import com.google.common.io.ByteStreams;
import dan200.computercraft.api.filesystem.FileOperationException;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.core.apis.handles.ArrayByteChannel;
import dan200.computercraft.shared.util.IoUtil;
import dan200.computercraft.core.util.IoUtil;
import javax.annotation.Nonnull;
import java.io.File;

View File

@ -15,7 +15,7 @@ import dan200.computercraft.core.asm.LuaMethod;
import dan200.computercraft.core.asm.ObjectSource;
import dan200.computercraft.core.computer.TimeoutState;
import dan200.computercraft.core.metrics.Metrics;
import dan200.computercraft.shared.util.ThreadUtils;
import dan200.computercraft.core.util.ThreadUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.squiddev.cobalt.*;

View File

@ -3,7 +3,9 @@
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.util;
package dan200.computercraft.core.terminal;
import dan200.computercraft.core.util.Colour;
import javax.annotation.Nonnull;

View File

@ -5,8 +5,7 @@
*/
package dan200.computercraft.core.terminal;
import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.Palette;
import dan200.computercraft.core.util.Colour;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

View File

@ -3,7 +3,7 @@
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.util;
package dan200.computercraft.core.util;
public enum Colour {
BLACK(0x111111),

View File

@ -3,7 +3,7 @@
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.util;
package dan200.computercraft.core.util;
import javax.annotation.Nullable;
import java.io.Closeable;

Some files were not shown because too many files have changed in this diff Show More