summaryrefslogtreecommitdiff
path: root/genrule/Android.bp
blob: 49df4807557ff134282e1cf38126589430a5c9d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

bootstrap_go_package {
    name: "soong-genrule",
    pkgPath: "android/soong/genrule",
    deps: [
        "blueprint",
        "blueprint-pathtools",
        "sbox_proto",
        "soong",
        "soong-android",
        "soong-shared",
    ],
    srcs: [
        "allowlists.go",
        "genrule.go",
        "locations.go",
    ],
    testSrcs: [
        "genrule_test.go",
    ],
    pluginFor: ["soong_build"],
    // Used by plugins
    visibility: ["//visibility:public"],
}

genrule {
    name: "nsjail_genrule_test_input",
    cmd: "echo nsjail_genrule_test_input > $(out)",
    out: ["nsjail_genrule_test_input.txt"],
}

// Pseudo-test that's run on checkbuilds to verify consistent directory
// structure for genrules using sbox or nsjail.
genrule_defaults {
    name: "nsjail_genrule_test_gen_defaults",
    // verify both relative paths and its contents
    cmd: "(echo $(out) $(genDir) && sha256sum " +
        "$(location get_clang_version) " +
        "$(location py3-cmd) " +
        "$(location genrule.go) " +
        "$(location :nsjail_genrule_test_input) " +
        "$(locations *.go)) | sed 's@\\./@@g' > $(out)",
    tools: [
        "get_clang_version", // random tool
        "py3-cmd", // random prebuilt tool
    ],
    tool_files: ["genrule.go"], // random local file
    srcs: [
        ":nsjail_genrule_test_input", // random OutputFileProducer
        "*.go", // random glob
    ],
    out: ["nsjail_genrule_test.txt"],
}

genrule {
    name: "nsjail_genrule_test_gen_without_nsjail",
    defaults: ["nsjail_genrule_test_gen_defaults"],
}

genrule {
    name: "nsjail_genrule_test_gen_with_nsjail",
    defaults: ["nsjail_genrule_test_gen_defaults"],
    use_nsjail: true,
}

genrule {
    name: "nsjail_genrule_test",
    srcs: [
        ":nsjail_genrule_test_gen_without_nsjail",
        ":nsjail_genrule_test_gen_with_nsjail",
    ],
    cmd: "diff $(in) > $(out)",
    out: ["nsjail_genrule_test"],
}