| 
									
										
										
										
											2019-04-19 08:37:01 +02:00
										 |  |  | # BEGIN-INTERNAL | 
					
						
							| 
									
										
										
										
											2019-12-28 16:37:59 -08:00
										 |  |  | load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm") | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  | load("@npm_bazel_typescript//:index.bzl", "ts_library") | 
					
						
							| 
									
										
										
										
											2020-01-08 01:30:07 -08:00
										 |  |  | load("//tools:defaults.bzl", "jasmine_node_test") | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ts_library( | 
					
						
							|  |  |  |     name = "lib", | 
					
						
							|  |  |  |     srcs = glob(["lib/*.ts"]), | 
					
						
							|  |  |  |     module_name = "ts-api-guardian", | 
					
						
							|  |  |  |     tsconfig = "//tools:tsconfig.json", | 
					
						
							|  |  |  |     visibility = ["//visibility:public"], | 
					
						
							| 
									
										
										
										
											2018-10-18 09:58:38 -07:00
										 |  |  |     deps = [ | 
					
						
							| 
									
										
										
										
											2019-04-09 18:08:13 -07:00
										 |  |  |         "@npm//@types/diff", | 
					
						
							|  |  |  |         "@npm//@types/minimist", | 
					
						
							|  |  |  |         "@npm//@types/node", | 
					
						
							| 
									
										
										
										
											2019-04-23 14:47:18 +02:00
										 |  |  |         "@npm//chalk", | 
					
						
							| 
									
										
										
										
											2019-04-09 18:08:13 -07:00
										 |  |  |         "@npm//diff", | 
					
						
							|  |  |  |         "@npm//minimist", | 
					
						
							|  |  |  |         "@npm//typescript", | 
					
						
							| 
									
										
										
										
											2018-10-18 09:58:38 -07:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Copy Angular's license to govern ts-api-guardian as well. | 
					
						
							|  |  |  | # We use a genrule to put it in this package, so it will be in the right root directory. | 
					
						
							|  |  |  | genrule( | 
					
						
							|  |  |  |     name = "license", | 
					
						
							|  |  |  |     srcs = ["//:LICENSE"], | 
					
						
							|  |  |  |     outs = ["LICENSE"], | 
					
						
							|  |  |  |     cmd = "cp $< $@", | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-28 16:37:59 -08:00
										 |  |  | pkg_npm( | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  |     name = "ts-api-guardian", | 
					
						
							|  |  |  |     srcs = [ | 
					
						
							| 
									
										
										
										
											2019-04-19 08:37:01 +02:00
										 |  |  |         "BUILD.bazel", | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  |         "README.md", | 
					
						
							|  |  |  |         "bin/ts-api-guardian", | 
					
						
							| 
									
										
										
										
											2019-04-19 08:37:01 +02:00
										 |  |  |         "index.bzl", | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  |         "package.json", | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2019-12-28 16:37:59 -08:00
										 |  |  |     substitutions = { | 
					
						
							| 
									
										
										
										
											2019-04-23 14:47:18 +02:00
										 |  |  |         "@angular//tools/ts-api-guardian:bin": "@npm_ts_api_guardian//:bin", | 
					
						
							|  |  |  |         "@angular//tools/ts-api-guardian:lib": "@npm//ts-api-guardian", | 
					
						
							| 
									
										
										
										
											2019-04-19 08:37:01 +02:00
										 |  |  |         "angular/tools/ts-api-guardian/": "npm_ts_api_guardian/", | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  |     deps = [ | 
					
						
							|  |  |  |         ":lib", | 
					
						
							|  |  |  |         ":license", | 
					
						
							|  |  |  |     ], | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #######################################3 | 
					
						
							|  |  |  | # Tests for this package | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ts_library( | 
					
						
							|  |  |  |     name = "test_lib", | 
					
						
							|  |  |  |     testonly = True, | 
					
						
							| 
									
										
										
										
											2019-12-28 18:14:36 -08:00
										 |  |  |     srcs = glob( | 
					
						
							|  |  |  |         ["test/*.ts"], | 
					
						
							|  |  |  |         exclude = ["test/bootstrap.ts"], | 
					
						
							|  |  |  |     ), | 
					
						
							| 
									
										
										
										
											2018-10-04 13:14:14 -07:00
										 |  |  |     tsconfig = "//tools:tsconfig-test", | 
					
						
							|  |  |  |     deps = [ | 
					
						
							|  |  |  |         ":lib", | 
					
						
							| 
									
										
										
										
											2019-04-09 18:08:13 -07:00
										 |  |  |         "@npm//@types/chai", | 
					
						
							|  |  |  |         "@npm//@types/jasmine", | 
					
						
							|  |  |  |         "@npm//@types/node", | 
					
						
							|  |  |  |         "@npm//chai", | 
					
						
							|  |  |  |         "@npm//jasmine", | 
					
						
							|  |  |  |         "@npm//typescript", | 
					
						
							| 
									
										
										
										
											2018-10-04 13:14:14 -07:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-28 18:14:36 -08:00
										 |  |  | ts_library( | 
					
						
							|  |  |  |     name = "bootstrap", | 
					
						
							|  |  |  |     testonly = True, | 
					
						
							|  |  |  |     srcs = ["test/bootstrap.ts"], | 
					
						
							|  |  |  |     tsconfig = "//tools:tsconfig-test", | 
					
						
							|  |  |  |     deps = ["@npm//@types/node"], | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Select the es5 .js output of the ts_library :boostrap target | 
					
						
							|  |  |  | # with `output_group = "es5_sources"` for use in the jasmine_node_test | 
					
						
							|  |  |  | # below. This exposes an internal detail of ts_library that is not ideal. | 
					
						
							|  |  |  | # TODO(gregmagolan): clean this up by using tsc() in this case rather than ts_library | 
					
						
							|  |  |  | filegroup( | 
					
						
							|  |  |  |     name = "bootstrap_es5", | 
					
						
							|  |  |  |     testonly = True, | 
					
						
							|  |  |  |     srcs = [":bootstrap"], | 
					
						
							|  |  |  |     output_group = "es5_sources", | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  | jasmine_node_test( | 
					
						
							|  |  |  |     name = "tests", | 
					
						
							| 
									
										
										
										
											2019-12-28 18:14:36 -08:00
										 |  |  |     srcs = [ | 
					
						
							|  |  |  |         ":test_lib", | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2020-01-08 01:30:07 -08:00
										 |  |  |     bootstrap = [":bootstrap_es5"], | 
					
						
							| 
									
										
										
										
											2018-03-01 10:41:35 -08:00
										 |  |  |     data = glob([ | 
					
						
							|  |  |  |         "test/fixtures/*.ts", | 
					
						
							|  |  |  |         "test/fixtures/*.patch", | 
					
						
							|  |  |  |     ]) + [ | 
					
						
							|  |  |  |         ":ts-api-guardian", | 
					
						
							|  |  |  |     ], | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2019-04-19 08:37:01 +02:00
										 |  |  | # END-INTERNAL | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-23 19:12:00 +02:00
										 |  |  | filegroup( | 
					
						
							|  |  |  |     name = "bin", | 
					
						
							|  |  |  |     srcs = glob(["lib/*.js"]) + ["bin/ts-api-guardian"], | 
					
						
							| 
									
										
										
										
											2019-04-19 08:37:01 +02:00
										 |  |  |     visibility = ["//visibility:public"], | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2019-06-07 13:38:06 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Exported to be referenced as entry_point of the nodejs_binary | 
					
						
							|  |  |  | exports_files(["bin/ts-api-guardian"]) |