Make syspropRustGenRule work with absolute paths

This rule should be able to work with OUT_DIR set as absolute path,
which is used in "development/tools/ndk/update_ndk_abi.sh".

The problem appears if sysprop file itself is generated and
"syspropFile.String()" returns an absolute path, which is not accepted
as path component for "PathForModuleGen".

The fix is to use "android.GenPathWithExt" like in "syspropJavaGenRule".

Fixes: 328506541
Test: TreeHugger
Test: development/tools/ndk/update_ndk_abi.sh
Change-Id: Ia1e9a0ad51ebd957be97c48f5e1cf0e06a0da0ee
This commit is contained in:
Aleksei Vetrov 2024-03-07 19:24:47 +00:00
parent b952c84841
commit f4775ca238

View file

@ -154,10 +154,10 @@ func (g *syspropRustGenRule) GenerateAndroidBuildActions(ctx android.ModuleConte
})
for _, syspropFile := range android.PathsForModuleSrc(ctx, g.properties.Srcs) {
syspropDir := strings.TrimSuffix(syspropFile.String(), syspropFile.Ext())
outputDir := android.PathForModuleGen(ctx, syspropDir, "src")
libPath := android.PathForModuleGen(ctx, syspropDir, "src", "lib.rs")
parsersPath := android.PathForModuleGen(ctx, syspropDir, "src", "gen_parsers_and_formatters.rs")
syspropDir := android.GenPathWithExt(ctx, "sysprop", syspropFile, "srcrust")
outputDir := syspropDir.Join(ctx, "src")
libPath := syspropDir.Join(ctx, "src", "lib.rs")
parsersPath := syspropDir.Join(ctx, "src", "gen_parsers_and_formatters.rs")
ctx.Build(pctx, android.BuildParams{
Rule: syspropRust,