diff --git a/BUILD.bazel b/BUILD.bazel index 049d72fe26..a8dac5c08c 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -6,6 +6,8 @@ exports_files([ "tsconfig.json", "LICENSE", "protractor-perf.conf.js", + # Copied into the @angular/bazel package + "browser_repositories.bzl", ]) filegroup( diff --git a/integration/bazel/WORKSPACE b/integration/bazel/WORKSPACE index a670301b9e..4b217fe3ba 100644 --- a/integration/bazel/WORKSPACE +++ b/integration/bazel/WORKSPACE @@ -17,13 +17,6 @@ http_archive( url = "https://github.com/bazelbuild/rules_sass/archive/1.11.0.zip", ) -# Fetch the angular repository since we build angular from source -# TODO(gregmagolan): use angular bundles in the Bazel build -local_repository( - name = "angular", - path = "../..", -) - # Check the bazel version and download npm dependencies load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install") @@ -50,9 +43,6 @@ yarn_install( data = [ # Needed because this tsconfig file is used in the "postinstall" script. "//:angular-metadata.tsconfig.json", - # Need a reference to @angular here so that Bazel sets up the - # external repository before calling yarn_install - "@angular//:LICENSE", ], package_json = "//src:package.json", yarn_lock = "//src:yarn.lock", @@ -75,7 +65,7 @@ web_test_repositories() # Temporary work-around for https://github.com/angular/angular/issues/28681 # TODO(gregmagolan): go back to @io_bazel_rules_webtesting browser_repositories -load("@angular//:browser_repositories.bzl", "browser_repositories") +load("@npm_angular_bazel//:browser_repositories.bzl", "browser_repositories") browser_repositories() @@ -93,6 +83,6 @@ sass_repositories() # but we still need to set up the "angular" workspace since some Bazel rules depend on # the "ngdeps" repository. This can be fixed if we switched the Angular repository to the # "npm" repository for the bazel managed dependencies. -load("@angular//:index.bzl", "ng_setup_workspace") +load("@npm_angular_bazel//:index.bzl", "ng_setup_workspace") ng_setup_workspace() diff --git a/integration/bazel/package.json b/integration/bazel/package.json index 44e7011218..fa534b0185 100644 --- a/integration/bazel/package.json +++ b/integration/bazel/package.json @@ -11,6 +11,7 @@ "scripts": { "//": "deps are listed in src/package.json which is used by yarn_install", "//": "this package.json file is only here so that `yarn test` can be called by /integration/run_tests.sh", + "pretest": "./pretest.sh", "test": "bazel build ... --noshow_progress && bazel test ..." } -} +} \ No newline at end of file diff --git a/integration/bazel/pretest.sh b/integration/bazel/pretest.sh new file mode 100755 index 0000000000..4ed51eb8cb --- /dev/null +++ b/integration/bazel/pretest.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -eux -o pipefail +# -e: exits if a command fails +# -u: errors if an variable is referenced before being set +# -x: shows the commands that get run +# -o pipefail: causes a pipeline to produce a failure return code if any command errors + +# sedi makes `sed -i` work on both OSX & Linux +# See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd +sedi () { + case $(uname) in + Darwin*) sedi=('-i' '') ;; + *) sedi='-i' ;; + esac + + sed "${sedi[@]}" "$@" +} + +sedi "s#packages-dist:#file://$PWD/../../dist/packages-dist/#" src/package.json diff --git a/integration/bazel/src/BUILD.bazel b/integration/bazel/src/BUILD.bazel index 6b30a85dea..e54aa70f3d 100644 --- a/integration/bazel/src/BUILD.bazel +++ b/integration/bazel/src/BUILD.bazel @@ -1,6 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("@angular//:index.bzl", "ng_module") +load("@npm_angular_bazel//:index.bzl", "ng_module") load("@build_bazel_rules_nodejs//:defs.bzl", "http_server", "nodejs_binary", "rollup_bundle") load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package") load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") diff --git a/integration/bazel/src/hello-world/BUILD.bazel b/integration/bazel/src/hello-world/BUILD.bazel index 62b619834f..397afa978b 100644 --- a/integration/bazel/src/hello-world/BUILD.bazel +++ b/integration/bazel/src/hello-world/BUILD.bazel @@ -1,9 +1,9 @@ package(default_visibility = ["//visibility:public"]) -load("@angular//:index.bzl", "ng_module", "ng_package") -load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary") load("@build_bazel_rules_karma//:defs.bzl", "ts_web_test_suite") load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") +load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package") sass_binary( name = "hello-world-styles", diff --git a/integration/bazel/src/package.json b/integration/bazel/src/package.json index 903fbbe10c..f7400d5136 100644 --- a/integration/bazel/src/package.json +++ b/integration/bazel/src/package.json @@ -4,20 +4,20 @@ "version": "0.0.0", "license": "MIT", "dependencies": { - "@angular/animations": "file:../angular/dist/packages-dist/animations", - "@angular/common": "file:../angular/dist/packages-dist/common", - "@angular/core": "file:../angular/dist/packages-dist/core", - "@angular/platform-browser": "file:../angular/dist/packages-dist/platform-browser", - "@angular/platform-browser-dynamic": "file:../angular/dist/packages-dist/platform-browser-dynamic", + "@angular/animations": "packages-dist:animations", + "@angular/common": "packages-dist:common", + "@angular/core": "packages-dist:core", + "@angular/platform-browser": "packages-dist:platform-browser", + "@angular/platform-browser-dynamic": "packages-dist:platform-browser-dynamic", "reflect-metadata": "0.1.12", "rxjs": "6.4.0", "tslib": "1.9.3", "zone.js": "0.8.26" }, "devDependencies": { - "@angular/bazel": "file:../angular/dist/packages-dist/bazel", - "@angular/compiler": "file:../angular/dist/packages-dist/compiler", - "@angular/compiler-cli": "file:../angular/dist/packages-dist/compiler-cli", + "@angular/bazel": "packages-dist:bazel", + "@angular/compiler": "packages-dist:compiler", + "@angular/compiler-cli": "packages-dist:compiler-cli", "@bazel/karma": "0.23.2", "@bazel/typescript": "0.23.2", "@types/jasmine": "2.8.8", diff --git a/integration/bazel/test/e2e/BUILD.bazel b/integration/bazel/test/e2e/BUILD.bazel index 45b4e8b661..60fd4cdde9 100644 --- a/integration/bazel/test/e2e/BUILD.bazel +++ b/integration/bazel/test/e2e/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") -load("@angular//:index.bzl", "protractor_web_test_suite") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") ts_library( name = "e2e", diff --git a/integration/bazel/yarn.lock b/integration/bazel/yarn.lock index ea9cd9f0f0..2016c2fd75 100644 --- a/integration/bazel/yarn.lock +++ b/integration/bazel/yarn.lock @@ -2,24 +2,24 @@ # yarn lockfile v1 -"@bazel/bazel-darwin_x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.20.0.tgz#648d61c32a3c5fccb7bf70b753071b6e54b11f21" - integrity sha512-zeoeVK504341GfnaxdaB4pFzQV0YOK1HLiYj3/ocamPFxAJRh9abvKB8iOpqD5Oal0j7VsINxnXCjovp9a4urA== +"@bazel/bazel-darwin_x64@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.22.0.tgz#a2bea5922dba9a32554a218ba4849a200115b248" + integrity sha512-LFxkyQgPATeB64z/1IvOWZhK+lc3JVHejbmdo96qB4lsoD8zselvOlgHvVXxlAjRxVZ9mlmXDvDRDyaXyyRdwA== -"@bazel/bazel-linux_x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.20.0.tgz#2568628a0d0b85dcc69d0ab701b1d6e10551357d" - integrity sha512-PpHzoEqfXty8dc1/p1tVFXtbPyrE1n0N79QmYePjJ5mJMyW7uBF/zV4IajYY8+IpJEcDVq5v4BavSexOmVJRmA== +"@bazel/bazel-linux_x64@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.22.0.tgz#12e5884f2a7b7f3b62afbef9f8da4de0976f3bc8" + integrity sha512-xDs8cb2bbGZ9uvzYZOzCVrMBywzRhLj0J/t+py+FYZj+VO5B3wVg9eUf6nWWR0oJ2mzvToI9h31t2tNdqwy2kQ== -"@bazel/bazel-win32_x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.20.0.tgz#af7d041dae4c066e7aa8618949e2de1aad07495e" - integrity sha512-3bqHXFBvLnbvNzr1KCQ1zryTYvHMoQffaWVekbckgPyT2VPEj3abuB91+DrRYmZdPjcgPYnjnyanxZHDkKuF2g== +"@bazel/bazel-win32_x64@0.22.0": + version "0.22.0" + resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.22.0.tgz#a8a65986639583a8cc7b018e001aedfdafe41b50" + integrity sha512-FbJaXVDoCLnpIFLnPHFkQdfriYPXfnfQNuf9EXMliERdRuoeBVbwEZfwcuArxZWNFus7bD8QiTj0XzKVWO+Wbw== "@bazel/bazel@file:../../node_modules/@bazel/bazel": - version "0.20.0" + version "0.22.0" optionalDependencies: - "@bazel/bazel-darwin_x64" "0.20.0" - "@bazel/bazel-linux_x64" "0.20.0" - "@bazel/bazel-win32_x64" "0.20.0" + "@bazel/bazel-darwin_x64" "0.22.0" + "@bazel/bazel-linux_x64" "0.22.0" + "@bazel/bazel-win32_x64" "0.22.0" diff --git a/packages/bazel/BUILD.bazel b/packages/bazel/BUILD.bazel index 03f97b9fe0..2b0246c000 100644 --- a/packages/bazel/BUILD.bazel +++ b/packages/bazel/BUILD.bazel @@ -1,23 +1,44 @@ load("//tools:defaults.bzl", "npm_package") +genrule( + name = "copy_browser_repositories", + srcs = ["//:browser_repositories.bzl"], + outs = ["browser_repositories.bzl"], + cmd = "cp $< $@", +) + npm_package( name = "npm_package", - srcs = [ - "check_version.js", - "package.json", - "protractor-utils.js", + srcs = glob( + ["*"], + exclude = ["yarn.lock"], + ) + [ "//packages/bazel/src:package_assets", + "//packages/bazel/src/api-extractor:package_assets", "//packages/bazel/src/builders:package_assets", + "//packages/bazel/src/ng_package:package_assets", + "//packages/bazel/src/ngc-wrapped:package_assets", + "//packages/bazel/src/protractor:package_assets", "//packages/bazel/src/schematics:package_assets", + "//packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf:package_assets", ], packages = [ "//packages/bazel/docs", ], + replacements = { + "(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "", + "//packages/bazel/": "//", + "@ngdeps//": "@npm//", + "@angular//:@angular/bazel/ngc-wrapped": "@npm//@angular/bazel/bin:ngc-wrapped", + "angular/packages/bazel/": "npm_angular_bazel/", + }, tags = ["release-with-framework"], # Do not add more to this list. # Dependencies on the full npm_package cause long re-builds. visibility = ["//visibility:private"], deps = [ + ":copy_browser_repositories", + "//packages/bazel/src/api-extractor:lib", "//packages/bazel/src/builders", "//packages/bazel/src/ng_package:lib", "//packages/bazel/src/ngc-wrapped:ngc_lib", diff --git a/packages/bazel/check_version.js b/packages/bazel/check_version.js deleted file mode 100644 index cbc94543cb..0000000000 --- a/packages/bazel/check_version.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @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 - */ -/** - * @fileoverview This script runs as a postinstall in the published npm packages - * and checks that the version of the Angular external repository matches that - * of the published npm package. - * - * Note, this check is only performed with bazel managed deps when the yarn or - * npm install is from a yarn_install or npm_install repository rule. For self - * managed bazel deps this check is not performed and it is the responsibility - * of the user to ensure that the versions match. - */ -'use strict'; - -const path = require('path'); -const fs = require('fs'); -const semver = require('semver'); - -// Version in package.bzl should match the npm package version -// but this should be tolerant of development stamped versions such as -// "0.17.0-7-g76dc057" -const npmPackageVersion = process.env.npm_package_version.split('-')[0]; - -// If this is a bazel managed deps yarn_install or npm_install then the -// cwd is $(bazel info -// output_base)/external//node_modules/@angular/bazel and there should -// be $(bazel info output_base)/external//internal/generate_build_file.js -// folder -function isBazelManagedDeps() { - try { - fs.statSync('../../../generate_build_file.js'); - return true; - } catch (e) { - return false; - } -} - -if (isBazelManagedDeps()) { - let contents; - try { - // If this is a yarn_install or npm_install then the cwd is $(bazel info - // output_base)/external//node_modules/@angular/bazel so we can look for - // the package.json file under $(bazel info - // output_base)/external/angular/package.json - const packagePath = path.resolve(process.cwd(), '../../../../angular/package.json'); - contents = require(packagePath); - } catch (e) { - throw new Error('The angular repository is not installed in your Bazel WORKSPACE file'); - } - if (contents.name !== 'angular-srcs') { - throw new Error('Invalid package.json in angular repository'); - } - // Be tolerant of versions such as "0.17.0-7-g76dc057" - const angularPackageVersion = contents.version.split('-')[0]; - // Should match only the major and minor versions - const range = `${semver.major(angularPackageVersion)}.${semver.minor(angularPackageVersion)}.x`; - if (!semver.satisfies(npmPackageVersion, range)) { - throw new Error( - `Expected angular npm version ${npmPackageVersion} to satisfy ${range}. ` + - `Please update ANGULAR_VERSION in WORKSPACE file to match ${npmPackageVersion}`); - } -} else { - // No version check - console.warn(`WARNING: With self managed deps you must ensure the @angular/bazel -npm package version matches the angular repository version. -Use yarn_install or npm_install for this version to be checked automatically. -`); -} diff --git a/packages/bazel/package.json b/packages/bazel/package.json index 52d133f937..6199bb110b 100644 --- a/packages/bazel/package.json +++ b/packages/bazel/package.json @@ -11,6 +11,12 @@ "modify_tsconfig": "./src/modify_tsconfig.js" }, "typings": "./src/ngc-wrapped/index.d.ts", + "bazelWorkspaces": { + "npm_angular_bazel": { + "version": "0.0.0-PLACEHOLDER", + "rootPath": "." + } + }, "dependencies": { "@angular-devkit/architect": "^0.10.6", "@angular-devkit/core": "^7.0.4", @@ -34,8 +40,5 @@ "schematics": "./src/schematics/collection.json", "ng-update": { "packageGroup": "NG_UPDATE_PACKAGE_GROUP" - }, - "scripts": { - "postinstall": "node ./check_version.js" } } \ No newline at end of file diff --git a/packages/bazel/src/BUILD.bazel b/packages/bazel/src/BUILD.bazel index 4ca155ee46..6f806fbfec 100644 --- a/packages/bazel/src/BUILD.bazel +++ b/packages/bazel/src/BUILD.bazel @@ -1,9 +1,8 @@ -package(default_visibility = ["//visibility:public"]) +package(default_visibility = ["//packages/bazel:__subpackages__"]) filegroup( name = "package_assets", - srcs = ["modify_tsconfig.js"], - visibility = ["//packages/bazel:__subpackages__"], + srcs = glob(["*"]), ) # For generating skydoc @@ -22,6 +21,12 @@ nodejs_binary( ], entry_point = "ngdeps/node_modules/rollup/bin/rollup", install_source_map_support = False, + visibility = ["//visibility:public"], +) + +filegroup( + name = "empty_node_modules", + srcs = [], ) nodejs_binary( @@ -29,4 +34,6 @@ nodejs_binary( data = ["modify_tsconfig.js"], entry_point = "angular/packages/bazel/src/modify_tsconfig.js", install_source_map_support = False, + node_modules = ":empty_node_modules", + visibility = ["//visibility:public"], ) diff --git a/packages/bazel/src/ng_package/BUILD.bazel b/packages/bazel/src/ng_package/BUILD.bazel index cacb014d35..737bdc2bd0 100644 --- a/packages/bazel/src/ng_package/BUILD.bazel +++ b/packages/bazel/src/ng_package/BUILD.bazel @@ -1,9 +1,9 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary") -load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") -exports_files(["ng_package.bzl"]) +# BEGIN-DEV-ONLY +load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") ts_library( name = "lib", @@ -16,6 +16,7 @@ ts_library( ], ) +# END-DEV-ONLY nodejs_binary( name = "packager", data = [ @@ -25,3 +26,10 @@ nodejs_binary( entry_point = "angular/packages/bazel/src/ng_package/packager.js", install_source_map_support = False, ) + +exports_files(["ng_package.bzl"]) + +filegroup( + name = "package_assets", + srcs = glob(["*.bzl"]) + ["BUILD.bazel"], +) diff --git a/packages/bazel/src/ngc-wrapped/BUILD.bazel b/packages/bazel/src/ngc-wrapped/BUILD.bazel index f338fd272d..d7fcc0dbaa 100644 --- a/packages/bazel/src/ngc-wrapped/BUILD.bazel +++ b/packages/bazel/src/ngc-wrapped/BUILD.bazel @@ -32,7 +32,7 @@ nodejs_binary( configuration_env_vars = ["compile"], data = [ ":ngc_lib", - "@build_bazel_rules_typescript//third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto", + "//packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto", "@ngdeps//source-map-support", "@ngdeps//tslib", ], @@ -49,3 +49,9 @@ nodejs_binary( entry_point = "angular/packages/bazel/src/ngc-wrapped/extract_i18n.js", visibility = ["//visibility:public"], ) + +filegroup( + name = "package_assets", + srcs = ["BUILD.bazel"], + visibility = ["//packages/bazel:__subpackages__"], +) diff --git a/packages/bazel/src/protractor/BUILD.bazel b/packages/bazel/src/protractor/BUILD.bazel index 209bcc6919..f8dfd06070 100644 --- a/packages/bazel/src/protractor/BUILD.bazel +++ b/packages/bazel/src/protractor/BUILD.bazel @@ -4,3 +4,8 @@ exports_files([ "protractor.conf.js", "protractor_web_test.bzl", ]) + +filegroup( + name = "package_assets", + srcs = glob(["*"]), +) diff --git a/packages/bazel/src/schematics/bazel-workspace/files/e2e/BUILD.bazel.template b/packages/bazel/src/schematics/bazel-workspace/files/e2e/BUILD.bazel.template index b58aaac891..4afedbe958 100644 --- a/packages/bazel/src/schematics/bazel-workspace/files/e2e/BUILD.bazel.template +++ b/packages/bazel/src/schematics/bazel-workspace/files/e2e/BUILD.bazel.template @@ -22,7 +22,7 @@ ts_library( protractor_web_test_suite( name = "prodserver_test", data = [ - "@angular//packages/bazel/src/protractor/utils", + "@angular//" + "packages/bazel/src/protractor/utils", "@npm//protractor", ], on_prepare = ":protractor.on-prepare.js", @@ -33,7 +33,7 @@ protractor_web_test_suite( protractor_web_test_suite( name = "devserver_test", data = [ - "@angular//packages/bazel/src/protractor/utils", + "@angular//" + "packages/bazel/src/protractor/utils", "@npm//protractor", ], on_prepare = ":protractor.on-prepare.js", diff --git a/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/BUILD.bazel b/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/BUILD.bazel new file mode 100644 index 0000000000..b4bb240b0a --- /dev/null +++ b/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/BUILD.bazel @@ -0,0 +1,11 @@ +# Fetched from https://github.com/bazelbuild/bazel/blob/master/src/main/protobuf/worker_protocol.proto +licenses(["notice"]) + +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "package_assets", + srcs = glob(["*"]), +) + +exports_files(["worker_protocol.proto"]) diff --git a/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/LICENSE b/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/worker_protocol.proto b/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/worker_protocol.proto new file mode 100644 index 0000000000..4706792f4e --- /dev/null +++ b/packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf/worker_protocol.proto @@ -0,0 +1,51 @@ +// Copyright 2015 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package blaze.worker; + +option java_package = "com.google.devtools.build.lib.worker"; + +// An input file. +message Input { + // The path in the file system where to read this input artifact from. This is + // either a path relative to the execution root (the worker process is + // launched with the working directory set to the execution root), or an + // absolute path. + string path = 1; + + // A hash-value of the contents. The format of the contents is unspecified and + // the digest should be treated as an opaque token. + bytes digest = 2; +} + +// This represents a single work unit that Blaze sends to the worker. +message WorkRequest { + repeated string arguments = 1; + + // The inputs that the worker is allowed to read during execution of this + // request. + repeated Input inputs = 2; +} + +// The worker sends this message to Blaze when it finished its work on the WorkRequest message. +message WorkResponse { + int32 exit_code = 1; + + // This is printed to the user after the WorkResponse has been received and is supposed to contain + // compiler warnings / errors etc. - thus we'll use a string type here, which gives us UTF-8 + // encoding. + string output = 2; +}