diff --git a/.changeset/fluffy-dryers-enjoy.md b/.changeset/fluffy-dryers-enjoy.md new file mode 100644 index 00000000000..f8e2f5bb5bf --- /dev/null +++ b/.changeset/fluffy-dryers-enjoy.md @@ -0,0 +1,6 @@ +--- +"app-builder-lib": patch +"builder-util-runtime": patch +--- + +fix: add MemoLazy to fix codeSigningInfo not responding to changed args diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 26046268dca..317d149ff23 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,7 +18,7 @@ jobs: strategy: matrix: testFiles: - - ArtifactPublisherTest,BuildTest,ExtraBuildTest,RepoSlugTest,binDownloadTest,configurationValidationTest,filenameUtilTest,filesTest,globTest,ignoreTest,macroExpanderTest,mainEntryTest,urlUtilTest,extraMetadataTest,linuxArchiveTest,linuxPackagerTest,HoistedNodeModuleTest + - ArtifactPublisherTest,BuildTest,ExtraBuildTest,RepoSlugTest,binDownloadTest,configurationValidationTest,filenameUtilTest,filesTest,globTest,ignoreTest,macroExpanderTest,mainEntryTest,urlUtilTest,extraMetadataTest,linuxArchiveTest,linuxPackagerTest,HoistedNodeModuleTest,MemoLazyTest - snapTest,debTest,fpmTest,protonTest steps: - name: Checkout code repository diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md index 544c508623f..d7811869553 100644 --- a/docs/api/electron-builder.md +++ b/docs/api/electron-builder.md @@ -927,45 +927,69 @@ Developer API only. See [Configuration](../configuration/configuration.md) for u Properties
**<code id="MacPackager-[codeSigningInfo=new Lazy **<code id="MacPackager-[codeSigningInfo=new MemoLazy<CreateKeychainOptions | null, CodeSigningInfo>(
+() => {
const cscLink = this.getCscLink()
if (cscLink == null || process.platform !== “darwin”) {
-return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null })
+return null
} return createKeychain({
-tmpDir: this.info.tempDirManager,
-cscLink,
-cscKeyPassword: this.getCscPassword(),
-cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),
-cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),
-currentDir: this.projectDir,
-}).then(result => {
+ },
+async selected => {
+if (selected) {
+return createKeychain(selected).then(result => {
const keychainFile = result.keychainFile
if (keychainFile != null) {
this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile))
}
return result
})
-})]">[codeSigningInfo=new Lazy }
+)]">[codeSigningInfo=new MemoLazy<CreateKeychainOptions | null, CodeSigningInfo>(
+() => {
const cscLink = this.getCscLink()
if (cscLink == null || process.platform !== “darwin”) {
-return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null })
+return null
} return createKeychain({
-tmpDir: this.info.tempDirManager,
-cscLink,
-cscKeyPassword: this.getCscPassword(),
-cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),
-cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),
-currentDir: this.projectDir,
-}).then(result => {
+ },
+async selected => {
+if (selected) {
+return createKeychain(selected).then(result => {
const keychainFile = result.keychainFile
if (keychainFile != null) {
this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile))
}
return result
})
-})]** Lazy<module:app-builder-lib/out/codeSign/macCodeSign.CodeSigningInfo>
+const selected = {
+ tmpDir: this.info.tempDirManager,
+ cscLink,
+ cscKeyPassword: this.getCscPassword(),
+ cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),
+ cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),
+ currentDir: this.projectDir,
+}
+
+return selected
+
+return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null })
+
+const selected = {
+ tmpDir: this.info.tempDirManager,
+ cscLink,
+ cscKeyPassword: this.getCscPassword(),
+ cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),
+ cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),
+ currentDir: this.projectDir,
+}
+
+return selected
+
return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null })
+
+} +)]** MemoLazy< | module:app-builder-lib/out/codeSign/macCodeSign.CreateKeychainOptions | module:app-builder-lib/out/codeSign/macCodeSign.CodeSigningInfo>
defaultTarget
Array<String>
__${target.name}-${getArtifactArchName(arc
Properties
-
-
**<code id="WinPackager-[cscInfo=new Lazy<FileCodeSigningInfo | CertificateFromStoreInfo | null>(() => {
-const platformSpecificBuildOptions = this.platformSpecificBuildOptions
+
**<code id="WinPackager-[cscInfo=new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(
+() => this.platformSpecificBuildOptions,
+platformSpecificBuildOptions => {
if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) {
return this.vm.value
.then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))
@@ -2232,37 +2257,42 @@ return null
}
})
}
-const certificateFile = platformSpecificBuildOptions.certificateFile
+
const certificateFile = platformSpecificBuildOptions.certificateFile
if (certificateFile != null) {
-const certificatePassword = this.getCscPassword()
-return Promise.resolve({
-file: certificateFile,
-password: certificatePassword == null ? null : certificatePassword.trim(),
-})
-}
-const cscLink = this.getCscLink(“WIN_CSC_LINK”)
-if (cscLink == null || cscLink === “”) {
-return Promise.resolve(null)
-}
-return (
-importCertificate(cscLink, this.info.tempDirManager, this.projectDir)
-// before then
-.catch((e: any) => {
-if (e instanceof InvalidConfigurationError) {
-throw new InvalidConfigurationError(Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}
)
-} else {
-throw e
+ const certificatePassword = this.getCscPassword()
+ return Promise.resolve({
+ file: certificateFile,
+ password: certificatePassword == null ? null : certificatePassword.trim(),
+ })
}
-})
-.then(path => {
-return {
-file: path,
-password: this.getCscPassword(),
+
+const cscLink = this.getCscLink("WIN_CSC_LINK")
+if (cscLink == null || cscLink === "") {
+ return Promise.resolve(null)
}
-})
+
+return (
+ importCertificate(cscLink, this.info.tempDirManager, this.projectDir)
+ // before then
+ .catch((e: any) => {
+ if (e instanceof InvalidConfigurationError) {
+ throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)
+ } else {
+ throw e
+ }
+ })
+ .then(path => {
+ return {
+ file: path,
+ password: this.getCscPassword(),
+ }
+ })
)
-})]">[cscInfo=new Lazy<FileCodeSigningInfo | CertificateFromStoreInfo | null>(() => {
-const platformSpecificBuildOptions = this.platformSpecificBuildOptions
+
+}
+)]">[cscInfo=new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(
+() => this.platformSpecificBuildOptions,
+platformSpecificBuildOptions => {
if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) {
return this.vm.value
.then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))
@@ -2276,36 +2306,40 @@ return null
}
})
}
-const certificateFile = platformSpecificBuildOptions.certificateFile
+
const certificateFile = platformSpecificBuildOptions.certificateFile
if (certificateFile != null) {
-const certificatePassword = this.getCscPassword()
-return Promise.resolve({
-file: certificateFile,
-password: certificatePassword == null ? null : certificatePassword.trim(),
-})
-}
-const cscLink = this.getCscLink(“WIN_CSC_LINK”)
-if (cscLink == null || cscLink === “”) {
-return Promise.resolve(null)
-}
-return (
-importCertificate(cscLink, this.info.tempDirManager, this.projectDir)
-// before then
-.catch((e: any) => {
-if (e instanceof InvalidConfigurationError) {
-throw new InvalidConfigurationError(Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}
)
-} else {
-throw e
+ const certificatePassword = this.getCscPassword()
+ return Promise.resolve({
+ file: certificateFile,
+ password: certificatePassword == null ? null : certificatePassword.trim(),
+ })
}
-})
-.then(path => {
-return {
-file: path,
-password: this.getCscPassword(),
+
+const cscLink = this.getCscLink("WIN_CSC_LINK")
+if (cscLink == null || cscLink === "") {
+ return Promise.resolve(null)
}
-})
+
+return (
+ importCertificate(cscLink, this.info.tempDirManager, this.projectDir)
+ // before then
+ .catch((e: any) => {
+ if (e instanceof InvalidConfigurationError) {
+ throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)
+ } else {
+ throw e
+ }
+ })
+ .then(path => {
+ return {
+ file: path,
+ password: this.getCscPassword(),
+ }
+ })
)
-})]
** Lazy< | FileCodeSigningInfo | CertificateFromStoreInfo>
+
+} +)]** MemoLazy<WindowsConfiguration | | FileCodeSigningInfo | CertificateFromStoreInfo>
vm
= new Lazy<VmManager>(() => (process.platform === "win32" ? Promise.resolve(new VmManager()) : getWindowsVm(this.debugLogger)))
Lazy<module:app-builder-lib/out/vm/vm.VmManager>
**<code id="WinPackager-[lazyCertInfo=new Lazy<CertificateInfo | null>(async () => { -const cscInfo = await this.cscInfo.value +
**<code id="WinPackager-[lazyCertInfo=new MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>( +() => this.cscInfo, +async csc => { +const cscInfo = await csc.value if (cscInfo == null) { return null }
-if (“subject” in cscInfo) { -const bloodyMicrosoftSubjectDn = cscInfo.subject -return { -commonName: parseDn(bloodyMicrosoftSubjectDn).get(“CN”)!, -bloodyMicrosoftSubjectDn, +
if ("subject" in cscInfo) {
+ const bloodyMicrosoftSubjectDn = cscInfo.subject
+ return {
+ commonName: parseDn(bloodyMicrosoftSubjectDn).get("CN")!,
+ bloodyMicrosoftSubjectDn,
+ }
}
-}
-const cscFile = cscInfo.file
+
+const cscFile = cscInfo.file
if (cscFile == null) {
-return null
+ return null
}
-return await getCertInfo(cscFile, cscInfo.password || “”)
-})]">[lazyCertInfo=new Lazy<CertificateInfo | null>(async () => {
-const cscInfo = await this.cscInfo.value
+return await getCertInfo(cscFile, cscInfo.password || "")
+
+} +)]">[lazyCertInfo=new MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>( +() => this.cscInfo, +async csc => { +const cscInfo = await csc.value if (cscInfo == null) { return null }
-if (“subject” in cscInfo) { -const bloodyMicrosoftSubjectDn = cscInfo.subject -return { -commonName: parseDn(bloodyMicrosoftSubjectDn).get(“CN”)!, -bloodyMicrosoftSubjectDn, +
if ("subject" in cscInfo) {
+ const bloodyMicrosoftSubjectDn = cscInfo.subject
+ return {
+ commonName: parseDn(bloodyMicrosoftSubjectDn).get("CN")!,
+ bloodyMicrosoftSubjectDn,
+ }
}
-}
-const cscFile = cscInfo.file
+
+const cscFile = cscInfo.file
if (cscFile == null) {
-return null
+ return null
}
-return await getCertInfo(cscFile, cscInfo.password || “”)
-})]
** Lazy< | module:app-builder-lib/out/codeSign/windowsCodeSign.CertificateInfo>
+return await getCertInfo(cscFile, cscInfo.password || "")
+
+} +)]** MemoLazy<MemoLazy<WindowsConfiguration | | FileCodeSigningInfo | CertificateFromStoreInfo> | | module:app-builder-lib/out/codeSign/windowsCodeSign.CertificateInfo>
isForceCodeSigningVerification
Boolean