-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build(bazel): add version stamping #10687
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,23 +32,20 @@ sass_bundle( | |
output_name = "_theming.scss", | ||
) | ||
|
||
# TODO(jelbourn): uncomment when 6.0.0-rc.1 comes out | ||
# Creates the @angular/material package published to npm. | ||
#ng_package( | ||
# name = "npm_package", | ||
# srcs = [ | ||
# "package.json", | ||
# ], | ||
# entry_point = "src/lib/public_api.js", | ||
# entry_point_name = "material", | ||
# globals = ROLLUP_GLOBALS, | ||
# data = [ | ||
# ":theming_bundle", | ||
# "//src/lib/prebuilt-themes:indigo-pink", | ||
# "//src/lib/prebuilt-themes:deeppurple-amber", | ||
# "//src/lib/prebuilt-themes:pink-bluegrey", | ||
# "//src/lib/prebuilt-themes:purple-green", | ||
# ], | ||
# packages = ["//src/lib/schematics:npm_package"], | ||
# deps = MATERIAL_TARGETS | ||
#) | ||
ng_package( | ||
name = "npm_package", | ||
srcs = ["package.json"], | ||
entry_point = "src/lib/public_api.js", | ||
entry_point_name = "material", | ||
globals = ROLLUP_GLOBALS, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check if the globals are out of date now that rxjs has only two entry points There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They should be good; this just captures the globals specific to our own packages |
||
data = [ | ||
":theming_bundle", | ||
"//src/lib/prebuilt-themes:indigo-pink", | ||
"//src/lib/prebuilt-themes:deeppurple-amber", | ||
"//src/lib/prebuilt-themes:pink-bluegrey", | ||
"//src/lib/prebuilt-themes:purple-green", | ||
], | ||
packages = ["//src/lib/schematics:npm_package"], | ||
deps = MATERIAL_TARGETS, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Generates the data used by the stamping feature in bazel. | ||
# This script is intended to be used as a Bazel workspace_status_command, which | ||
# prints out a set of key-value pairs. | ||
# See https://github.com/angular/angular/blob/master/docs/BAZEL.md for more explanation | ||
set -u -e -E -o pipefail | ||
|
||
function onError { | ||
echo "Failed to execute: $0" | ||
echo "" | ||
} | ||
|
||
# Setup crash trap | ||
trap 'onError' ERR | ||
|
||
if [[ "$(git tag)" == "" ]]; then | ||
echo "No git tags found, can't stamp the build." | ||
echo "Either fetch the tags:" | ||
echo " git fetch [email protected]:angular/material2.git --tags" | ||
echo "or build without stamping by giving an empty workspace_status_command:" | ||
echo " bazel build --workspace_status_command= ..." | ||
echo "" | ||
fi | ||
|
||
# Gets a human-readable name for HEAD, e.g. "6.0.0-rc.0-15-g846ddfa" | ||
git_version_raw=$(git describe --abbrev=7 --tags HEAD) | ||
|
||
# Find out if there are any uncommitted local changes | ||
if [[ $(git status --untracked-files=no --porcelain) ]]; then | ||
local_changes_suffix=".with-local-changes"; | ||
else | ||
local_changes_suffix=""; | ||
fi | ||
|
||
# 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 | ||
|
||
semver_style_version="$(echo ${git_version_raw} | sed -E 's/-([0-9]+)-g/+\1.sha-/g')" | ||
version_stamp="${semver_style_version}${local_changes_suffix}" | ||
echo "BUILD_SCM_VERSION ${version_stamp}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,9 @@ test --test_output=errors | |
build --experimental_ui | ||
test --experimental_ui | ||
|
||
# Output to a more coventional location | ||
build --symlink_prefix=dist/bazel/ | ||
# Configures script to do version stamping. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you mean to remove symlink_prefix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I meant to remove it a while ago and lost the change |
||
# See https://docs.bazel.build/versions/master/user-manual.html#flag--workspace_status_command | ||
build --workspace_status_command=./tools/bazel-stamp-vars.sh | ||
|
||
############################### | ||
# Typescript / Angular / Sass # | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need this labelled? 0.7.0 was from Friday and should have what you need
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't really need to be, I can update it next time around