临时存储

This commit is contained in:
zcy
2025-09-05 14:36:09 +08:00
parent 5122f8eade
commit 69dd449aca
10 changed files with 210 additions and 84 deletions

View File

@@ -15,8 +15,8 @@ sourceSets {
/** 统一编译编码 */
tasks.withType(JavaCompile).configureEach { t ->
t.options.encoding = "UTF-8"
t.sourceCompatibility = "1.5"
t.targetCompatibility = "1.5"
t.sourceCompatibility = "1.8"
t.targetCompatibility = "1.8"
def jcHome = System.getenv("JC_HOME")
if (!jcHome) throw new GradleException("缺少 JC_HOME")
t.options.bootstrapClasspath = files("${jcHome}/lib/api_classic.jar")
@@ -34,10 +34,12 @@ dependencies {
/** ===== 用本地 JCDK converter 生成 CAP ===== */
def pkgName = "com.zuc.zuc256" // ← 改成你的包名
def appletClass = "${pkgName}.MyApplet" // ← 改成你的 Applet 全类名
def appletClass = "${pkgName}.XwSecurity" // ← 改成你的 Applet 全类名
def packageAID = "0xA0:0x00:0x00:0x03:0x33:0x01:0x01" // ← 改成你的包 AID
def appletAID = "0xA0:0x00:0x00:0x03:0x33:0x01:0x01:0x01"// ← 改成你的实例 AID
def ver = "1.0"
tasks.register("buildCap") {
group = "build"
description = "Generate CAP via JCDK converter.bat"
@@ -61,7 +63,7 @@ tasks.register("buildCap") {
if (!batFile.exists()) throw new GradleException("未找到 converter.bat${batFile}")
// 确认 .class 存在
def cls = file("$buildDir/classes/java/main/${pkgName.replace('.','/')}/MyApplet.class")
def cls = file("$buildDir/classes/java/main/${pkgName.replace('.','/')}/XwSecurity.class")
if (!cls.exists()) throw new GradleException("未找到已编译类:${cls}")
@@ -96,7 +98,7 @@ tasks.register("buildCap") {
if (result.exitValue != 0) {
println "---- converter.log tail ----"
println logFile.readLines("GBK").takeRight(80).join(System.lineSeparator())
println logFile.readLines("UTF-8").takeRight(80).join(System.lineSeparator())
throw new GradleException("converter 退出码:${result.exitValue}")
} else {
println "CAP 生成成功,目录:${file("$buildDir/javacard").absolutePath}"
@@ -104,3 +106,5 @@ tasks.register("buildCap") {
}
}