diff --git a/WORKSPACE b/WORKSPACE index dfe16a162028..858e98d197d8 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,9 +3,9 @@ workspace(name = "angular_material") # Add nodejs rules http_archive( name = "build_bazel_rules_nodejs", - url = "https://github.com/bazelbuild/rules_nodejs/archive/0.5.3.zip", - strip_prefix = "rules_nodejs-0.5.3", - sha256 = "17a5515f59777b00cb25dbc710017a14273f825029b2ec60e0969d28914870be", + url = "https://github.com/bazelbuild/rules_nodejs/archive/0.6.0.zip", + strip_prefix = "rules_nodejs-0.6.0", + sha256 = "e8a2bb5ca51fbafb244bc507bcebcae33a63d969f47413b319a8dcce032845bf", ) # NOTE: this rule installs nodejs, npm, and yarn, but does NOT install diff --git a/package-lock.json b/package-lock.json index 02a818170a38..c525a37412d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,9 +57,7 @@ } }, "@angular/bazel": { - "version": "6.0.0-rc.0", - "resolved": "https://registry.npmjs.org/@angular/bazel/-/bazel-6.0.0-rc.0.tgz", - "integrity": "sha512-4K98Zx8TYE0QqY5wLtNS+aBje3pnu/HGkyaYWM6GNZckTfiDz3Z2e6dZcgxaGVI1CqJZAx+sUYcGZrkI0wjIhQ==", + "version": "github:angular/bazel-builds#2cc851b01b889a304b05ef46569f896b20f10705", "dev": true, "requires": { "@bazel/typescript": "0.11.1", @@ -94,9 +92,7 @@ } }, "@angular/compiler-cli": { - "version": "6.0.0-rc.0", - "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-6.0.0-rc.0.tgz", - "integrity": "sha512-BTCZEAc/XSywiesuVS1mxRxryvngdG6hjNV396qas61+h/D9JItOTZ5nb0oHs81IPMUZg5Gv53uUG4GdrTuu0g==", + "version": "github:angular/compiler-cli-builds#024717fcdfebc2dc2854ab59da956d167fa3caeb", "dev": true, "requires": { "chokidar": "1.7.0", diff --git a/package.json b/package.json index 1830e3741d3a..5457c7b4b113 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,8 @@ "devDependencies": { "@angular-devkit/core": "^0.4.5", "@angular-devkit/schematics": "^0.4.5", - "@angular/bazel": "6.0.0-rc.0", - "@angular/compiler-cli": "6.0.0-rc.0", + "@angular/bazel": "github:angular/bazel-builds#2cc851b01b889a304b05ef46569f896b20f10705", + "@angular/compiler-cli": "github:angular/compiler-cli-builds#024717fcdfebc2dc2854ab59da956d167fa3caeb", "@angular/http": "6.0.0-rc.0", "@angular/platform-browser-dynamic": "6.0.0-rc.0", "@angular/platform-server": "6.0.0-rc.0", diff --git a/tools/bazel.rc b/tools/bazel.rc index 7fb4fbd21612..85db0cbac829 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -45,3 +45,9 @@ build --symlink_prefix=dist/bazel/ # Make TypeScript and Angular compilation fast, by keeping a few copies of the compiler # running as daemons, and cache SourceFile AST's to reduce parse time. build --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker + +######################## +# Building Releases # +# use --config=release # +######################## +build:release --workspace_status_command=./tools/bazel_stamp_vars.sh diff --git a/tools/bazel_stamp_vars.sh b/tools/bazel_stamp_vars.sh new file mode 100644 index 000000000000..533eb9f93120 --- /dev/null +++ b/tools/bazel_stamp_vars.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Generates the data used by the stamping feature in bazel. +# See https://github.com/angular/angular/blob/master/docs/BAZEL.md for more explanation +set -u -e -E -o pipefail + +echo "Running: $0" >&2 + +function onError { + echo "Failed to execute: $0" + echo "" +} + +# Setup crash trap +trap 'onError' ERR + + +echo BUILD_SCM_HASH $(git rev-parse HEAD) + +if [[ "$(git tag)" == "" ]]; then + echo "No git tags found, can't stamp the build." + echo "Either fetch the tags:" + echo " git fetch git@github.com:angular/material2.git --tags" + echo "or build without stamping by giving an empty workspace_status_command:" + echo " bazel build --workspace_status_command= ..." + echo "" +fi + +BUILD_SCM_VERSION_RAW=$(git describe --abbrev=7 --tags HEAD) + +# Find out if there are any uncommitted local changes +# TODO(igorminar): is it ok to use "--untracked-files=no" to ignore untracked files since they should not affect anything? +if [[ $(git status --untracked-files=no --porcelain) ]]; then LOCAL_CHANGES="true"; else LOCAL_CHANGES="false"; fi +echo BUILD_SCM_LOCAL_CHANGES ${LOCAL_CHANGES} + +# Reformat `git describe` version string into a more semver-ish string +# From: 5.2.0-rc.0-57-g757f886 +# To: 5.2.0-rc.0+57.sha-757f886 +# Or: 5.2.0-rc.0+57.sha-757f886.with-local-changes +BUILD_SCM_VERSION="$(echo ${BUILD_SCM_VERSION_RAW} | sed -E 's/-([0-9]+)-g/+\1.sha-/g')""$( if [[ $LOCAL_CHANGES == "true" ]]; then echo ".with-local-changes"; fi)" +echo BUILD_SCM_VERSION ${BUILD_SCM_VERSION}