-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: switch to release output from bazel #17046
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
Merged
jelbourn
merged 14 commits into
angular:master
from
devversion:build/npm-packages-bazel
Sep 18, 2019
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
de00527
build: workaround for creating ng_package on windows
devversion d68e55d
refactor(material): remove re-exports from primary entry-point
devversion 677ad91
build: re-root style files for bazel cdk package
devversion 12a475d
build: include license in bazel npm packages
devversion 81ce518
build: switch to release output from bazel
devversion 6a87a91
build: include cdk schematics in cdk bazel ng_package
devversion 89e71b3
build: update version placeholder for mdc version in bazel
devversion f9a59d7
build: switch coercion and keycodes entry-point to ng_module
devversion 9bc4013
build: setup primary entry-point package.json files to match release …
devversion 5ea0ac7
build: include cdk testing entry-point in release package
devversion fd7e949
build: properly publish sass files in release packages
devversion 54fbf1e
build: fix missing metadata for example modules
devversion 9de1d3b
build: add workaround for invalid imports generation in bazel
devversion 3c938b0
build: fix npm package for google-maps
devversion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
exports_files(["LICENSE"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
devversion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
devversion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Script that builds the release output of all packages which have the "release-package" | ||
# bazel tag set. The script builds all those packages and copies the release output to a | ||
# folder within the project. | ||
|
||
set -u -e -o pipefail | ||
|
||
# Go to project directory. | ||
cd $(dirname ${0})/.. | ||
|
||
# Either "legacy" (view engine) or "aot" (ivy) | ||
compile_mode=${1:-"legacy"} | ||
|
||
# Path to the bazel binary. By default uses "bazel" from the node modules but developers | ||
# can overwrite the binary though an environment variable. Also by default if we run Bazel | ||
# from the node modules, we don't want to access bazel through Yarn and NodeJS because it | ||
# could mean that the Bazel child process only has access to limited memory. | ||
bazel=${BAZEL_BIN_PATH:-$(yarn bin bazel)} | ||
|
||
echo "######################################" | ||
echo " building release packages" | ||
echo " mode: ${compile_mode}" | ||
echo "######################################" | ||
echo "" | ||
|
||
# Path to the output directory into which we copy the npm packages. | ||
dest_path="dist/releases" | ||
|
||
# Path to the bazel-bin directory. | ||
bazel_bin_path=$(${bazel} info bazel-bin 2> /dev/null) | ||
|
||
# List of targets that need to be built, e.g. //src/lib, //src/cdk, etc. Note we need to remove all | ||
# carriage returns because Bazel prints these on Windows. This breaks the Bash array parsing. | ||
targets=$(${bazel} query --output=label 'attr("tags", "\[.*release-package.*\]", //src/...)' \ | ||
'intersect kind(".*_package", //src/...)' 2> /dev/null | tr -d "\r") | ||
devversion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Walk through each release package target and build it. | ||
for target in ${targets}; do | ||
echo -e "Building: ${target} ...\n" | ||
# Build with "--config=release" so that Bazel runs the workspace stamping script. The | ||
# stamping script ensures that the version placeholder is populated in the release output. | ||
${bazel} build --config=release --define=compile=${compile_mode} ${target} | ||
echo "" | ||
done | ||
|
||
# Delete the distribution directory so that the output is guaranteed to be clean. Re-create | ||
# the empty directory so that we can copy the release packages into it later. | ||
rm -Rf ${dest_path} | ||
mkdir -p ${dest_path} | ||
|
||
# Extracts the package name from the Bazel target names. e.g. `src/material:npm_package` | ||
# will result in "material". | ||
dirs=`echo "$targets" | sed -e 's/\/\/src\/\(.*\):npm_package/\1/'` | ||
devversion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Copy the package output for all built NPM packages into the dist directory. | ||
for pkg in ${dirs}; do | ||
pkg_dir="${bazel_bin_path}/src/${pkg}/npm_package" | ||
target_dir="${dest_path}/${pkg}" | ||
|
||
if [[ -d ${pkg_dir} ]]; then | ||
echo "> Copying package output to \"${target_dir}\".." | ||
rm -rf ${target_dir} | ||
cp -R --no-preserve=mode ${pkg_dir} ${target_dir} | ||
fi | ||
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.