diff --git a/.circleci/config.yml b/.circleci/config.yml index 7893208e54..4ce1cfd6a8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,6 +111,42 @@ jobs: paths: - "node_modules" - "~/bazel_repository_cache" + # Temporary job to test what will happen when we flip the Ivy flag to true + test_ivy_jit: + <<: *job_defaults + resource_class: xlarge + steps: + - *define_env_vars + - checkout: + <<: *post_checkout + # See remote cache documentation in /docs/BAZEL.md + - run: .circleci/setup_cache.sh + - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc + - *setup-bazel-remote-cache + + - restore_cache: + key: *cache_key + + - run: bazel run @yarn//:yarn + - run: bazel query --output=label //... | xargs bazel test --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=-manual,ivy-jit + + test_ivy_aot: + <<: *job_defaults + resource_class: xlarge + steps: + - *define_env_vars + - checkout: + <<: *post_checkout + # See remote cache documentation in /docs/BAZEL.md + - run: .circleci/setup_cache.sh + - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc + - *setup-bazel-remote-cache + + - restore_cache: + key: *cache_key + + - run: bazel run @yarn//:yarn + - run: bazel query --output=label //... | xargs bazel test --define=compile=local --build_tag_filters=ivy-local --test_tag_filters=-manual,ivy-local # This job exists only for backwards-compatibility with old scripts and tests # that rely on the pre-Bazel dist/packages-dist layout. @@ -140,6 +176,8 @@ jobs: root: dist paths: - packages-dist + - packages-dist-ivy-jit + - packages-dist-ivy-local # We run the integration tests outside of Bazel for now. # They are a separate workflow job so that they can be easily re-run. @@ -200,6 +238,8 @@ workflows: jobs: - lint - test + - test_ivy_jit + - test_ivy_aot - build-packages-dist - integration_test: requires: @@ -212,6 +252,8 @@ workflows: requires: # Only publish if tests and integration tests pass - test + - test_ivy_jit + - test_ivy_aot - integration_test # Get the artifacts to publish from the build-packages-dist job # since the publishing script expects the legacy outputs layout. diff --git a/packages/animations/BUILD.bazel b/packages/animations/BUILD.bazel index ee56422dc1..8cf0a12c17 100644 --- a/packages/animations/BUILD.bazel +++ b/packages/animations/BUILD.bazel @@ -24,7 +24,10 @@ ng_package( "//packages/animations/browser/testing:package.json", ], entry_point = "packages/animations/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":animations", "//packages/animations/browser", diff --git a/packages/common/BUILD.bazel b/packages/common/BUILD.bazel index e84f675896..bcf015c9d5 100644 --- a/packages/common/BUILD.bazel +++ b/packages/common/BUILD.bazel @@ -27,7 +27,10 @@ ng_package( ], entry_point = "packages/common/index.js", packages = ["//packages/common/locales:package"], - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ "//packages/common", "//packages/common/http", diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel index e75f0399a2..e10d0f4d2e 100644 --- a/packages/compiler-cli/BUILD.bazel +++ b/packages/compiler-cli/BUILD.bazel @@ -34,6 +34,9 @@ npm_package( srcs = [ "package.json", ], - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [":compiler-cli"], ) diff --git a/packages/compiler/BUILD.bazel b/packages/compiler/BUILD.bazel index 5dab11e686..4c269ffb73 100644 --- a/packages/compiler/BUILD.bazel +++ b/packages/compiler/BUILD.bazel @@ -21,7 +21,10 @@ ng_package( ], entry_point = "packages/compiler/compiler.js", include_devmode_srcs = True, - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":compiler", "//packages/compiler/testing", diff --git a/packages/core/BUILD.bazel b/packages/core/BUILD.bazel index 6da82e9b34..5dbdbfbe4b 100644 --- a/packages/core/BUILD.bazel +++ b/packages/core/BUILD.bazel @@ -29,7 +29,11 @@ ng_package( "//packages/core/testing:package.json", ], entry_point = "packages/core/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "ivy-local", + "release-with-framework", + ], deps = [ ":core", "//packages/core/testing", diff --git a/packages/core/test/BUILD.bazel b/packages/core/test/BUILD.bazel index bf1c7473b0..e8cfc9708e 100644 --- a/packages/core/test/BUILD.bazel +++ b/packages/core/test/BUILD.bazel @@ -11,6 +11,7 @@ ts_library( exclude = [ "**/*_node_only_spec.ts", "render3/**/*.ts", + "ivy_local_empty_spec.ts", ], ), deps = [ @@ -33,6 +34,15 @@ ts_library( ], ) +ts_library( + name = "ivy_local_empty_lib", + testonly = 1, + srcs = ["ivy_local_empty_spec.ts"], + deps = [ + "//packages:types", + ], +) + ts_library( name = "test_node_only_lib", testonly = 1, @@ -60,6 +70,19 @@ jasmine_node_test( ], ) +jasmine_node_test( + name = "ivy_local_empty_test", + bootstrap = ["angular/tools/testing/init_node_no_angular_spec.js"], + tags = [ + "ivy-local", + "ivy-only", + ], + deps = [ + ":ivy_local_empty_lib", + "//tools/testing:node_no_angular", + ], +) + ts_web_test_suite( name = "test_web", deps = [ diff --git a/packages/core/test/ivy_local_empty_spec.ts b/packages/core/test/ivy_local_empty_spec.ts new file mode 100644 index 0000000000..e74dd0455a --- /dev/null +++ b/packages/core/test/ivy_local_empty_spec.ts @@ -0,0 +1,19 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/* + * This file exists to have at least one test target that can pass with --define=compile=local. + * + * TODO(alxhub): Clean up once actual Angular tests start passing with Ivy/AOT. + */ + +describe('empty test', () => { + it('should pass without doing anything', () => { + // If this fails, you probably need a new computer. + }); +}); diff --git a/packages/elements/BUILD.bazel b/packages/elements/BUILD.bazel index 03c35cdd47..8821aaafcc 100644 --- a/packages/elements/BUILD.bazel +++ b/packages/elements/BUILD.bazel @@ -28,7 +28,10 @@ ng_package( packages = [ "//packages/elements/schematics:npm_package", ], - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":elements", ], diff --git a/packages/forms/BUILD.bazel b/packages/forms/BUILD.bazel index a26bab1e3a..24f377d99e 100644 --- a/packages/forms/BUILD.bazel +++ b/packages/forms/BUILD.bazel @@ -22,7 +22,10 @@ ng_package( name = "npm_package", srcs = ["package.json"], entry_point = "packages/forms/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":forms", ], diff --git a/packages/http/BUILD.bazel b/packages/http/BUILD.bazel index 453d42a0a0..66b8230f1d 100644 --- a/packages/http/BUILD.bazel +++ b/packages/http/BUILD.bazel @@ -25,7 +25,10 @@ ng_package( "//packages/http/testing:package.json", ], entry_point = "packages/http/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":http", "//packages/http/testing", diff --git a/packages/language-service/BUILD.bazel b/packages/language-service/BUILD.bazel index 11d5f92393..b042e693b5 100644 --- a/packages/language-service/BUILD.bazel +++ b/packages/language-service/BUILD.bazel @@ -23,6 +23,7 @@ npm_package( name = "npm_package", srcs = ["package.json"], tags = [ + "ivy-jit", "release-with-framework", ], deps = [ diff --git a/packages/platform-browser-dynamic/BUILD.bazel b/packages/platform-browser-dynamic/BUILD.bazel index 26762f35db..7eea343f5c 100644 --- a/packages/platform-browser-dynamic/BUILD.bazel +++ b/packages/platform-browser-dynamic/BUILD.bazel @@ -27,7 +27,10 @@ ng_package( "//packages/platform-browser-dynamic/testing:package.json", ], entry_point = "packages/platform-browser-dynamic/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":platform-browser-dynamic", "//packages/platform-browser-dynamic/testing", diff --git a/packages/platform-browser/BUILD.bazel b/packages/platform-browser/BUILD.bazel index 214e482e29..b9ad4a7331 100644 --- a/packages/platform-browser/BUILD.bazel +++ b/packages/platform-browser/BUILD.bazel @@ -26,7 +26,10 @@ ng_package( "//packages/platform-browser/testing:package.json", ], entry_point = "packages/platform-browser/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":platform-browser", "//packages/platform-browser/animations", diff --git a/packages/platform-server/BUILD.bazel b/packages/platform-server/BUILD.bazel index a967e51f16..f1f8242cfb 100644 --- a/packages/platform-server/BUILD.bazel +++ b/packages/platform-server/BUILD.bazel @@ -32,7 +32,10 @@ ng_package( "//packages/platform-server/testing:package.json", ], entry_point = "packages/platform-server/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":platform-server", "//packages/platform-server/testing", diff --git a/packages/platform-webworker-dynamic/BUILD.bazel b/packages/platform-webworker-dynamic/BUILD.bazel index ed85ccb473..4e3d7260cd 100644 --- a/packages/platform-webworker-dynamic/BUILD.bazel +++ b/packages/platform-webworker-dynamic/BUILD.bazel @@ -24,6 +24,9 @@ ng_package( name = "npm_package", srcs = ["package.json"], entry_point = "packages/platform-webworker-dynamic/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [":platform-webworker-dynamic"], ) diff --git a/packages/platform-webworker/BUILD.bazel b/packages/platform-webworker/BUILD.bazel index dfdafe0cc8..c21890fc21 100644 --- a/packages/platform-webworker/BUILD.bazel +++ b/packages/platform-webworker/BUILD.bazel @@ -24,7 +24,10 @@ ng_package( name = "npm_package", srcs = ["package.json"], entry_point = "packages/platform-webworker/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":platform-webworker", ], diff --git a/packages/router/BUILD.bazel b/packages/router/BUILD.bazel index cadbae38e8..547927f85b 100644 --- a/packages/router/BUILD.bazel +++ b/packages/router/BUILD.bazel @@ -28,7 +28,10 @@ ng_package( "//packages/router/upgrade:package.json", ], entry_point = "packages/router/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":router", "//packages/router/testing", diff --git a/packages/service-worker/BUILD.bazel b/packages/service-worker/BUILD.bazel index 5777b67bf0..8be9e9c52f 100644 --- a/packages/service-worker/BUILD.bazel +++ b/packages/service-worker/BUILD.bazel @@ -47,6 +47,7 @@ ng_package( ], entry_point = "packages/service-worker/index.js", tags = [ + "ivy-jit", "release-with-framework", ], deps = [ diff --git a/packages/upgrade/BUILD.bazel b/packages/upgrade/BUILD.bazel index 2e828c8010..09bff3383e 100644 --- a/packages/upgrade/BUILD.bazel +++ b/packages/upgrade/BUILD.bazel @@ -25,7 +25,10 @@ ng_package( "//packages/upgrade/static:package.json", ], entry_point = "packages/upgrade/index.js", - tags = ["release-with-framework"], + tags = [ + "ivy-jit", + "release-with-framework", + ], deps = [ ":upgrade", "//packages/upgrade/static", diff --git a/scripts/build-packages-dist.sh b/scripts/build-packages-dist.sh index 6ebc5e7b7c..1dbb4e29ae 100755 --- a/scripts/build-packages-dist.sh +++ b/scripts/build-packages-dist.sh @@ -12,30 +12,48 @@ cd "$(dirname "$0")" # basedir is the workspace root readonly basedir=$(pwd)/.. +readonly bin=$(bazel info bazel-bin) + +function buildTargetPackages() { + targets="$1" + destPath="$2" + compileMode="$3" + desc="$4" echo "##################################" echo "scripts/build-packages-dist.sh:" echo " building @angular/* npm packages" +echo " mode: ${desc}" echo "##################################" + + echo "$targets" | xargs bazel build --define=compile=$compileMode + + [ -d "${basedir}/${destPath}" ] || mkdir -p $basedir/${destPath} + + dirs=`echo "$targets" | grep '//packages/[^/]*:npm_package' | sed -e 's/\/\/packages\/\(.*\):npm_package/\1/'` + + for pkg in $dirs; do + # Skip any that don't have an "npm_package" target + srcDir="${bin}/packages/${pkg}/npm_package" + destDir="${basedir}/${destPath}/${pkg}" + if [ -d $srcDir ]; then + echo "# Copy artifacts to ${destDir}" + rm -rf $destDir + cp -R $srcDir $destDir + chmod -R u+w $destDir + fi + done +} + # Ideally these integration tests should run under bazel, and just list the npm # packages in their deps[]. # Until then, we have to manually run bazel first to create the npm packages we # want to test. -bazel query --output=label 'kind(.*_package, //packages/...)' \ - | xargs bazel build -readonly bin=$(bazel info bazel-bin) +LEGACY_TARGETS=`bazel query --output=label 'kind(.*_package, //packages/...)'` +IVY_JIT_TARGETS=`bazel query --output=label 'attr("tags", "\[.*ivy-jit.*\]", //packages/...) intersect kind(".*_package", //packages/...)'` +IVY_LOCAL_TARGETS=`bazel query --output=label 'attr("tags", "\[.*ivy-local.*\]", //packages/...) intersect kind(".*_package", //packages/...)'` + +buildTargetPackages "$LEGACY_TARGETS" "dist/packages-dist" "legacy" "Production" +buildTargetPackages "$IVY_JIT_TARGETS" "dist/packages-dist-ivy-jit" "jit" "Ivy JIT" +buildTargetPackages "$IVY_LOCAL_TARGETS" "dist/packages-dist-ivy-local" "local" "Ivy AOT" -# Create the legacy dist/packages-dist folder -[ -d "${basedir}/dist/packages-dist" ] || mkdir -p $basedir/dist/packages-dist -# Each package is a subdirectory of bazel-bin/packages/ -for pkg in $(ls ${bin}/packages); do - # Skip any that don't have an "npm_package" target - srcDir="${bin}/packages/${pkg}/npm_package" - destDir="${basedir}/dist/packages-dist/${pkg}" - if [ -d $srcDir ]; then - echo "# Copy artifacts to ${destDir}" - rm -rf $destDir - cp -R $srcDir $destDir - chmod -R u+w $destDir - fi -done diff --git a/scripts/ci/publish-build-artifacts.sh b/scripts/ci/publish-build-artifacts.sh index e89754a4d7..8f30c40053 100755 --- a/scripts/ci/publish-build-artifacts.sh +++ b/scripts/ci/publish-build-artifacts.sh @@ -117,12 +117,20 @@ function publishPackages { echo "Finished publishing build artifacts" } +function publishAllBuilds() { + GIT_SCHEME="$1" + + publishPackages $GIT_SCHEME dist/packages-dist $CUR_BRANCH + publishPackages $GIT_SCHEME dist/packages-dist-ivy-jit "${CUR_BRANCH}-ivy-jit" + publishPackages $GIT_SCHEME dist/packages-dist-ivy-local "${CUR_BRANCH}-ivy-aot" +} + # See docs/DEVELOPER.md for help CUR_BRANCH=${CIRCLE_BRANCH:-$(git symbolic-ref --short HEAD)} if [ $# -gt 0 ]; then ORG=$1 - publishPackages "ssh" dist/packages-dist $CUR_BRANCH + publishAllBuilds "ssh" else ORG="angular" - publishPackages "http" dist/packages-dist $CUR_BRANCH + publishAllBuilds "http" fi