1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5// Soong expands $(genDir) to __SBOX_SANDBOX_DIR__/out
6// and $(out) to __SBOX_SANDBOX_DIR__/out/build/bazel/examples/gensrcs/data1.out
7// In mixed build, Bp2build converts $(genDir) to $(GENDIR)
8// which is expanded to ctx.var['GENDIR']
9gensrcs {
10    name: "examples.gensrcs.make_data1",
11    srcs: ["data1.txt"],
12    output_extension: "out",
13    cmd: "mkdir -p $(genDir)/out_dir " +
14        "&& touch $(genDir)/out_dir/data.text " +
15        "&& cat $(genDir)/out_dir/data.text > $(out)",
16}
17
18// Verify
19//  * Regardless of whether the action is generated by Soong or Bazel,
20//  * $(genDir)/build/bazel/examples/gensrcs/data/data2.out is equivalent to $(out) both Soong and Bazel
21//  * The output path (i.e. data/data2.txt) is nestedly intact with input path (i.e. data/data2.out)
22gensrcs {
23    name: "examples.gensrcs.make_data2",
24    srcs: ["data/data2.txt"],
25    output_extension: "out",
26    cmd: "cat $(in) > $(out) " +
27        "&& cat $(genDir)/build/bazel/examples/gensrcs/data/data2.out",
28}
29