Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Dec 14, 2024
1 parent e55f818 commit 86b9aa4
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 156 deletions.
62 changes: 0 additions & 62 deletions build-data/dev-imports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,65 +12,3 @@
# mc_data chat_type/chat.json
# mc_data dimension_type/overworld.json
#

minecraft net/minecraft/server/commands/AdvancementCommands.java
minecraft net/minecraft/server/commands/AttributeCommand.java
minecraft net/minecraft/server/commands/BanListCommands.java
minecraft net/minecraft/server/commands/BossBarCommands.java
minecraft net/minecraft/server/commands/ChaseCommand.java
minecraft net/minecraft/server/commands/ClearInventoryCommands.java
minecraft net/minecraft/server/commands/CloneCommands.java
minecraft net/minecraft/server/commands/DamageCommand.java
minecraft net/minecraft/server/commands/DataPackCommand.java
minecraft net/minecraft/server/commands/DebugCommand.java
minecraft net/minecraft/server/commands/DebugConfigCommand.java
minecraft net/minecraft/server/commands/DebugMobSpawningCommand.java
minecraft net/minecraft/server/commands/DebugPathCommand.java
minecraft net/minecraft/server/commands/EmoteCommands.java
minecraft net/minecraft/server/commands/ExecuteCommand.java
minecraft net/minecraft/server/commands/ExperienceCommand.java
minecraft net/minecraft/server/commands/FillBiomeCommand.java
minecraft net/minecraft/server/commands/FillCommand.java
minecraft net/minecraft/server/commands/ForceLoadCommand.java
minecraft net/minecraft/server/commands/FunctionCommand.java
minecraft net/minecraft/server/commands/HelpCommand.java
minecraft net/minecraft/server/commands/ItemCommands.java
minecraft net/minecraft/server/commands/JfrCommand.java
minecraft net/minecraft/server/commands/KillCommand.java
minecraft net/minecraft/server/commands/LocateCommand.java
minecraft net/minecraft/server/commands/LookAt.java
minecraft net/minecraft/server/commands/MsgCommand.java
minecraft net/minecraft/server/commands/PardonCommand.java
minecraft net/minecraft/server/commands/PardonIpCommand.java
minecraft net/minecraft/server/commands/ParticleCommand.java
minecraft net/minecraft/server/commands/PerfCommand.java
minecraft net/minecraft/server/commands/PlaySoundCommand.java
minecraft net/minecraft/server/commands/PublishCommand.java
minecraft net/minecraft/server/commands/RaidCommand.java
minecraft net/minecraft/server/commands/RandomCommand.java
minecraft net/minecraft/server/commands/RecipeCommand.java
minecraft net/minecraft/server/commands/ReturnCommand.java
minecraft net/minecraft/server/commands/RideCommand.java
minecraft net/minecraft/server/commands/RotateCommand.java
minecraft net/minecraft/server/commands/SaveAllCommand.java
minecraft net/minecraft/server/commands/SaveOffCommand.java
minecraft net/minecraft/server/commands/SaveOnCommand.java
minecraft net/minecraft/server/commands/SayCommand.java
minecraft net/minecraft/server/commands/ScoreboardCommand.java
minecraft net/minecraft/server/commands/SeedCommand.java
minecraft net/minecraft/server/commands/ServerPackCommand.java
minecraft net/minecraft/server/commands/SetBlockCommand.java
minecraft net/minecraft/server/commands/SetPlayerIdleTimeoutCommand.java
minecraft net/minecraft/server/commands/SpawnArmorTrimsCommand.java
minecraft net/minecraft/server/commands/SpectateCommand.java
minecraft net/minecraft/server/commands/StopCommand.java
minecraft net/minecraft/server/commands/StopSoundCommand.java
minecraft net/minecraft/server/commands/TagCommand.java
minecraft net/minecraft/server/commands/TeamCommand.java
minecraft net/minecraft/server/commands/TeamMsgCommand.java
minecraft net/minecraft/server/commands/TellRawCommand.java
minecraft net/minecraft/server/commands/TitleCommand.java
minecraft net/minecraft/server/commands/TransferCommand.java
minecraft net/minecraft/server/commands/TriggerCommand.java
minecraft net/minecraft/server/commands/WardenSpawnTrackerCommand.java
minecraft net/minecraft/server/commands/WhitelistCommand.java
164 changes: 79 additions & 85 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,117 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
java
`maven-publish`
`kotlin-dsl`
`maven-publish`
`always-up-to-date`
alias(libs.plugins.shadow) apply false
alias(libs.plugins.paperweight)
}

val jdkVersion = property("jdkVersion").toString().toInt()
val providerRepo = property("providerRepo").toString()
val brandName = property("brandName").toString()

kotlin.jvmToolchain(jdkVersion)

val paperMcRepo = "https://repo.papermc.io/repository/maven-public/"
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/") {
maven(paperMcRepo) {
name = "papermc-repo"
content { onlyForConfigurations(configurations.paperclip.name) }
}
maven("https://repo.codemc.io/repository/maven-public/") {
name = "codemc-repo"
}
}

dependencies {
remapper(libs.remapper)
decompiler(libs.decompiler)
paperclip(libs.paperclip)
decompiler(libs.decompiler)
}

val brandName: String by project
val providerRepo: String by project
paperweight {
serverProject = project(":${brandName.lowercase()}-server")

remapRepo = paperMcRepo
decompileRepo = paperMcRepo

useStandardUpstream("paper") {
url = github("PaperMC", "Paper-archive")
ref = providers.gradleProperty("paperCommit")

withStandardPatcher {
baseName("Paper")

apiPatchDir.set(projectDir.resolve("patches/api"))
apiOutputDir.set(projectDir.resolve("$brandName-API"))

serverPatchDir.set(projectDir.resolve("patches/server"))
serverOutputDir.set(projectDir.resolve("$brandName-Server"))
}

patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = projectDir.resolve("patches/generated-api")
outputDir = projectDir.resolve("paper-api-generator/generated")
}
}
}

tasks {
applyPatches {
dependsOn("applyGeneratedApiPatches")
}

rebuildPatches {
dependsOn("rebuildGeneratedApiPatches")
}

generateDevelopmentBundle {
apiCoordinates.set("${project.group}:${brandName.lowercase()}-api")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
"https://maven.pkg.github.com/$providerRepo",
"https://papermc.io/repo/repository/maven-public/"
)
}
}

publishing.publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) { artifactId = "dev-bundle" }
}

val mavenUrl: String? by project
val mavenUsername: String? by project
val mavenPassword: String? by project
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")

java.toolchain.languageVersion.set(JavaLanguageVersion.of(jdkVersion))

publishing.repositories.maven("https://maven.pkg.github.com/$providerRepo") {
name = "githubPackage"
mavenUrl?.let {
publishing.repositories.maven(it) {
name = "codemc-repo"

credentials {
username = providers.systemProperty("ghName").orElse(providers.gradleProperty("ghName")).getOrElse(System.getenv("GITHUB_NAME"))
password = providers.systemProperty("ghToken").orElse(providers.gradleProperty("ghToken")).getOrElse(System.getenv("GITHUB_TOKEN"))
credentials {
username = mavenUsername
password = mavenPassword
}
}
}
}

subprojects {
repositories {
mavenCentral()
maven(paperMcRepo)
maven("https://jitpack.io")
maven("https://repo.codemc.io/repository/maven-public/")
}

tasks {
withType<JavaCompile>().configureEach {
options.encoding = Charsets.UTF_8.name()
Expand All @@ -68,36 +136,6 @@ subprojects {
}
}
}

repositories {
mavenCentral()
maven("https://jitpack.io")
maven("https://papermc.io/repo/repository/maven-public/")
}
}

paperweight {
serverProject = project(":${brandName.lowercase()}-server")

remapRepo = "https://repo.papermc.io/repository/maven-public/"
decompileRepo = "https://repo.papermc.io/repository/maven-public/"

usePaperUpstream(providers.gradleProperty("paperCommit")) {
withPaperPatcher {
apiPatchDir.set(projectDir.resolve("patches/api"))
apiOutputDir.set(projectDir.resolve("$brandName-API"))

serverPatchDir.set(projectDir.resolve("patches/server"))
serverOutputDir.set(projectDir.resolve("$brandName-Server"))
}

patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = projectDir.resolve("patches/generated-api")
outputDir = projectDir.resolve("paper-api-generator/generated")
}
}
}

val paperRepoVal = property("paperRepo").toString()
Expand All @@ -107,7 +145,6 @@ val purpurBranch = property("purpurBranch").toString()
val pufferfishRepoVal = property("pufferfishRepo").toString()
val pufferfishBranch = property("pufferfishBranch").toString()
val isUsePufferfish = property("usePufferfish").toString().toBoolean()

alwaysUpToDate {

paperRepo.set(paperRepoVal)
Expand All @@ -123,46 +160,3 @@ alwaysUpToDate {
usePufferfish.set(isUsePufferfish)

}

tasks {
applyPatches {
dependsOn("applyGeneratedApiPatches")
}

rebuildPatches {
dependsOn("rebuildGeneratedApiPatches")
}

generateDevelopmentBundle {
apiCoordinates.set("${project.group}:${brandName.lowercase()}-api")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
"https://maven.pkg.github.com/$providerRepo",
"https://papermc.io/repo/repository/maven-public/"
)
}

clean {
doLast {
listOf(
".gradle/caches",
"$brandName-API",
"$brandName-Server",
"paper-api-generator",
"run",

// remove dev environment files
"0001-fixup.patch",
"compare.txt"
).forEach {
projectDir.resolve(it).deleteRecursively()
}
}
}
}

publishing {
publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) { artifactId = "dev-bundle" }
}
}
2 changes: 1 addition & 1 deletion initDev
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ alias fa="ca __generate_fixup_patch"
alias fg="cg __generate_fixup_patch"
alias fs="cs __generate_fixup_patch"

hash gradle 2>&1 && alias gradle="./gradlew"
alias gradle="./gradlew" # TODO: Paperweight will not work with Gradle 8.10.2
alias gr="cd $PROJECT_DIR; gradle"
alias grc="gr --no-rebuild"

Expand Down
Loading

0 comments on commit 86b9aa4

Please sign in to comment.