From fae7d269c3e8241fa012dc903369707ee16f7e63 Mon Sep 17 00:00:00 2001 From: Ben McMorran Date: Thu, 27 Jan 2022 17:23:17 -0800 Subject: [PATCH 1/2] Re-enable VSIX signing --- azure-pipelines.yml | 8 +------- build/markExecutableFiles.py | 4 ++-- src/serialmonitor/serialportctrl.ts | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ba99a264..7a8195aa 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -123,13 +123,7 @@ steps: solution: .\build\SignVsix.proj msbuildArguments: /p:SignType=$(SignType) # MicroBuild signing will always fail on public PRs. - # TODO: Signing the VSIX strips out the "main" executables for - # serial-monitor-cli on Mac and Linux, completely breaking serial - # functionality in the extension on these platforms. For now we disable VSIX - # signing because it's not a strict requirement, but we should investigate - # if we can either add extensions to these files or support extensionless - # files in VSIX signing. - condition: and(false, ne(variables['Build.Reason'], 'PullRequest')) + condition: ne(variables['Build.Reason'], 'PullRequest') - publish: $(Build.StagingDirectory)\vscode-arduino.vsix artifact: VS Code extension VSIX displayName: Publish extension VSIX as artifact diff --git a/build/markExecutableFiles.py b/build/markExecutableFiles.py index 89213be5..9d7380fa 100644 --- a/build/markExecutableFiles.py +++ b/build/markExecutableFiles.py @@ -6,8 +6,8 @@ output_archive_path = f"{staging_directory}/vscode-arduino-out.vsix" filenames = [ - "extension/out/serial-monitor-cli/darwin/main", - "extension/out/serial-monitor-cli/linux/main" + "extension/out/serial-monitor-cli/darwin/main.out", + "extension/out/serial-monitor-cli/linux/main.out" ] input_archive = zipfile.ZipFile(input_archive_path, 'r') diff --git a/src/serialmonitor/serialportctrl.ts b/src/serialmonitor/serialportctrl.ts index bed5fda9..47217c87 100644 --- a/src/serialmonitor/serialportctrl.ts +++ b/src/serialmonitor/serialportctrl.ts @@ -52,7 +52,7 @@ export class SerialPortCtrl { if (os.platform() === "win32") { fileName = "main.exe" } else if (os.platform() === "linux" || os.platform() === "darwin") { - fileName = "main" + fileName = "main.out" } const deviceContext = DeviceContext.getInstance(); return path.resolve(deviceContext.extensionPath, "out", "serial-monitor-cli", `${os.platform}`, fileName); From a4a4f3a76e37702be3084588f62d4857405e9fc8 Mon Sep 17 00:00:00 2001 From: Ben McMorran Date: Thu, 27 Jan 2022 18:28:59 -0800 Subject: [PATCH 2/2] Mark executable files after signing --- azure-pipelines.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7a8195aa..2cd2611d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -115,8 +115,6 @@ steps: includeRootFolder: false archiveType: zip archiveFile: $(Build.StagingDirectory)\vscode-arduino.vsix - - script: python .\build\markExecutableFiles.py - displayName: Make serial monitor executable - task: MSBuild@1 displayName: Sign VSIX inputs: @@ -124,6 +122,12 @@ steps: msbuildArguments: /p:SignType=$(SignType) # MicroBuild signing will always fail on public PRs. condition: ne(variables['Build.Reason'], 'PullRequest') + # VSIX signing removes the executable attributes on files. Luckily, the + # signature only seems to be based on the content of the files, not the + # attributes, so we can safely go back and mark the serial monitor as + # executable without invalidating the signature. + - script: python .\build\markExecutableFiles.py + displayName: Make serial monitor executable - publish: $(Build.StagingDirectory)\vscode-arduino.vsix artifact: VS Code extension VSIX displayName: Publish extension VSIX as artifact