Skip to content

Commit

Permalink
[2.0.5] 修复 skipTabooLibRelocate 异常
Browse files Browse the repository at this point in the history
  • Loading branch information
Bkm016 committed Feb 8, 2024
1 parent 5c7c828 commit bab5696
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "io.izzel.taboolib"
version = "2.0.4"
version = "2.0.5"

configurations {
create("embed") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class TabooLibMainTask extends DefaultTask {
if (tabooExt.env.modules.contains(it.module)) {
try {
out.putNextEntry(new JarEntry(it.file))
out.write(it.builder.build(tabooExt.des, project))
out.write(it.builder.build(tabooExt.des, project, tabooExt))
} catch (ZipException ignored) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import com.google.gson.GsonBuilder
import com.google.gson.JsonArray
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

import java.nio.charset.StandardCharsets

abstract class Builder {

abstract byte[] build(Description description, Project project)
abstract byte[] build(Description description, Project project, TabooLibExtension tabooLibExt)

static List<String> startBukkitFile() {
def str = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package io.izzel.taboolib.gradle.description

import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

class BuilderBukkit extends Builder {

@Override
byte[] build(Description description, Project project) {
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
def body = startBukkitFile()
body += "name: ${description.name ?: project.name}"
body += "main: ${project.group}.taboolib.platform.BukkitPlugin"

if (tabooLibExt.version.skipTabooLibRelocate) {
body += "main: taboolib.platform.BukkitPlugin"
} else {
body += "main: ${project.group}.taboolib.platform.BukkitPlugin"
}

body += "version: ${project.version}"
write(body, description.lin.links['homepage'], 'website')
writeLine(body)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package io.izzel.taboolib.gradle.description

import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

class BuilderBungee extends Builder {

@Override
byte[] build(Description description, Project project) {
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
def body = startBukkitFile()
body += "name: ${description.name ?: project.name}"
body += "main: ${project.group}.taboolib.platform.BungeePlugin"

if (tabooLibExt.version.skipTabooLibRelocate) {
body += "main: taboolib.platform.BungeePlugin"
} else {
body += "main: ${project.group}.taboolib.platform.BungeePlugin"
}

body += "version: ${project.version}"
write(body, description.lin.links['homepage'], 'website')
writeLine(body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.izzel.taboolib.gradle.description

import com.google.gson.JsonArray
import com.google.gson.JsonObject
import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

/**
Expand All @@ -12,11 +13,17 @@ import org.gradle.api.Project
*/
class BuilderCloudNetV3 extends Builder {
@Override
byte[] build(Description description, Project project) {
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
def info = new JsonObject()
info.addProperty('group', project.group.toString())
info.addProperty('name', description.name ?: project.name)
info.addProperty('main', "${project.group}.taboolib.platform.CloudNetV3Plugin")

if (tabooLibExt.version.skipTabooLibRelocate) {
info.addProperty('main', "taboolib.platform.CloudNetV3Plugin")
} else {
info.addProperty('main', "${project.group}.taboolib.platform.CloudNetV3Plugin")
}

info.addProperty('version', project.version.toString())
// authors
def con = description.con.contributors.collect { it.name }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package io.izzel.taboolib.gradle.description

import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

class BuilderNukkit extends Builder {

@Override
byte[] build(Description description, Project project) {
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
def body = startBukkitFile()
body += "name: ${description.name ?: project.name}"
body += "main: ${project.group}.taboolib.platform.NukkitPlugin"

if (tabooLibExt.version.skipTabooLibRelocate) {
body += "main: taboolib.platform.NukkitPlugin"
} else {
body += "main: ${project.group}.taboolib.platform.NukkitPlugin"
}

body += "version: ${project.version}"
write(body, description.lin.links['homepage'], 'website')
writeLine(body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package io.izzel.taboolib.gradle.description

import com.google.gson.JsonArray
import com.google.gson.JsonObject
import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

class BuilderSponge7 extends Builder {

@Override
byte[] build(Description description, Project project) {
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
def json = new JsonArray()
def info = new JsonObject()
info.addProperty('modid', project.name.toLowerCase())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@ package io.izzel.taboolib.gradle.description

import com.google.gson.JsonArray
import com.google.gson.JsonObject
import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

class BuilderSponge8 extends Builder {

@Override
byte[] build(Description description, Project project) {
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
def json = new JsonObject()
def plugins = new JsonArray()
def info = new JsonObject()
info.addProperty('loader', 'java_plain')
info.addProperty('id', (description.name ?: project.name).toLowerCase())
info.addProperty('name', description.name ?: project.name)
info.addProperty('version', project.version.toString())
info.addProperty('main-class', "${project.group}.taboolib.platform.Sponge8Plugin")

if (tabooLibExt.version.skipTabooLibRelocate) {
info.addProperty('main-class', "taboolib.platform.Sponge8Plugin")
} else {
info.addProperty('main-class', "${project.group}.taboolib.platform.Sponge8Plugin")
}

write(info, description.spongeDesc, 'description')
// links
if (description.lin.links.size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ package io.izzel.taboolib.gradle.description

import com.google.gson.JsonArray
import com.google.gson.JsonObject
import io.izzel.taboolib.gradle.TabooLibExtension
import org.gradle.api.Project

class BuilderVelocity extends Builder {

@Override
byte[] build(Description description, Project project) {
byte[] build(Description description, Project project, TabooLibExtension tabooLibExt) {
def info = new JsonObject()
info.addProperty('id', (description.name ?: project.name).toLowerCase())
info.addProperty('name', description.name ?: project.name)
info.addProperty('main', "${project.group}.taboolib.platform.VelocityPlugin")

if (tabooLibExt.version.skipTabooLibRelocate) {
info.addProperty('main', "taboolib.platform.VelocityPlugin")
} else {
info.addProperty('main', "${project.group}.taboolib.platform.VelocityPlugin")
}

info.addProperty('version', project.version.toString())
// authors
def con = description.con.contributors.collect { it.name }
Expand Down

0 comments on commit bab5696

Please sign in to comment.