Skip to content

Commit

Permalink
Merge pull request #262 from google/build-target-name
Browse files Browse the repository at this point in the history
Update the build target name
  • Loading branch information
brad4d committed Oct 17, 2022
2 parents 1db4c6d + c2bd263 commit 0c1215b
Showing 1 changed file with 27 additions and 26 deletions.
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

0 comments on commit 0c1215b

Please sign in to comment.