Compare commits

..

14 Commits
1.17 ... master

Author SHA1 Message Date
坏黑 be620a1247 1.27 Fix website 2021-09-13 23:14:19 +08:00
坏黑 b7d5a97452 1.26 2021-08-25 16:19:52 +08:00
坏黑 ce8fe9c4bf 1.26 2021-08-25 16:19:20 +08:00
坏黑 8596bcae2c 1.25 2021-08-23 16:42:16 +08:00
坏黑 9dfb9d1876 1.24 2021-08-23 14:26:01 +08:00
坏黑 9c88efae69 Merge branch 'master' of https://github.com/TabooLib/taboolib-gradle-plugin
# Conflicts:
#	build.gradle
2021-08-23 14:11:32 +08:00
坏黑 43fc609549 1.23 2021-08-23 14:10:09 +08:00
坏黑 07512c45d9
Update build.gradle 2021-08-19 17:43:03 +08:00
坏黑 2a93a9e3d5
Merge pull request #7 from Itsusinn/master
build: update asm version
2021-08-19 17:42:48 +08:00
坏黑 3360b596d5
Update build.gradle 2021-08-19 17:40:53 +08:00
坏黑 8633b8e40d 1.20 2021-08-19 17:14:08 +08:00
坏黑 49751521f8 1.19 2021-08-19 16:06:03 +08:00
itsusinn 329f659f41
build: update asm version
support java bytecode version 16,17,18
2021-08-19 09:12:24 +08:00
坏黑 b53a0d68d2 1.18 2021-08-16 22:37:07 +08:00
8 changed files with 62 additions and 11 deletions

View File

@ -9,7 +9,7 @@ plugins {
apply plugin: 'kotlin'
group 'io.izzel.taboolib'
version '1.17'
version '1.27'
configurations {
embed
@ -24,8 +24,8 @@ dependencies {
compile 'org.codehaus.groovy:groovy:2.5.13'
compile gradleApi()
compile localGroovy()
embed 'org.ow2.asm:asm:8.0.1'
embed 'org.ow2.asm:asm-commons:8.0.1'
embed 'org.ow2.asm:asm:9.2'
embed 'org.ow2.asm:asm-commons:9.2'
embed 'com.google.code.gson:gson:2.8.7'
embed 'org.jetbrains.kotlin:kotlin-stdlib'
}
@ -57,4 +57,16 @@ publishing {
url = file("/Users/sky/Desktop/repo")
}
}
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

View File

@ -50,6 +50,6 @@ class KotlinAnnotationVisitor extends AnnotationVisitor {
}
String getKotlinVersionEscape() {
return getKotlinVersion().replaceAll("[.-]", "_")
return getKotlinVersion().replaceAll("[._-]", "")
}
}

View File

@ -0,0 +1,29 @@
package io.izzel.taboolib.gradle
import org.gradle.api.Project
import org.objectweb.asm.AnnotationVisitor
import org.objectweb.asm.Opcodes
class KotlinMetaAnnotationVisitor extends AnnotationVisitor {
Project project
KotlinMetaAnnotationVisitor(AnnotationVisitor annotationVisitor, project) {
super(Opcodes.ASM7, annotationVisitor)
this.project = project
}
@Override
void visit(String name, Object value) {
if (value instanceof String) {
super.visit(name, value.replace("taboolib", "${project.group.replace('.', '/')}/taboolib"))
} else {
super.visit(name, value)
}
}
@Override
AnnotationVisitor visitArray(String name) {
return new KotlinMetaAnnotationVisitor(super.visitArray(name), project)
}
}

View File

@ -29,6 +29,9 @@ class RelocateRemapper extends Remapper {
if (remapper != null) {
use.computeIfAbsent(remapper.className) { new HashSet() }.add(internalName)
}
if (internalName.startsWith('kotlin/Metadata')) {
return internalName
}
def match = slash.find { internalName.startsWith(it.key) }
if (match) {
return match.value + internalName.substring(match.key.length())

View File

@ -40,7 +40,9 @@ class TabooLibClassVisitor extends ClassVisitor {
@Override
AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
if (descriptor == "L${project.group.replace('.', '/')}/taboolib/common/Isolated;") {
if (descriptor == "Lkotlin/Metadata;") {
return new KotlinMetaAnnotationVisitor(super.visitAnnotation(descriptor, visible), project)
} else if (descriptor == "L${project.group.replace('.', '/')}/taboolib/common/Isolated;") {
return new IsolatedAnnotationVisitor(super.visitAnnotation(descriptor, visible), project, name, this)
} else if (descriptor == "L${project.group.replace('.', '/')}/taboolib/common/env/RuntimeDependency;") {
return new KotlinAnnotationVisitor(super.visitAnnotation(descriptor, visible), project)

View File

@ -22,7 +22,7 @@ class TabooLibPlugin implements Plugin<Project> {
project.tasks.jar.configure { Jar task ->
task.from(taboo.collect { it.isDirectory() ? it : project.zipTree(it) })
}
def kv = project.plugins.findPlugin("org.jetbrains.kotlin.jvm").kotlinPluginVersion.replaceAll("[.-]", "_")
def kv = project.plugins.findPlugin("org.jetbrains.kotlin.jvm").kotlinPluginVersion.replaceAll("[._-]", "")
def jarTask = project.tasks.jar as Jar
tabooTask.configure { RelocateJar task ->
task.tabooExt = tabooExt
@ -31,8 +31,8 @@ class TabooLibPlugin implements Plugin<Project> {
task.relocations = tabooExt.relocation
task.classifier = tabooExt.classifier
task.relocations['taboolib'] = project.group.toString() + '.taboolib'
if (!tabooExt.options.contains("skip-kotlin")) {
task.relocations['kotlin'] = 'taboolib.library.kotlin_' + kv
if (!tabooExt.options.contains("skip-kotlin") && !tabooExt.options.contains("skip-kotlin-relocate")) {
task.relocations['kotlin.'] = 'kotlin' + kv + '.'
}
}
}

View File

@ -23,5 +23,10 @@ class Links {
this.url = url
return this
}
@Override
String toString() {
return url
}
}
}

View File

@ -106,7 +106,7 @@ class OptimizeFileReader(project: Project, input: InputStream) {
if (member.any { name.startsWith(it) }) {
if (depend != null) {
val fail = depend.name.any { n ->
val set = use[n]!!.toMutableList()
val set = use[n]?.toMutableList() ?: ArrayList()
set.remove(n)
set.removeAll(depend.exclude)
set.isNotEmpty()
@ -116,7 +116,7 @@ class OptimizeFileReader(project: Project, input: InputStream) {
}
}
for (s in check) {
val set = use[s]!!.toMutableList()
val set = use[s]?.toMutableList() ?: ArrayList()
set.remove(s)
set.removeAll(check)
set.removeAll(member)