diff options
author | 2021-03-25 18:33:16 -0700 | |
---|---|---|
committer | 2021-03-25 22:21:23 -0700 | |
commit | bc1399271117e056fa5bbe72fba63fa7e500f123 (patch) | |
tree | 437bcccd369d4d547596e56a190f77afb59a8951 /java/droidstubs_test.go | |
parent | 6aa5c40393d03ca697d41f15d2051f03a37ee6cb (diff) |
Support sandboxing droiddoc and droidstubs with args properties
args properties can access arbitrary files with $(location) expansions,
so they need to pass them through RuleBuilderCommand.PathsForInputs
to produce a path inside the sandbox. Extract the arg expansion out
of collectDeps into a new expandArgs method that takes the
RuleBuilderCommand.
Test: TestDroidstubsSandbox
Change-Id: I9022d17bf3cb64c97b2008c4c1b733bf48edca95
Diffstat (limited to 'java/droidstubs_test.go')
-rw-r--r-- | java/droidstubs_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go index c6db97901..6ad932329 100644 --- a/java/droidstubs_test.go +++ b/java/droidstubs_test.go @@ -81,10 +81,19 @@ func TestDroidstubs(t *testing.T) { func TestDroidstubsSandbox(t *testing.T) { ctx, _ := testJavaWithFS(t, ` + genrule { + name: "foo", + out: ["foo.txt"], + cmd: "touch $(out)", + } + droidstubs { name: "bar-stubs", srcs: ["bar-doc/a.java"], sandbox: true, + + args: "--reference $(location :foo)", + arg_files: [":foo"], } `, map[string][]byte{ @@ -96,6 +105,11 @@ func TestDroidstubsSandbox(t *testing.T) { if g, w := metalava.Inputs.Strings(), []string{"bar-doc/a.java"}; !reflect.DeepEqual(w, g) { t.Errorf("Expected inputs %q, got %q", w, g) } + + manifest := android.RuleBuilderSboxProtoForTests(t, m.Output("metalava.sbox.textproto")) + if g, w := manifest.Commands[0].GetCommand(), "reference __SBOX_SANDBOX_DIR__/out/.intermediates/foo/gen/foo.txt"; !strings.Contains(g, w) { + t.Errorf("Expected command to contain %q, got %q", w, g) + } } func TestDroidstubsWithSystemModules(t *testing.T) { |