Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions config/build.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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'
}
Expand All @@ -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'),
Expand Down
38 changes: 21 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions packages/build/src/compile/run-compile.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { PackageInformation } from '../tarball';
import { generateBundle } from './generate-bundle';
import { SignableCompiler } from './signable-compiler';

Expand All @@ -11,7 +12,8 @@ export async function runCompile(
executablePath: string,
execNodeVersion: string,
analyticsConfigFilePath: string,
segmentKey: string
segmentKey: string,
executableMetadata: PackageInformation['metadata']
): Promise<string> {
// 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.
Expand All @@ -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;
}
17 changes: 13 additions & 4 deletions packages/build/src/compile/signable-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -40,19 +42,25 @@ 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;
}

/**
* Compile the executable with the library.
*
* @param {Function} exec - The boxednode compile function.
*/
async compile(exec: (opts: any) => void): Promise<void> {
async compile(): Promise<void> {
const fleAddon = {
path: await findModulePath('mongodb-client-encryption'),
requireRegexp: /\bmongocrypt\.node$/
Expand All @@ -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'] : [],
Expand All @@ -78,7 +86,8 @@ export class SignableCompiler {
addons: [
fleAddon
],
preCompileHook
preCompileHook,
executableMetadata: this.executableMetadata
});
}
}
4 changes: 3 additions & 1 deletion packages/build/src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion packages/build/src/tarball/package-information.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

interface DocumentationFile {
sourceFilePath: string;
packagedFilePath: string;
Expand Down Expand Up @@ -26,6 +25,8 @@ export interface PackageInformation {
maintainer: string;
manufacturer: string;
fullName: string;
copyright: string;
icon: string;
};
debTemplateDir: string;
rpmTemplateDir: string;
Expand Down
Binary file added packaging/mongo.ico
Binary file not shown.