Compare commits
1 commit
main
...
paperclip-
Author | SHA1 | Date | |
---|---|---|---|
|
80ae37484a |
150 changed files with 50 additions and 59 deletions
|
@ -35,7 +35,7 @@ fun ShadowJar.configureStandard() {
|
|||
|
||||
val sourcesJar by tasks.existing(AbstractArchiveTask::class) {
|
||||
from(
|
||||
zipTree(project(":nugget-lib").tasks
|
||||
zipTree(project(":paperweight-lib").tasks
|
||||
.named("sourcesJar", AbstractArchiveTask::class)
|
||||
.flatMap { it.archiveFile })
|
||||
) {
|
||||
|
@ -43,15 +43,15 @@ val sourcesJar by tasks.existing(AbstractArchiveTask::class) {
|
|||
}
|
||||
}
|
||||
|
||||
val prefix = project.name.substringAfter("nugget-")
|
||||
val prefix = project.name.substringAfter("paperweight-")
|
||||
|
||||
gradlePlugin {
|
||||
website.set("https://git.zontreck.com/ObsidianMC/nugget")
|
||||
vcsUrl.set("https://git.zontreck.com/ObsidianMC/nugget")
|
||||
plugins.create("nugget-$prefix") {
|
||||
website.set("https://github.com/PaperMC/paperweight")
|
||||
vcsUrl.set("https://github.com/PaperMC/paperweight")
|
||||
plugins.create("paperweight-$prefix") {
|
||||
id = "io.papermc.paperweight." + prefix
|
||||
displayName = "nugget $prefix"
|
||||
tags.set(listOf("obsidian", "minecraft"))
|
||||
displayName = "paperweight $prefix"
|
||||
tags.set(listOf("paper", "minecraft"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ val shadowJar by tasks.existing(ShadowJar::class) {
|
|||
return@existing
|
||||
}
|
||||
|
||||
val prefix = "obsidian.libs"
|
||||
val prefix = "paper.libs"
|
||||
listOf(
|
||||
"com.github.salomonbrys.kotson",
|
||||
"com.google.errorprone.annotations",
|
||||
|
@ -91,21 +91,11 @@ val shadowJar by tasks.existing(ShadowJar::class) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
val MAVEN_PASSWORD = "AriasCreationsMavenPassword"
|
||||
val MAVEN_USER = "AriasCreationsMavenUser"
|
||||
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://git.zontreck.com/api/packages/ObsidianMC/maven")
|
||||
name = "obsidian"
|
||||
|
||||
credentials {
|
||||
username = project.findProperty(MAVEN_USER)?.toString()
|
||||
password = project.findProperty(MAVEN_PASSWORD)?.toString()
|
||||
}
|
||||
maven("https://repo.papermc.io/repository/maven-snapshots/") {
|
||||
credentials(PasswordCredentials::class)
|
||||
name = "paper"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,11 +109,11 @@ publishing {
|
|||
}
|
||||
|
||||
fun MavenPom.pomConfig() {
|
||||
val repoPath = "ObsidianMC/nugget"
|
||||
val repoUrl = "https://git.zontreck.com/$repoPath"
|
||||
val repoPath = "PaperMC/paperweight"
|
||||
val repoUrl = "https://github.com/$repoPath"
|
||||
|
||||
name.set("nugget")
|
||||
description.set("Gradle plugin for the ObsidianMC project")
|
||||
name.set("paperweight")
|
||||
description.set("Gradle plugin for the PaperMC project")
|
||||
url.set(repoUrl)
|
||||
inceptionYear.set("2020")
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
group = com.zontreck.nugget
|
||||
version = 1.7.4-SNAPSHOT
|
||||
group = io.papermc.paperweight
|
||||
version = 1.7.2-SNAPSHOT
|
||||
|
||||
org.gradle.caching = true
|
||||
org.gradle.parallel = true
|
||||
|
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
shade(projects.nuggetLib)
|
||||
shade(projects.paperweightLib)
|
||||
|
||||
implementation(libs.bundles.kotson)
|
||||
}
|
|
@ -49,7 +49,7 @@ class PaperweightCore : Plugin<Project> {
|
|||
override fun apply(target: Project) {
|
||||
checkJavaVersion()
|
||||
Git.checkForGit()
|
||||
printId<PaperweightCore>("nugget-core", target.gradle)
|
||||
printId<PaperweightCore>("paperweight-core", target.gradle)
|
||||
|
||||
val ext = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightCoreExtension::class, target)
|
||||
|
||||
|
@ -70,7 +70,7 @@ class PaperweightCore : Plugin<Project> {
|
|||
target.configurations.create(DECOMPILER_CONFIG)
|
||||
target.configurations.create(PAPERCLIP_CONFIG)
|
||||
|
||||
if (target.providers.gradleProperty("nugget.dev").orNull == "true") {
|
||||
if (target.providers.gradleProperty("paperweight.dev").orNull == "true") {
|
||||
target.tasks.register<CreateDiffOutput>("diff") {
|
||||
inputDir.convention(ext.paper.paperServerDir.map { it.dir("src/main/java") })
|
||||
val prop = target.providers.gradleProperty("paperweight.diff.output")
|
|
@ -109,11 +109,27 @@ abstract class CreateBundlerJar : ZippedTask() {
|
|||
rootDir.resolve("META-INF/main-class").writeText(mainClass.get())
|
||||
|
||||
// copy version.json file
|
||||
vanillaBundlerJar.path.openZip().use { fs ->
|
||||
fs.getPath("/").resolve(FileEntry.VERSION_JSON).copyTo(rootDir.resolve("version.json"))
|
||||
val versionJson = vanillaBundlerJar.path.openZip().use { fs ->
|
||||
val source = fs.getPath("/").resolve(FileEntry.VERSION_JSON)
|
||||
source.copyTo(rootDir.resolve("version.json"))
|
||||
source.bufferedReader().use {
|
||||
gson.fromJson(it, VersionJson::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
modifyManifest(rootDir.resolve("META-INF/MANIFEST.MF")) {
|
||||
mainAttributes.putValue("Minecraft-Version", versionJson.name)
|
||||
mainAttributes.putValue("Java-Runtime-Major-Version", versionJson.java_version)
|
||||
}
|
||||
}
|
||||
|
||||
data class VersionJson(
|
||||
val id: String,
|
||||
val name: String,
|
||||
@Suppress("PropertyName")
|
||||
val java_version: String,
|
||||
)
|
||||
|
||||
private fun handleServerDependencies(rootDir: Path): List<FileEntry<ModuleId>> {
|
||||
val libraries = mutableListOf<FileEntry<ModuleId>>()
|
||||
val changedLibraries = mutableListOf<LibraryChange>()
|
|
@ -97,7 +97,7 @@ abstract class RebuildGitPatches : ControllableOutputTask() {
|
|||
git("fetch", "--all", "--prune").runSilently(silenceErr = true)
|
||||
git(
|
||||
"format-patch",
|
||||
"--diff-algorithm=myers", "--zero-commit", "--full-index", "--no-signature", "--no-stat", "-N",
|
||||
"--zero-commit", "--full-index", "--no-signature", "--no-stat", "-N",
|
||||
"-o", patchFolder.absolutePathString(),
|
||||
baseRef.get()
|
||||
).executeSilently()
|
||||
|
@ -131,7 +131,7 @@ abstract class RebuildGitPatches : ControllableOutputTask() {
|
|||
try {
|
||||
for (patch in patchFiles) {
|
||||
futures += executor.submit {
|
||||
val hasNoChanges = git("diff", "--diff-algorithm=myers", "--staged", patch.name).getText().lineSequence()
|
||||
val hasNoChanges = git("diff", "--staged", patch.name).getText().lineSequence()
|
||||
.filter { it.startsWith('+') || it.startsWith('-') }
|
||||
.filterNot { it.startsWith("+++") || it.startsWith("---") }
|
||||
.all { it.startsWith("+index") || it.startsWith("-index") }
|
|
@ -76,13 +76,6 @@ abstract class RemapJar : JavaLauncherTask() {
|
|||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
if (inputJar.path.absolute().normalize() == outputJar.path.absolute().normalize()) {
|
||||
throw PaperweightException(
|
||||
"Invalid configuration, inputJar and outputJar point to the same path: ${inputJar.path}\n" +
|
||||
"Consider removing customization of output locations, following the default Gradle conventions."
|
||||
)
|
||||
}
|
||||
|
||||
if (toNamespace.get() != fromNamespace.get()) {
|
||||
val logFile = layout.cache.resolve(paperTaskOutput("log"))
|
||||
TinyRemapper.run(
|
|
@ -103,7 +103,7 @@ class PatchApplier(
|
|||
target.createDirectories()
|
||||
git("checkout", remappedBranch).executeSilently()
|
||||
git(
|
||||
"format-patch", "--diff-algorith=myers", "--zero-commit", "--full-index", "--no-signature", "--no-stat", "-N", "-o",
|
||||
"format-patch", "--zero-commit", "--full-index", "--no-signature", "--no-stat", "-N", "-o",
|
||||
target.absolutePathString(), remappedBaseTag
|
||||
).executeOut()
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class PatchApplier(
|
|||
}
|
||||
|
||||
git("update-index", "--refresh").executeSilently()
|
||||
if (git("diff-index", "--diff-algorithm=myers", "--quiet", "HEAD", "--").runSilently() == 0) {
|
||||
if (git("diff-index", "--quiet", "HEAD", "--").runSilently() == 0) {
|
||||
return git("log", unmappedBranch, "-1", "--pretty=%B").getText().trim() !=
|
||||
git("log", remappedBranch, "-1", "--pretty=%B").getText().trim()
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue