diff options
Diffstat (limited to 'rust/rust.go')
| -rw-r--r-- | rust/rust.go | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/rust/rust.go b/rust/rust.go index fb0be2a2a..9738b467f 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -74,6 +74,11 @@ type BaseProperties struct { VndkVersion string `blueprint:"mutated"` SubName string `blueprint:"mutated"` + // SubName is used by CC for tracking image variants / SDK versions. RustSubName is used for Rust-specific + // subnaming which shouldn't be visible to CC modules (such as the rlib stdlinkage subname). This should be + // appended before SubName. + RustSubName string `blueprint:"mutated"` + // Set by imageMutator CoreVariantNeeded bool `blueprint:"mutated"` VendorRamdiskVariantNeeded bool `blueprint:"mutated"` @@ -132,11 +137,6 @@ func (mod *Module) SetPreventInstall() { mod.Properties.PreventInstall = true } -// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor -func (mod *Module) InVendor() bool { - return mod.Properties.ImageVariationPrefix == cc.VendorVariationPrefix -} - func (mod *Module) SetHideFromMake() { mod.Properties.HideFromMake = true } @@ -232,7 +232,11 @@ func (mod *Module) UseVndk() bool { } func (mod *Module) MustUseVendorVariant() bool { - return false + return true +} + +func (mod *Module) SubName() string { + return mod.Properties.SubName } func (mod *Module) IsVndk() bool { @@ -256,6 +260,22 @@ func (c *Module) IsLlndkPublic() bool { return false } +func (m *Module) IsLlndkHeaders() bool { + return false +} + +func (m *Module) IsLlndkLibrary() bool { + return false +} + +func (mod *Module) KernelHeadersDecorator() bool { + return false +} + +func (m *Module) HasLlndkStubs() bool { + return false +} + func (mod *Module) SdkVersion() string { return "" } @@ -844,8 +864,10 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { ctx.VisitDirectDeps(func(dep android.Module) { depName := ctx.OtherModuleName(dep) depTag := ctx.OtherModuleDependencyTag(dep) + if rustDep, ok := dep.(*Module); ok && !rustDep.CcLibraryInterface() { //Handle Rust Modules + makeLibName := cc.MakeLibName(ctx, mod, rustDep, depName+rustDep.Properties.RustSubName) switch depTag { case dylibDepTag: @@ -855,19 +877,19 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { return } directDylibDeps = append(directDylibDeps, rustDep) - mod.Properties.AndroidMkDylibs = append(mod.Properties.AndroidMkDylibs, depName) + mod.Properties.AndroidMkDylibs = append(mod.Properties.AndroidMkDylibs, makeLibName) case rlibDepTag: rlib, ok := rustDep.compiler.(libraryInterface) if !ok || !rlib.rlib() { - ctx.ModuleErrorf("mod %q not an rlib library", depName+rustDep.Properties.SubName) + ctx.ModuleErrorf("mod %q not an rlib library", makeLibName) return } directRlibDeps = append(directRlibDeps, rustDep) - mod.Properties.AndroidMkRlibs = append(mod.Properties.AndroidMkRlibs, depName+rustDep.Properties.SubName) + mod.Properties.AndroidMkRlibs = append(mod.Properties.AndroidMkRlibs, makeLibName) case procMacroDepTag: directProcMacroDeps = append(directProcMacroDeps, rustDep) - mod.Properties.AndroidMkProcMacroLibs = append(mod.Properties.AndroidMkProcMacroLibs, depName) + mod.Properties.AndroidMkProcMacroLibs = append(mod.Properties.AndroidMkProcMacroLibs, makeLibName) case android.SourceDepTag: // Since these deps are added in path_properties.go via AddDependencies, we need to ensure the correct // OS/Arch variant is used. @@ -911,6 +933,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { } else if ccDep, ok := dep.(cc.LinkableInterface); ok { //Handle C dependencies + makeLibName := cc.MakeLibName(ctx, mod, ccDep, depName) if _, ok := ccDep.(*Module); !ok { if ccDep.Module().Target().Os != ctx.Os() { ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName) @@ -952,7 +975,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...) depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...) directStaticLibDeps = append(directStaticLibDeps, ccDep) - mod.Properties.AndroidMkStaticLibs = append(mod.Properties.AndroidMkStaticLibs, depName) + mod.Properties.AndroidMkStaticLibs = append(mod.Properties.AndroidMkStaticLibs, makeLibName) case cc.IsSharedDepTag(depTag): depPaths.linkDirs = append(depPaths.linkDirs, linkPath) depPaths.linkObjects = append(depPaths.linkObjects, linkObject.String()) @@ -962,7 +985,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...) depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...) directSharedLibDeps = append(directSharedLibDeps, ccDep) - mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, depName) + mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, makeLibName) exportDep = true case cc.IsHeaderDepTag(depTag): exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo) |