2023-01-03 06:29:13 -08:00
|
|
|
/*
|
|
|
|
* Copyright 2023 Alexey Andreev.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
`java-library`
|
|
|
|
}
|
|
|
|
|
|
|
|
description = "JavaScript deobfuscator"
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
val teavmCompile = create("teavmCompile")
|
|
|
|
compileClasspath.configure {
|
|
|
|
extendsFrom(teavmCompile)
|
|
|
|
}
|
|
|
|
create("js")
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compileOnly(project(":jso:apis"))
|
|
|
|
"teavmCompile"(project(":classlib"))
|
|
|
|
"teavmCompile"(project(":tools:core"))
|
|
|
|
}
|
|
|
|
|
|
|
|
val generateJs by tasks.register<JavaExec>("generateJs") {
|
2023-09-21 00:52:29 -07:00
|
|
|
outputs.dir(layout.buildDirectory.dir("teavm"))
|
2023-01-03 06:29:13 -08:00
|
|
|
dependsOn(tasks.classes)
|
|
|
|
classpath += configurations["teavmCompile"]
|
|
|
|
classpath += java.sourceSets.main.get().output.classesDirs
|
2023-09-21 00:52:29 -07:00
|
|
|
mainClass = "org.teavm.tooling.deobfuscate.js.Compiler"
|
2023-01-03 06:29:13 -08:00
|
|
|
args(
|
|
|
|
"org.teavm.tooling.deobfuscate.js.Deobfuscator",
|
|
|
|
"\$teavm_deobfuscator",
|
2023-09-21 00:52:29 -07:00
|
|
|
layout.buildDirectory.dir("teavm").get().asFile.absolutePath,
|
2023-01-03 06:29:13 -08:00
|
|
|
"deobfuscator.js"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
val generateLibJs by tasks.register<JavaExec>("generateLibJs") {
|
2023-09-21 00:52:29 -07:00
|
|
|
outputs.dir(layout.buildDirectory.dir("teavm-lib"))
|
2023-01-03 06:29:13 -08:00
|
|
|
dependsOn(tasks.classes)
|
|
|
|
classpath += configurations["teavmCompile"]
|
|
|
|
classpath += java.sourceSets.main.get().output.classesDirs
|
2023-09-21 00:52:29 -07:00
|
|
|
mainClass = "org.teavm.tooling.deobfuscate.js.Compiler"
|
2023-01-03 06:29:13 -08:00
|
|
|
args(
|
|
|
|
"org.teavm.tooling.deobfuscate.js.DeobfuscatorLib",
|
2023-01-25 01:55:38 -08:00
|
|
|
"deobfuscator",
|
2023-09-21 00:52:29 -07:00
|
|
|
layout.buildDirectory.dir("teavm-lib").get().asFile.absolutePath,
|
2023-01-03 06:29:13 -08:00
|
|
|
"deobfuscator-lib.js",
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
val zipWithJs by tasks.register<Jar>("zipWithJs") {
|
|
|
|
dependsOn(generateJs, generateLibJs)
|
2023-09-21 00:52:29 -07:00
|
|
|
archiveClassifier = "js"
|
|
|
|
from(layout.buildDirectory.dir("teavm"), layout.buildDirectory.dir("teavm-lib"))
|
2023-01-03 06:29:13 -08:00
|
|
|
entryCompression = ZipEntryCompression.DEFLATED
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.assemble.configure {
|
|
|
|
dependsOn(zipWithJs)
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts.add("js", zipWithJs)
|