Skip to content

Commit

Permalink
build: use bazel for snapshot builds
Browse files Browse the repository at this point in the history
(cherry picked from commit 8c65ad1)
  • Loading branch information
kormide authored and dgp1130 committed Feb 2, 2022
1 parent 68dc99c commit 491e210
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ jobs:
resource_class: medium
steps:
- custom_attach_workspace
- install_python
- run:
name: Decrypt Credentials
# Note: when changing the image, you might have to re-encrypt the credentials with a
Expand Down
7 changes: 4 additions & 3 deletions lib/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,15 @@ const packageJsonPaths = [
..._findPrimaryPackageJsonFiles(path.join(__dirname, '..', 'packages'), excludeRe),
];

function _exec(cmd: string) {
return execSync(cmd).toString().trim();
function _exec(cmd: string, opts?: { cwd?: string }) {
return execSync(cmd, opts).toString().trim();
}

let gitShaCache: string;
function _getSnapshotHash(_pkg: PackageInfo): string {
if (!gitShaCache) {
gitShaCache = _exec('git log --format=%h -n1');
const opts = { cwd: __dirname }; // Ensure we call git from within this repo
gitShaCache = _exec('git log --format=%h -n1', opts);
}

return gitShaCache;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@angular/compiler": "13.1.3",
"@angular/compiler-cli": "13.1.3",
"@angular/core": "13.1.3",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#2024033f3123cd1beed78d43ec7269467cd9fa93",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#3a34722a82fb0e8cd3fa00dfc5476767a35e021a",
"@angular/forms": "13.1.3",
"@angular/localize": "13.1.3",
"@angular/material": "13.1.3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { PackageInfo, packages } from '../lib/packages';
import build from './build';
import build from './build-bazel';
import create from './create';

// Added to the README.md of the snapshot. This is markdown.
Expand Down
2 changes: 1 addition & 1 deletion tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
# Version of the local package being built, generated via the `--workspace_status_command` flag.
"0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}",
"0.0.0-EXPERIMENTAL-PLACEHOLDER": "{BUILD_SCM_EXPERIMENTAL_VERSION}",
"BUILD_SCM_HASH-PLACEHOLDER": "{BUILD_SCM_COMMIT_SHA}",
"BUILD_SCM_HASH-PLACEHOLDER": "{BUILD_SCM_ABBREV_HASH}",
"0.0.0-ENGINES-NODE": RELEASE_ENGINES_NODE,
"0.0.0-ENGINES-NPM": RELEASE_ENGINES_NPM,
"0.0.0-ENGINES-YARN": RELEASE_ENGINES_YARN,
Expand Down
2 changes: 1 addition & 1 deletion tools/snapshot_repo_filter.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ load("//:constants.bzl", "SNAPSHOT_REPOS")
def _generate_snapshot_repo_filter():
filter = ""
for (i, pkg_name) in enumerate(SNAPSHOT_REPOS.keys()):
filter += "{sep}(..|objects|select(has(\"{pkg_name}\")))[\"{pkg_name}\"] |= \"github:{snapshot_repo}:BUILD_SCM_HASH-PLACEHOLDER\"\n".format(
filter += "{sep}(..|objects|select(has(\"{pkg_name}\")))[\"{pkg_name}\"] |= \"github:{snapshot_repo}#BUILD_SCM_HASH-PLACEHOLDER\"\n".format(
sep = "| " if i > 0 else "",
pkg_name = pkg_name,
snapshot_repo = SNAPSHOT_REPOS[pkg_name],
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@angular-devkit/core" "13.2.0-rc.1"
rxjs "6.6.7"

"@angular-devkit/build-angular@^13.2.0-rc":
"@angular-devkit/build-angular@13.2.0-rc.1":
version "13.2.0-rc.1"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-13.2.0-rc.1.tgz#d07eeec25c00c9ed025aa599263d98ad22d39f4a"
integrity sha512-kKElUuHAocImUQmYnlkmk/8UJh8eYw7GqvcfSxIcxJ8euLS2hnavmUCexxtlPsgWmwJTdwXDnRYVCmr4n8hQqA==
Expand Down Expand Up @@ -203,13 +203,13 @@
dependencies:
tslib "^2.0.0"

"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#2024033f3123cd1beed78d43ec7269467cd9fa93":
version "0.0.0-354871956801929457d9f08482fb81f7012ed7c8"
resolved "https://github.com/angular/dev-infra-private-builds.git#2024033f3123cd1beed78d43ec7269467cd9fa93"
"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#3a34722a82fb0e8cd3fa00dfc5476767a35e021a":
version "0.0.0-c922f5b23611024bc9d94833ae147f6048ab0275"
resolved "https://github.com/angular/dev-infra-private-builds.git#3a34722a82fb0e8cd3fa00dfc5476767a35e021a"
dependencies:
"@actions/core" "^1.4.0"
"@actions/github" "^5.0.0"
"@angular-devkit/build-angular" "^13.2.0-rc"
"@angular-devkit/build-angular" "13.2.0-rc.1"
"@angular/benchpress" "0.2.1"
"@babel/core" "^7.16.0"
"@bazel/bazelisk" "^1.10.1"
Expand Down

0 comments on commit 491e210

Please sign in to comment.