Make BuildLinkerConfig run in its own action
We should probably do this change for more parts of the filesystem
RuleBuilder. Moving the linker config action out of the filesystem
rulebuilder allows it to run in parallel with opther actions, and not
rerun every time the filesystem is rebuilt.
Bug: 384091387
Test: Presubmits
Change-Id: Ic7305c555260fb5d9900c6c709b6c81dc0708d2b
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 2dcb23d..33cddf8 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -16,7 +16,6 @@
import (
"os"
- "strings"
"testing"
"android/soong/android"
@@ -181,11 +180,9 @@
`)
module := result.ModuleForTests("myfilesystem", "android_common")
- output := module.Output("out/soong/.intermediates/myfilesystem/android_common/myfilesystem/system/etc/linker.config.pb")
+ output := module.Output("out/soong/.intermediates/myfilesystem/android_common/linker.config.pb")
- fullCommand := output.RuleParams.Command
- startIndex := strings.Index(fullCommand, "conv_linker_config")
- linkerConfigCommand := fullCommand[startIndex:]
+ linkerConfigCommand := output.RuleParams.Command
android.AssertStringDoesContain(t, "linker.config.pb should have libfoo",
linkerConfigCommand, "libfoo.so")
@@ -735,7 +732,7 @@
}
`)
- linkerConfigCmd := result.ModuleForTests("myfilesystem", "android_common").Rule("build_filesystem_image").RuleParams.Command
+ linkerConfigCmd := result.ModuleForTests("myfilesystem", "android_common").Output("out/soong/.intermediates/myfilesystem/android_common/linker.config.pb").RuleParams.Command
android.AssertStringDoesContain(t, "Could not find linker.config.json file in cmd", linkerConfigCmd, "conv_linker_config proto --force -s linker.config.json")
android.AssertStringDoesContain(t, "Could not find stub in `provideLibs`", linkerConfigCmd, "--key provideLibs --value libfoo_has_stubs.so")
}