generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle various ts_project srcs labels syntaxes
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,51 @@ | ||
"""Shows different ways to pass source files into ts_project""" | ||
|
||
load("@aspect_rules_ts//ts:defs.bzl", "ts_project") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
|
||
[ | ||
write_file( | ||
name = "gen-%s-ts" % n, | ||
out = "%s.ts" % n, | ||
content = [ | ||
"export const %s = 42" % n, | ||
], | ||
) | ||
for n in [ | ||
"a", | ||
"b", | ||
"c", | ||
"d", | ||
"e", | ||
] | ||
] | ||
|
||
# Various ways of declaring sources | ||
ts_project( | ||
name = "out-refs", | ||
srcs = [ | ||
# Labels of various syntaxes to files | ||
"a.ts", | ||
":b.ts", | ||
"//%s:c.ts" % package_name(), | ||
"@//%s:d.ts" % package_name(), | ||
"@aspect_rules_ts//%s:e.ts" % package_name(), | ||
|
||
# Label to some rules | ||
":gen-a-ts", | ||
], | ||
out_dir = "out", | ||
) | ||
|
||
build_test( | ||
name = "test", | ||
targets = [ | ||
"out-refs", | ||
"out/a.js", | ||
"out/b.js", | ||
"out/c.js", | ||
"out/d.js", | ||
"out/e.js", | ||
], | ||
) |
This file contains 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 @@ | ||
{} |
This file contains 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