Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the build target name #262

Merged
merged 2 commits into from
Oct 17, 2022
Merged
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
53 changes: 27 additions & 26 deletions build-scripts/build_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,38 @@ const path = require("path");
const runCommand = require("./run-command");
const childProcess = require("child_process");

const compilerTargetName = "compiler_unshaded_deploy.jar";
/**
* The compiler version that will be built.
*
* For release builds, this is of the form: "vYYYYMMDD"
* For nightly builds, this is "1.0-SNAPSHOT"
*
* @type {string}
*/
const compilerVersion = process.env.COMPILER_NIGHTLY == 'true'
? 'SNAPSHOT-1.0'
: String(
childProcess.execSync('git tag --points-at HEAD', {
cwd: './compiler',
})
).trim();

const compilerTargetName = compilerVersion === 'SNAPSHOT-1.0' || parseInt(compilerVersion.slice(1), 10) > 20221004 ?
'compiler_uber_deploy.jar' : 'compiler_unshaded_deploy.jar';
const compilerJavaBinaryPath = `./compiler/bazel-bin/${compilerTargetName}`;

async function main() {
console.log(process.platform, process.arch, compilerVersion);

const { exitCode } = await runCommand(
"bazelisk",
'bazelisk',
[
"build",
"--color=yes",
'build',
'--color=yes',
`//:${compilerTargetName}`,
`--define=COMPILER_VERSION=${compilerVersion}`,
],
{ cwd: "./compiler" }
{ cwd: './compiler' }
);
if (exitCode !== 0) {
throw new Error(exitCode);
Expand All @@ -60,40 +77,24 @@ async function main() {
return Promise.all([
copy(
compilerJavaBinaryPath,
"./packages/google-closure-compiler-java/compiler.jar"
'./packages/google-closure-compiler-java/compiler.jar'
),
copy(
compilerJavaBinaryPath,
"./packages/google-closure-compiler-linux/compiler.jar"
'./packages/google-closure-compiler-linux/compiler.jar'
),
copy(
compilerJavaBinaryPath,
"./packages/google-closure-compiler-osx/compiler.jar"
'./packages/google-closure-compiler-osx/compiler.jar'
),
copy(
compilerJavaBinaryPath,
"./packages/google-closure-compiler-windows/compiler.jar"
'./packages/google-closure-compiler-windows/compiler.jar'
),
copy("./compiler/contrib", "./packages/google-closure-compiler/contrib"),
copy('./compiler/contrib', './packages/google-closure-compiler/contrib'),
]);
}

/**
* The compiler version that will be built.
*
* For release builds, this is of the form: "vYYYYMMDD"
* For nightly builds, this is "1.0-SNAPSHOT"
*
* @type {string}
*/
const compilerVersion = process.env.COMPILER_NIGHTLY == 'true'
? "SNAPSHOT-1.0"
: String(
childProcess.execSync("git tag --points-at HEAD", {
cwd: "./compiler",
})
).trim();

/**
* @param {string} src path to source file or folder
* @param {string} dest path to destination file or folder
Expand Down