build: Introduce Bazel build rules
So far this just compiles the core and common packages.
This commit is contained in:
parent
02d74cafba
commit
5faf520067
6
.bazelrc
Normal file
6
.bazelrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Disable sandboxing because it's too slow.
|
||||||
|
# https://github.com/bazelbuild/bazel/issues/2424
|
||||||
|
build --spawn_strategy=standalone
|
||||||
|
|
||||||
|
# Performance: avoid stat'ing input files
|
||||||
|
build --watchfs
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
.DS_STORE
|
.DS_STORE
|
||||||
|
|
||||||
/dist/
|
/dist/
|
||||||
|
bazel-*
|
||||||
node_modules
|
node_modules
|
||||||
bower_components
|
bower_components
|
||||||
|
|
||||||
|
18
BUILD
Normal file
18
BUILD
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
exports_files(["tsconfig.json"])
|
||||||
|
|
||||||
|
# This rule belongs in node_modules/BUILD
|
||||||
|
# It's here as a workaround for
|
||||||
|
# https://github.com/bazelbuild/bazel/issues/374#issuecomment-296217940
|
||||||
|
filegroup(
|
||||||
|
name = "node_modules",
|
||||||
|
srcs = glob([
|
||||||
|
# Performance workaround: list individual files
|
||||||
|
# This won't scale in the general case.
|
||||||
|
# TODO(alexeagle): figure out what to do
|
||||||
|
"node_modules/typescript/lib/**",
|
||||||
|
"node_modules/zone.js/**/*.d.ts",
|
||||||
|
"node_modules/rxjs/**/*.d.ts",
|
||||||
|
"node_modules/@types/**/*.d.ts",
|
||||||
|
]),
|
||||||
|
)
|
12
WORKSPACE
Normal file
12
WORKSPACE
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||||
|
|
||||||
|
git_repository(
|
||||||
|
name = "io_bazel_rules_typescript",
|
||||||
|
remote = "https://github.com/bazelbuild/rules_typescript.git",
|
||||||
|
tag = "0.0.3",
|
||||||
|
)
|
||||||
|
|
||||||
|
load("@io_bazel_rules_typescript//:defs.bzl", "node_repositories", "yarn_install")
|
||||||
|
|
||||||
|
node_repositories()
|
||||||
|
yarn_install(package_json = "//:package.json")
|
@ -10,7 +10,7 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.5 <7.0.0",
|
"node": ">=6.9.5 <7.0.0",
|
||||||
"npm": ">=3.10.7 <4.0.0",
|
"npm": ">=3.10.7 <4.0.0",
|
||||||
"yarn": ">=0.21.3 <0.22.0"
|
"yarn": ">=0.21.3 <1.0.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
13
packages/common/BUILD
Normal file
13
packages/common/BUILD
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package(default_visibility=["//visibility:public"])
|
||||||
|
load("@io_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||||
|
|
||||||
|
ts_library(
|
||||||
|
name = "common",
|
||||||
|
srcs = glob(["**/*.ts"], exclude=[
|
||||||
|
"test/**",
|
||||||
|
"testing/**",
|
||||||
|
]),
|
||||||
|
module_name = "@angular/common",
|
||||||
|
deps = ["//packages/core"],
|
||||||
|
tsconfig = ":tsconfig-build.json",
|
||||||
|
)
|
@ -1,35 +1,41 @@
|
|||||||
{
|
{
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"annotateForClosureCompiler": true,
|
||||||
|
"strictMetadataEmit": true,
|
||||||
|
"flatModuleOutFile": "index.js",
|
||||||
|
"flatModuleId": "@angular/common"
|
||||||
|
},
|
||||||
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
|
||||||
"declaration": true,
|
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
"experimentalDecorators": true,
|
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"module": "es2015",
|
"module": "es2015",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"target": "es2015",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"lib": [ "es2015", "dom" ],
|
||||||
|
// don't auto-discover @types/node, it results in a ///<reference in the .d.ts output
|
||||||
|
"types": [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The rest of the file is configuration that's overridden by bazel.
|
||||||
|
* It can be removed after we fully migrate.
|
||||||
|
*/
|
||||||
|
"baseUrl": ".",
|
||||||
|
"declaration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
"outDir": "../../dist/packages/common",
|
"outDir": "../../dist/packages/common",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@angular/core": ["../../dist/packages/core"]
|
"@angular/core": ["../../dist/packages/core"]
|
||||||
},
|
},
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"inlineSources": true,
|
"inlineSources": true
|
||||||
"target": "es2015",
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"lib": [ "es2015", "dom" ],
|
|
||||||
// don't auto-discover @types/node, it results in a ///<reference in the .d.ts output
|
|
||||||
"types": []
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"public_api.ts",
|
"public_api.ts",
|
||||||
"../../node_modules/zone.js/dist/zone.js.d.ts"
|
"../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||||
],
|
]
|
||||||
"angularCompilerOptions": {
|
|
||||||
"annotateForClosureCompiler": true,
|
|
||||||
"strictMetadataEmit": true,
|
|
||||||
"flatModuleOutFile": "index.js",
|
|
||||||
"flatModuleId": "@angular/common"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
13
packages/core/BUILD
Normal file
13
packages/core/BUILD
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package(default_visibility=["//visibility:public"])
|
||||||
|
load("@io_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||||
|
|
||||||
|
ts_library(
|
||||||
|
name = "core",
|
||||||
|
srcs = glob(["**/*.ts"], exclude=[
|
||||||
|
"test/**",
|
||||||
|
"testing/**",
|
||||||
|
]),
|
||||||
|
module_name = "@angular/core",
|
||||||
|
deps = [],
|
||||||
|
tsconfig = ":tsconfig-build.json",
|
||||||
|
)
|
@ -16,6 +16,7 @@ import {NgModuleFactoryLoader} from './ng_module_factory_loader';
|
|||||||
const _SEPARATOR = '#';
|
const _SEPARATOR = '#';
|
||||||
|
|
||||||
const FACTORY_CLASS_SUFFIX = 'NgFactory';
|
const FACTORY_CLASS_SUFFIX = 'NgFactory';
|
||||||
|
declare var System: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for SystemJsNgModuleLoader.
|
* Configuration for SystemJsNgModuleLoader.
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Import zero symbols from zone.js. This causes the zone ambient type to be
|
||||||
|
// added to the type-checker, without emitting any runtime module load statement
|
||||||
|
import {} from 'zone.js';
|
||||||
|
|
||||||
// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492
|
// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492
|
||||||
declare var WorkerGlobalScope: any /** TODO #9100 */;
|
declare var WorkerGlobalScope: any /** TODO #9100 */;
|
||||||
// CommonJS / Node have global context exposed as "global" variable.
|
// CommonJS / Node have global context exposed as "global" variable.
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Import zero symbols from zone.js. This causes the zone ambient type to be
|
||||||
|
// added to the type-checker, without emitting any runtime module load statement
|
||||||
|
import {} from 'zone.js';
|
||||||
import {EventEmitter} from '../event_emitter';
|
import {EventEmitter} from '../event_emitter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,34 +1,40 @@
|
|||||||
{
|
{
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"annotateForClosureCompiler": true,
|
||||||
|
"strictMetadataEmit": true,
|
||||||
|
"flatModuleOutFile": "index.js",
|
||||||
|
"flatModuleId": "@angular/core"
|
||||||
|
},
|
||||||
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
"experimentalDecorators": true,
|
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"module": "es2015",
|
"module": "es2015",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"target": "es2015",
|
||||||
|
"lib": ["es2015", "dom"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
// don't auto-discover @types/node, it results in a ///<reference in the .d.ts output
|
||||||
|
"types": [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The rest of the file is configuration that's overridden by bazel.
|
||||||
|
* It can be removed after we fully migrate.
|
||||||
|
*/
|
||||||
|
"baseUrl": ".",
|
||||||
|
"experimentalDecorators": true,
|
||||||
"outDir": "../../dist/packages/core",
|
"outDir": "../../dist/packages/core",
|
||||||
"paths": {
|
"paths": {
|
||||||
"rxjs/*": ["../../node_modules/rxjs/*"]
|
"rxjs/*": ["../../node_modules/rxjs/*"]
|
||||||
},
|
},
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"inlineSources": true,
|
"inlineSources": true
|
||||||
"target": "es2015",
|
|
||||||
"lib": ["es2015", "dom"],
|
|
||||||
"skipLibCheck": true,
|
|
||||||
// don't auto-discover @types/node, it results in a ///<reference in the .d.ts output
|
|
||||||
"types": []
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"public_api.ts",
|
"public_api.ts",
|
||||||
"../../node_modules/zone.js/dist/zone.js.d.ts",
|
"../../node_modules/zone.js/dist/zone.js.d.ts",
|
||||||
"../system.d.ts"
|
"../system.d.ts"
|
||||||
],
|
]
|
||||||
"angularCompilerOptions": {
|
|
||||||
"annotateForClosureCompiler": true,
|
|
||||||
"strictMetadataEmit": true,
|
|
||||||
"flatModuleOutFile": "index.js",
|
|
||||||
"flatModuleId": "@angular/core"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user