-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test showcasing issue with directory inputs
- Loading branch information
1 parent
e74047f
commit ff2e239
Showing
4 changed files
with
45 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,18 @@ | ||
load("//tests/ios/directory-input:sources_gen_to_dir.bzl", "sources_gen_to_dir") | ||
load("//rules:framework.bzl", "apple_framework") | ||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") | ||
|
||
sources_gen_to_dir( | ||
name = "gen_sources.swift", | ||
output_dir = "gen_sources", | ||
) | ||
|
||
swift_library( | ||
name = "LibraryFromGeneratedDirectory", | ||
srcs = [":gen_sources.swift"], | ||
) | ||
|
||
apple_framework( | ||
name = "FrameworkFromGeneratedDirectory", | ||
srcs = [":gen_sources.swift"], | ||
) |
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 @@ | ||
let bar = "bar" |
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 @@ | ||
let foo = "foo" |
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,25 @@ | ||
"""Example rule which uses `declare_directory` to declare a directory output fake Swift sources.""" | ||
|
||
def _sources_gen_to_dir_impl(ctx): | ||
directory = ctx.actions.declare_directory(ctx.attr.output_dir) | ||
args = ctx.actions.args() | ||
args.add(directory.path) | ||
|
||
ctx.actions.run_shell( | ||
arguments = [args], | ||
command = """mkdir -p "$1" && echo 'let foo = "foo"' > $1/foo.swift && echo 'let bar = "bar"' > $1/baz.swift""", | ||
inputs = [], | ||
outputs = [directory], | ||
) | ||
|
||
return [ | ||
DefaultInfo(files = depset([directory])), | ||
] | ||
|
||
|
||
sources_gen_to_dir = rule( | ||
implementation = _sources_gen_to_dir_impl, | ||
attrs = { | ||
"output_dir": attr.string(), | ||
}, | ||
) |