mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: App Store
This commit is contained in:
@@ -571,6 +571,9 @@ fun packOnWindows(distributionDir: Directory, finalFilenameWithoutExtension: Str
|
|||||||
* 对于 macOS 先对 jpackage 构建的 dmg 重命名 -> 签名 -> 公证,另外还会创建一个 zip 包
|
* 对于 macOS 先对 jpackage 构建的 dmg 重命名 -> 签名 -> 公证,另外还会创建一个 zip 包
|
||||||
*/
|
*/
|
||||||
fun packOnMac(distributionDir: Directory, finalFilenameWithoutExtension: String, projectName: String) {
|
fun packOnMac(distributionDir: Directory, finalFilenameWithoutExtension: String, projectName: String) {
|
||||||
|
val pool = Executors.newCachedThreadPool()
|
||||||
|
val jobs = mutableListOf<Future<*>>()
|
||||||
|
|
||||||
val dmgFile = distributionDir.file("${finalFilenameWithoutExtension}.dmg").asFile
|
val dmgFile = distributionDir.file("${finalFilenameWithoutExtension}.dmg").asFile
|
||||||
val zipFile = distributionDir.file("${finalFilenameWithoutExtension}.zip").asFile
|
val zipFile = distributionDir.file("${finalFilenameWithoutExtension}.zip").asFile
|
||||||
|
|
||||||
@@ -582,24 +585,31 @@ fun packOnMac(distributionDir: Directory, finalFilenameWithoutExtension: String,
|
|||||||
// sign dmg
|
// sign dmg
|
||||||
signMacOSLocalFile(dmgFile)
|
signMacOSLocalFile(dmgFile)
|
||||||
|
|
||||||
|
if (macOSNotary) {
|
||||||
|
// dmg
|
||||||
|
pool.submit {
|
||||||
|
// 公证
|
||||||
|
notaryMacOSLocalFile(dmgFile)
|
||||||
|
// 盖章
|
||||||
|
stapleMacOSLocalFile(dmgFile)
|
||||||
|
}.apply { jobs.add(this) }
|
||||||
|
}
|
||||||
|
|
||||||
// 找到 .app
|
// 找到 .app
|
||||||
val imageFile = layout.buildDirectory.dir("jpackage/images/").get().asFile
|
val imageFile = layout.buildDirectory.dir("jpackage/images/").get().asFile
|
||||||
val appFile = imageFile.listFiles()?.firstOrNull()?.listFiles()?.firstOrNull()
|
val appFile = imageFile.listFiles()?.firstOrNull()?.listFiles()?.firstOrNull()
|
||||||
?: throw FileNotFoundException("${projectName}.app")
|
?: throw FileNotFoundException("${projectName}.app")
|
||||||
|
|
||||||
|
val cfg = FileUtils.getFile(appFile, "Contents", "app", "${projectName}.cfg")
|
||||||
|
cfg.appendText("java-options=-Djpackage.app-layout=AppStore")
|
||||||
// zip
|
// zip
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
exec { commandLine("ditto", "-c", "-k", "--sequesterRsrc", "--keepParent", appFile.absolutePath, zipFile.absolutePath) }
|
exec { commandLine("ditto", "-c", "-k", "--sequesterRsrc", "--keepParent", appFile.absolutePath, zipFile.absolutePath) }
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
// sign zip
|
// sign zip
|
||||||
signMacOSLocalFile(zipFile)
|
signMacOSLocalFile(zipFile)
|
||||||
|
|
||||||
// 公证
|
|
||||||
if (macOSNotary) {
|
if (macOSNotary) {
|
||||||
val pool = Executors.newCachedThreadPool()
|
|
||||||
val jobs = mutableListOf<Future<*>>()
|
|
||||||
|
|
||||||
// zip
|
// zip
|
||||||
pool.submit {
|
pool.submit {
|
||||||
// 对 zip 公证
|
// 对 zip 公证
|
||||||
@@ -615,22 +625,15 @@ fun packOnMac(distributionDir: Directory, finalFilenameWithoutExtension: String,
|
|||||||
// 再对 zip 签名
|
// 再对 zip 签名
|
||||||
signMacOSLocalFile(zipFile)
|
signMacOSLocalFile(zipFile)
|
||||||
}.apply { jobs.add(this) }
|
}.apply { jobs.add(this) }
|
||||||
|
}
|
||||||
|
|
||||||
// dmg
|
// 等待公证完毕
|
||||||
pool.submit {
|
if (macOSNotary) {
|
||||||
// 公证
|
|
||||||
notaryMacOSLocalFile(dmgFile)
|
|
||||||
// 盖章
|
|
||||||
stapleMacOSLocalFile(dmgFile)
|
|
||||||
}.apply { jobs.add(this) }
|
|
||||||
|
|
||||||
// join ...
|
|
||||||
jobs.forEach { it.get() }
|
jobs.forEach { it.get() }
|
||||||
|
}
|
||||||
|
|
||||||
// shutdown
|
// shutdown
|
||||||
pool.shutdown()
|
pool.shutdown()
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ enum class AppLayout {
|
|||||||
* macOS
|
* macOS
|
||||||
*/
|
*/
|
||||||
App,
|
App,
|
||||||
|
AppStore,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Linux
|
* Linux
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ internal class MyApplicationRunnerExtension private constructor() : ApplicationR
|
|||||||
private val log = LoggerFactory.getLogger(MyApplicationRunnerExtension::class.java)
|
private val log = LoggerFactory.getLogger(MyApplicationRunnerExtension::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val disabledUpdater get() = Application.getLayout() == AppLayout.Appx
|
private val disabledUpdater get() = Application.getLayout() == AppLayout.Appx || Application.getLayout() == AppLayout.AppStore
|
||||||
private val updaterManager get() = UpdaterManager.getInstance()
|
private val updaterManager get() = UpdaterManager.getInstance()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user