Loading rust/androidmk.go +4 −2 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ func (mod *Module) AndroidMk() android.AndroidMkData { ret := android.AndroidMkData{ OutputFile: mod.outputFile, Include: "$(BUILD_SYSTEM)/soong_rust_prebuilt.mk", SubName: mod.subName, Extra: []android.AndroidMkExtraFunc{ func(w io.Writer, outputFile android.Path) { if len(mod.Properties.AndroidMkRlibs) > 0 { Loading @@ -76,9 +75,11 @@ func (mod *Module) AndroidMk() android.AndroidMkData { }, }, } if mod.compiler != nil { if mod.compiler != nil && !mod.compiler.Disabled() { mod.subAndroidMk(&ret, mod.compiler) } else if mod.sourceProvider != nil { // If the compiler is disabled, this is a SourceProvider. mod.subAndroidMk(&ret, mod.sourceProvider) } ret.SubName += mod.Properties.SubName Loading Loading @@ -162,6 +163,7 @@ func (sourceProvider *baseSourceProvider) AndroidMk(ctx AndroidMkContext, ret *a outFile := sourceProvider.outputFile ret.Class = "ETC" ret.OutputFile = android.OptionalPathForPath(outFile) ret.SubName += sourceProvider.subName ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { _, file := filepath.Split(outFile.String()) stem, suffix, _ := android.SplitFileExt(file) Loading rust/bindgen.go +8 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ type BindgenProperties struct { Wrapper_src *string `android:"path,arch_variant"` // list of bindgen-specific flags and options Flags []string `android:"arch_variant"` Bindgen_flags []string `android:"arch_variant"` // list of clang flags required to correctly interpret the headers. Cflags []string `android:"arch_variant"` Loading Loading @@ -121,7 +121,7 @@ func (b *bindgenDecorator) generateSource(ctx android.ModuleContext, deps PathDe } bindgenFlags := defaultBindgenFlags bindgenFlags = append(bindgenFlags, strings.Join(b.Properties.Flags, " ")) bindgenFlags = append(bindgenFlags, strings.Join(b.Properties.Bindgen_flags, " ")) wrapperFile := android.OptionalPathForModuleSrc(ctx, b.Properties.Wrapper_src) if !wrapperFile.Valid() { Loading Loading @@ -170,7 +170,13 @@ func NewRustBindgen(hod android.HostOrDeviceSupported) (*Module, *bindgenDecorat baseSourceProvider: NewSourceProvider(), Properties: BindgenProperties{}, } _, library := NewRustLibrary(hod) library.BuildOnlyRust() library.sourceProvider = bindgen module.sourceProvider = bindgen module.compiler = library return module, bindgen } Loading rust/bindgen_test.go +4 −3 Original line number Diff line number Diff line Loading @@ -24,8 +24,10 @@ func TestRustBindgen(t *testing.T) { rust_bindgen { name: "libbindgen", wrapper_src: "src/any.h", stem: "bindings", flags: ["--bindgen-flag"], crate_name: "bindgen", stem: "libbindgen", source_stem: "bindings", bindgen_flags: ["--bindgen-flag"], cflags: ["--clang-flag"], shared_libs: ["libfoo_shared"], static_libs: ["libfoo_static"], Loading @@ -38,7 +40,6 @@ func TestRustBindgen(t *testing.T) { name: "libfoo_static", export_include_dirs: ["static_include"], } `) libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a").Output("bindings.rs") if !strings.Contains(libbindgen.Args["flags"], "--bindgen-flag") { Loading rust/builder_test.go +4 −2 Original line number Diff line number Diff line Loading @@ -28,12 +28,14 @@ func TestSourceProviderCollision(t *testing.T) { } rust_bindgen { name: "libbindings1", stem: "bindings", source_stem: "bindings", crate_name: "bindings1", wrapper_src: "src/any.h", } rust_bindgen { name: "libbindings2", stem: "bindings", source_stem: "bindings", crate_name: "bindings2", wrapper_src: "src/any.h", } `) Loading rust/compiler.go +12 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,10 @@ type BaseCompilerProperties struct { // list of C static library dependencies Static_libs []string `android:"arch_variant"` // crate name, required for libraries. This must be the expected extern crate name used in source // crate name, required for modules which produce Rust libraries: rust_library, rust_ffi and SourceProvider // modules which create library variants (rust_bindgen). This must be the expected extern crate name used in // source, and is required to conform to an enforced format matching library output files (if the output file is // lib<someName><suffix>, the crate_name property must be <someName>). Crate_name string `android:"arch_variant"` // list of features to enable for this crate Loading Loading @@ -120,6 +123,14 @@ type baseCompiler struct { distFile android.OptionalPath } func (compiler *baseCompiler) Disabled() bool { return false } func (compiler *baseCompiler) SetDisabled() { panic("baseCompiler does not implement SetDisabled()") } func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath { panic("baseCompiler does not implement coverageOutputZipPath()") } Loading Loading
rust/androidmk.go +4 −2 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ func (mod *Module) AndroidMk() android.AndroidMkData { ret := android.AndroidMkData{ OutputFile: mod.outputFile, Include: "$(BUILD_SYSTEM)/soong_rust_prebuilt.mk", SubName: mod.subName, Extra: []android.AndroidMkExtraFunc{ func(w io.Writer, outputFile android.Path) { if len(mod.Properties.AndroidMkRlibs) > 0 { Loading @@ -76,9 +75,11 @@ func (mod *Module) AndroidMk() android.AndroidMkData { }, }, } if mod.compiler != nil { if mod.compiler != nil && !mod.compiler.Disabled() { mod.subAndroidMk(&ret, mod.compiler) } else if mod.sourceProvider != nil { // If the compiler is disabled, this is a SourceProvider. mod.subAndroidMk(&ret, mod.sourceProvider) } ret.SubName += mod.Properties.SubName Loading Loading @@ -162,6 +163,7 @@ func (sourceProvider *baseSourceProvider) AndroidMk(ctx AndroidMkContext, ret *a outFile := sourceProvider.outputFile ret.Class = "ETC" ret.OutputFile = android.OptionalPathForPath(outFile) ret.SubName += sourceProvider.subName ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { _, file := filepath.Split(outFile.String()) stem, suffix, _ := android.SplitFileExt(file) Loading
rust/bindgen.go +8 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ type BindgenProperties struct { Wrapper_src *string `android:"path,arch_variant"` // list of bindgen-specific flags and options Flags []string `android:"arch_variant"` Bindgen_flags []string `android:"arch_variant"` // list of clang flags required to correctly interpret the headers. Cflags []string `android:"arch_variant"` Loading Loading @@ -121,7 +121,7 @@ func (b *bindgenDecorator) generateSource(ctx android.ModuleContext, deps PathDe } bindgenFlags := defaultBindgenFlags bindgenFlags = append(bindgenFlags, strings.Join(b.Properties.Flags, " ")) bindgenFlags = append(bindgenFlags, strings.Join(b.Properties.Bindgen_flags, " ")) wrapperFile := android.OptionalPathForModuleSrc(ctx, b.Properties.Wrapper_src) if !wrapperFile.Valid() { Loading Loading @@ -170,7 +170,13 @@ func NewRustBindgen(hod android.HostOrDeviceSupported) (*Module, *bindgenDecorat baseSourceProvider: NewSourceProvider(), Properties: BindgenProperties{}, } _, library := NewRustLibrary(hod) library.BuildOnlyRust() library.sourceProvider = bindgen module.sourceProvider = bindgen module.compiler = library return module, bindgen } Loading
rust/bindgen_test.go +4 −3 Original line number Diff line number Diff line Loading @@ -24,8 +24,10 @@ func TestRustBindgen(t *testing.T) { rust_bindgen { name: "libbindgen", wrapper_src: "src/any.h", stem: "bindings", flags: ["--bindgen-flag"], crate_name: "bindgen", stem: "libbindgen", source_stem: "bindings", bindgen_flags: ["--bindgen-flag"], cflags: ["--clang-flag"], shared_libs: ["libfoo_shared"], static_libs: ["libfoo_static"], Loading @@ -38,7 +40,6 @@ func TestRustBindgen(t *testing.T) { name: "libfoo_static", export_include_dirs: ["static_include"], } `) libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a").Output("bindings.rs") if !strings.Contains(libbindgen.Args["flags"], "--bindgen-flag") { Loading
rust/builder_test.go +4 −2 Original line number Diff line number Diff line Loading @@ -28,12 +28,14 @@ func TestSourceProviderCollision(t *testing.T) { } rust_bindgen { name: "libbindings1", stem: "bindings", source_stem: "bindings", crate_name: "bindings1", wrapper_src: "src/any.h", } rust_bindgen { name: "libbindings2", stem: "bindings", source_stem: "bindings", crate_name: "bindings2", wrapper_src: "src/any.h", } `) Loading
rust/compiler.go +12 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,10 @@ type BaseCompilerProperties struct { // list of C static library dependencies Static_libs []string `android:"arch_variant"` // crate name, required for libraries. This must be the expected extern crate name used in source // crate name, required for modules which produce Rust libraries: rust_library, rust_ffi and SourceProvider // modules which create library variants (rust_bindgen). This must be the expected extern crate name used in // source, and is required to conform to an enforced format matching library output files (if the output file is // lib<someName><suffix>, the crate_name property must be <someName>). Crate_name string `android:"arch_variant"` // list of features to enable for this crate Loading Loading @@ -120,6 +123,14 @@ type baseCompiler struct { distFile android.OptionalPath } func (compiler *baseCompiler) Disabled() bool { return false } func (compiler *baseCompiler) SetDisabled() { panic("baseCompiler does not implement SetDisabled()") } func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath { panic("baseCompiler does not implement coverageOutputZipPath()") } Loading