From ddf6a19854d6a1aacd3e40409d5acda78bcaf5cb Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 3 Mar 2021 20:06:55 +0100 Subject: [PATCH] fix(build): add Windows .exe resource information MONGOSH-570 Pass information to boxednode, which is used to overwrite the Node.js .rc file that is used for metadata (and the file icon) for the generated executable. --- config/build.conf.js | 11 ++++- package-lock.json | 38 ++++++++++-------- package.json | 2 +- packages/build/src/compile/run-compile.ts | 9 +++-- .../build/src/compile/signable-compiler.ts | 17 ++++++-- packages/build/src/release.ts | 4 +- .../build/src/tarball/package-information.ts | 3 +- packaging/mongo.ico | Bin 0 -> 51262 bytes 8 files changed, 54 insertions(+), 30 deletions(-) create mode 100644 packaging/mongo.ico diff --git a/config/build.conf.js b/config/build.conf.js index 3eec657d29..40a9fd5b48 100644 --- a/config/build.conf.js +++ b/config/build.conf.js @@ -63,6 +63,11 @@ const REVISION = process.env.IS_PATCH ? `pr-${process.env.GITHUB_PR_NUMBER}-${process.env.REVISION_ORDER_ID}` : process.env.REVISION; +/** + * The copyright notice for debian packages and .exe files + */ +const COPYRIGHT = `${new Date().getYear() + 1900} MongoDB, Inc.`; + /** * Export the configuration for the build. */ @@ -119,7 +124,7 @@ module.exports = { license: { sourceFilePath: path.resolve(__dirname, '..', 'packaging', 'LICENSE-mongocryptd'), packagedFilePath: 'LICENSE-mongocryptd', - debCopyright: `${new Date().getYear() + 1900} MongoDB, Inc.`, + debCopyright: COPYRIGHT, debIdentifier: 'Proprietary', rpmIdentifier: 'Proprietary' } @@ -142,7 +147,9 @@ module.exports = { description: CLI_REPL_PACKAGE_JSON.description, homepage: CLI_REPL_PACKAGE_JSON.homepage, maintainer: CLI_REPL_PACKAGE_JSON.author, - manufacturer: CLI_REPL_PACKAGE_JSON.manufacturer + manufacturer: CLI_REPL_PACKAGE_JSON.manufacturer, + copyright: COPYRIGHT, + icon: path.resolve(__dirname, '..', 'packaging', 'mongo.ico') }, debTemplateDir: path.resolve(__dirname, '..', 'packaging', 'deb-template'), rpmTemplateDir: path.resolve(__dirname, '..', 'packaging', 'rpm-template'), diff --git a/package-lock.json b/package-lock.json index 1689e17f54..d4d70d44c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5167,7 +5167,8 @@ "base64-js": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true }, "base64id": { "version": "1.0.0", @@ -5283,9 +5284,9 @@ "dev": true }, "boxednode": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/boxednode/-/boxednode-1.9.0.tgz", - "integrity": "sha512-tXFwEJASyqFPLuFqPxYS387coe7VU1+ruwcFQgx3zLfTpPy6ySov485oSeuUmM0KmGVoMI50y0D9po5uywFhGQ==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/boxednode/-/boxednode-1.10.0.tgz", + "integrity": "sha512-qo9Px313msVTVZ3c8xkFFwMMaryz/m+poJ85tG7r/qLoQzVRnnTJV19zIKUq62oW9xo1iMwCHMS3kt60P1QPgQ==", "dev": true, "requires": { "@pkgjs/nv": "^0.1.0", @@ -5490,9 +5491,9 @@ } }, "tar": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.5.tgz", - "integrity": "sha512-0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz", + "integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==", "dev": true, "requires": { "chownr": "^2.0.0", @@ -5542,9 +5543,9 @@ } }, "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "version": "20.2.6", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.6.tgz", + "integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==", "dev": true } } @@ -5772,6 +5773,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/bson/-/bson-4.2.3.tgz", "integrity": "sha512-3ztgjpKp0itFxGqzrLMHWqyZH5oMOIRWsjeY61yNVzrDGB/KxtgD6djFlz9n3vx7lLr2r6bkHagBCgyk1ZjETA==", + "dev": true, "requires": { "buffer": "^5.6.0" }, @@ -5780,6 +5782,7 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -6276,9 +6279,9 @@ } }, "cli-progress": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.8.2.tgz", - "integrity": "sha512-qRwBxLldMSfxB+YGFgNRaj5vyyHe1yMpVeDL79c+7puGujdKJHQHydgqXDcrkvQgJ5U/d3lpf6vffSoVVUftVQ==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.9.0.tgz", + "integrity": "sha512-g7rLWfhAo/7pF+a/STFH/xPyosaL1zgADhI0OM83hl3c7S43iGvJWEAV2QuDOnQ8i6EMBj/u4+NTd0d5L+4JfA==", "dev": true, "requires": { "colors": "^1.1.2", @@ -8034,9 +8037,9 @@ } }, "defer-to-connect": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz", - "integrity": "sha512-bYL2d05vOSf1JEZNx5vSAtPuBMkX8K9EUutg7zlKvTqKXHt7RhWJFbmd7qakVuf13i+IkGmp6FwSsONOf6VYIg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", "dev": true }, "define-properties": { @@ -11670,7 +11673,8 @@ "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true }, "iferr": { "version": "0.1.5", diff --git a/package.json b/package.json index 44681958c1..a3c3ba5ca9 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "@typescript-eslint/parser": "^4.6.0", "aws-sdk": "^2.674.0", "axios": "^0.19.2", - "boxednode": "^1.9.0", + "boxednode": "^1.10.0", "browserify": "^16.5.0", "chai": "^4.2.0", "command-exists": "^1.2.9", diff --git a/packages/build/src/compile/run-compile.ts b/packages/build/src/compile/run-compile.ts index 558b89c332..d66be786dd 100644 --- a/packages/build/src/compile/run-compile.ts +++ b/packages/build/src/compile/run-compile.ts @@ -1,3 +1,4 @@ +import type { PackageInformation } from '../tarball'; import { generateBundle } from './generate-bundle'; import { SignableCompiler } from './signable-compiler'; @@ -11,7 +12,8 @@ export async function runCompile( executablePath: string, execNodeVersion: string, analyticsConfigFilePath: string, - segmentKey: string + segmentKey: string, + executableMetadata: PackageInformation['metadata'] ): Promise { // We use Parcel to bundle up everything into a single JS under // cli-repl/dist/mongosh.js that the executable generator can use as input. @@ -20,9 +22,8 @@ export async function runCompile( console.info('mongosh: creating binary:', executablePath); - const { compileJSFileAsBinary } = require('boxednode'); - await new SignableCompiler(execInput, executablePath, execNodeVersion) - .compile(compileJSFileAsBinary); + await new SignableCompiler(execInput, executablePath, execNodeVersion, executableMetadata) + .compile(); return executablePath; } diff --git a/packages/build/src/compile/signable-compiler.ts b/packages/build/src/compile/signable-compiler.ts index ec5837b3f2..cd4d2df280 100644 --- a/packages/build/src/compile/signable-compiler.ts +++ b/packages/build/src/compile/signable-compiler.ts @@ -6,6 +6,8 @@ import path from 'path'; import childProcess from 'child_process'; import { once } from 'events'; import { Platform } from '../config'; +import type { PackageInformation } from '../tarball'; +import { compileJSFileAsBinary } from 'boxednode'; async function preCompileHook(nodeSourceTree: string) { const fleAddonVersion = require(path.join( @@ -40,11 +42,17 @@ export class SignableCompiler { sourceFile: string; targetFile: string; nodeVersionRange: string; + executableMetadata: PackageInformation['metadata']; - constructor(sourceFile: string, targetFile: string, nodeVersionRange: string) { + constructor( + sourceFile: string, + targetFile: string, + nodeVersionRange: string, + executableMetadata: PackageInformation['metadata']) { this.sourceFile = sourceFile; this.targetFile = targetFile; this.nodeVersionRange = nodeVersionRange; + this.executableMetadata = executableMetadata; } /** @@ -52,7 +60,7 @@ export class SignableCompiler { * * @param {Function} exec - The boxednode compile function. */ - async compile(exec: (opts: any) => void): Promise { + async compile(): Promise { const fleAddon = { path: await findModulePath('mongodb-client-encryption'), requireRegexp: /\bmongocrypt\.node$/ @@ -61,7 +69,7 @@ export class SignableCompiler { // This compiles the executable along with Node from source. // Evergreen and XCode don't have up to date libraries to compile // open ssl with asm so we revert back to the slower version. - await exec({ + await compileJSFileAsBinary({ configureArgs: os.platform() === Platform.Windows ? ['openssl-no-asm'] : os.platform() === Platform.MacOs ? ['--openssl-no-asm'] : [], @@ -78,7 +86,8 @@ export class SignableCompiler { addons: [ fleAddon ], - preCompileHook + preCompileHook, + executableMetadata: this.executableMetadata }); } } diff --git a/packages/build/src/release.ts b/packages/build/src/release.ts index 7fadc06e4e..556b86bac2 100644 --- a/packages/build/src/release.ts +++ b/packages/build/src/release.ts @@ -14,6 +14,7 @@ import { runPackage } from './package'; import { runDraft } from './run-draft'; import { runPublish } from './run-publish'; import { runUpload } from './run-upload'; +import type { PackageInformation } from './tarball'; export type ReleaseCommand = 'bump' | 'compile' | 'package' | 'upload' | 'draft' | 'publish'; @@ -56,7 +57,8 @@ export async function release( config.executablePath, config.execNodeVersion, config.analyticsConfigFilePath ?? '', - config.segmentKey ?? '' + config.segmentKey ?? '', + (config.packageInformation?.metadata ?? {}) as PackageInformation['metadata'] ); } else if (command === 'package') { const tarballFile = await runPackage( diff --git a/packages/build/src/tarball/package-information.ts b/packages/build/src/tarball/package-information.ts index 48f6bb0315..c4fb2091c0 100644 --- a/packages/build/src/tarball/package-information.ts +++ b/packages/build/src/tarball/package-information.ts @@ -1,4 +1,3 @@ - interface DocumentationFile { sourceFilePath: string; packagedFilePath: string; @@ -26,6 +25,8 @@ export interface PackageInformation { maintainer: string; manufacturer: string; fullName: string; + copyright: string; + icon: string; }; debTemplateDir: string; rpmTemplateDir: string; diff --git a/packaging/mongo.ico b/packaging/mongo.ico new file mode 100644 index 0000000000000000000000000000000000000000..5258b6e04460d50c144a036d06bceafd41adfb3f GIT binary patch literal 51262 zcmeHQd3cj$wy%0eMPz`sbV<`4gzjz9?A@|;Unzwa%Bra7b7$tcj^jAP(tY1mXq$9N zx+HCB=}JL174KXe6&GB98N`RVB3INAN0deAJ?H(BG)W5#KBfQUt%vl>Lf+)}JKyg; z+lO{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