diff options
Diffstat (limited to 'rust/rust.go')
| -rw-r--r-- | rust/rust.go | 52 |
1 files changed, 6 insertions, 46 deletions
diff --git a/rust/rust.go b/rust/rust.go index d4d33c71d..02ec22d7e 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -18,14 +18,12 @@ import ( "fmt" "strings" - "android/soong/bazel" "android/soong/bloaty" "android/soong/testing" - "android/soong/ui/metrics/bp2build_metrics_proto" - "github.com/google/blueprint" "github.com/google/blueprint/proptools" + "android/soong/aconfig" "android/soong/android" "android/soong/cc" cc_config "android/soong/cc/config" @@ -175,7 +173,8 @@ type Module struct { transitiveAndroidMkSharedLibs *android.DepSet[string] - android.BazelModuleBase + // Aconfig files for all transitive deps. Also exposed via TransitiveDeclarationsInfo + mergedAconfigFiles map[string]android.Paths } func (mod *Module) Header() bool { @@ -951,6 +950,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { sourceLib := sourceMod.(*Module).compiler.(*libraryDecorator) mod.sourceProvider.setOutputFiles(sourceLib.sourceProvider.Srcs()) } + ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: mod.sourceProvider.Srcs().Strings()}) } if mod.compiler != nil && !mod.compiler.Disabled() { @@ -1005,6 +1005,8 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { if mod.testModule { ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{}) } + + aconfig.CollectDependencyAconfigFiles(ctx, &mod.mergedAconfigFiles) } func (mod *Module) deps(ctx DepsContext) Deps { @@ -1849,48 +1851,6 @@ func (c *Module) Partition() string { return "" } -func (m *Module) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) { - if ctx.ModuleType() == "rust_library_host" || ctx.ModuleType() == "rust_library" { - libraryBp2build(ctx, m) - } else if ctx.ModuleType() == "rust_proc_macro" { - procMacroBp2build(ctx, m) - } else if ctx.ModuleType() == "rust_binary_host" { - binaryBp2build(ctx, m) - } else if ctx.ModuleType() == "rust_protobuf_host" || ctx.ModuleType() == "rust_protobuf" { - protoLibraryBp2build(ctx, m) - } else if ctx.ModuleType() == "rust_ffi_static" { - ffiStaticBp2build(ctx, m) - } else { - ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "") - } -} - -// This is a workaround by assuming the conventions that rust crate repos are structured -// while waiting for the sandboxing work to complete. -// TODO(b/297344471): When crate_root prop is set which enforces inputs sandboxing, -// always use `srcs` and `compile_data` props to generate `srcs` and `compile_data` attributes -// instead of using globs. -func srcsAndCompileDataAttrs(ctx android.Bp2buildMutatorContext, c baseCompiler) (bazel.LabelList, bazel.LabelList) { - var srcs bazel.LabelList - var compileData bazel.LabelList - - if c.Properties.Srcs[0] == "src/lib.rs" { - srcs = android.BazelLabelForModuleSrc(ctx, []string{"src/**/*.rs"}) - compileData = android.BazelLabelForModuleSrc( - ctx, - []string{ - "src/**/*.proto", - "examples/**/*.rs", - "**/*.md", - }, - ) - } else { - srcs = android.BazelLabelForModuleSrc(ctx, c.Properties.Srcs) - } - - return srcs, compileData -} - var Bool = proptools.Bool var BoolDefault = proptools.BoolDefault var String = proptools.String |