Skip to content

Commit

Permalink
It Compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Jan 11, 2025
1 parent c1c9507 commit d001947
Show file tree
Hide file tree
Showing 492 changed files with 229 additions and 61,700 deletions.
113 changes: 2 additions & 111 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ base {

sourceSets {
main {
java {
srcDir 'src/main/flatbuffers/generated'
}
resources {
srcDir 'src/generated/resources'
}
Expand All @@ -68,29 +65,11 @@ import appengbuild.*
import com.diffplug.gradle.spotless.JsonExtension

dependencies {
// To be copied into the jar file
shaded project(path: ':libs:markdown', configuration: "archives")
shaded "io.methvin:directory-watcher:${directory_watcher_version}"
shaded "org.yaml:snakeyaml:${snakeyaml_version}"
shaded "com.google.flatbuffers:flatbuffers-java:${flatbuffers_version}"

implementation(project(':libs:markdown')) {
transitive = false
}
// Do not inherit any transitive dependencies here since we rely on those dependencies being
// present in Minecrafts own dependencies already.
implementation("io.methvin:directory-watcher:${directory_watcher_version}") {
transitive = false
}
implementation("org.yaml:snakeyaml:${snakeyaml_version}") {
transitive = false
}
implementation("com.google.flatbuffers:flatbuffers-java:${flatbuffers_version}") {
transitive = false
}
// Used for the guide export
guideExportOnly("org.bytedeco:ffmpeg-platform:${ffmpeg_version}")

implementation("appeng:guideme")

// compile against provided APIs
compileOnly "dev.emi:emi-neoforge:${emi_version}:api"
compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:${project.rei_version}"
Expand Down Expand Up @@ -346,9 +325,6 @@ tasks.register('apiJar', Jar) {
// api jar ist just a development aid and serves as both a binary and source jar simultaneously
from sourceSets.main.output
from sourceSets.main.allJava
manifest {
attributes("Fabric-Loom-Remap": true)
}
}
apiJar publicApiIncludePatterns

Expand Down Expand Up @@ -449,88 +425,3 @@ check.dependsOn tasks.register('validateResources', JavaExec) {
args "guidebook"
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}

/**
* This task download the FlatBuffers compiler suitable for the current platform.
*/
tasks.register('downloadFlatbufferCompiler', Download) {
var os = System.getProperty("os.name").toLowerCase(Locale.ROOT)
var arch = System.getProperty("os.arch")
if (os.startsWith("windows")) {
src "https://github.com/google/flatbuffers/releases/download/v${flatbuffers_version}/Windows.flatc.binary.zip"
} else if (os.startsWith("mac")) {
if (arch == "aarch64") {
src "https://github.com/google/flatbuffers/releases/download/v${flatbuffers_version}/Mac.flatc.binary.zip"
} else if (arch == "amd64") {
src "https://github.com/google/flatbuffers/releases/download/v${flatbuffers_version}/MacIntel.flatc.binary.zip"
} else {
throw new GradleException("Unknown Mac architecture: $arch")
}
} else if (os.startsWith("linux")) {
src "https://github.com/google/flatbuffers/releases/download/v${flatbuffers_version}/Linux.flatc.binary.clang++-12.zip"
} else {
throw new GradleException("Unknown OS: $os")
}
onlyIfModified true
dest layout.buildDirectory.file("flatc.zip")
}

tasks.register('downloadAndUnzipFlatbufferCompiler', Copy) {
dependsOn downloadFlatbufferCompiler
from zipTree(downloadFlatbufferCompiler.dest)
into "${project.buildDir}/flatbuffers-bin"
}
/**
* Update the generated Java Code for our scene export schema.
* The code is checked in so this only needs to be run when the schema changes.
*/
tasks.register('updateFlatbufferSources', Exec) {
group 'build'
dependsOn downloadAndUnzipFlatbufferCompiler
workingDir project.projectDir
commandLine "${project.buildDir}/flatbuffers-bin/flatc",
"--gen-mutable",
"--java-package-prefix", "appeng.flatbuffers",
"--gen-generated",
"--java",
"-o",
"${project.projectDir}/src/main/flatbuffers/generated",
"${project.projectDir}/src/main/flatbuffers/scene.fbs"

doFirst {
file("${project.projectDir}/src/main/flatbuffers/generated").deleteDir()
}
doLast {
}
doLast {
// sadly flatc uses an outdated annotation
def folder = file("${project.projectDir}/src/main/flatbuffers/generated")
folder.eachFileRecurse(groovy.io.FileType.FILES) { file ->
String content = file.text
if (content.contains('@javax.annotation.Generated')) {
content = content.replace('@javax.annotation.Generated', '@javax.annotation.processing.Generated')
file.write(content)
}
}
}
}

/**
* Generate the TypeScript sources for our schema. The sources are manually copied
* over to the website repository.
*/
tasks.register('updateFlatbufferTypescriptSources', Exec) {
group 'build'
dependsOn downloadAndUnzipFlatbufferCompiler
workingDir project.projectDir
commandLine "${project.buildDir}/flatbuffers-bin/flatc",
"--ts-flat-files",
"--ts",
"-o",
"${project.buildDir}/scene-ts",
"${project.projectDir}/src/main/flatbuffers/scene.fbs"

doFirst {
file("${project.buildDir}/scene-ts").deleteDir()
}
}
23 changes: 0 additions & 23 deletions libs/markdown/LICENSE

This file was deleted.

12 changes: 0 additions & 12 deletions libs/markdown/README.md

This file was deleted.

52 changes: 0 additions & 52 deletions libs/markdown/build.gradle

This file was deleted.

14 changes: 0 additions & 14 deletions libs/markdown/src/main/java/appeng/libs/mdast/MdAst.java

This file was deleted.

22 changes: 0 additions & 22 deletions libs/markdown/src/main/java/appeng/libs/mdast/MdAstVisitor.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit d001947

Please sign in to comment.