Pass "--extern proc_macro" to rust_proc_macros.

This is actually required for some code.

Test: Modify the new test so it fails and see it fail.
Test: Build crates that fail without it.
Change-Id: I527752b765e5552aa2de7e201f056955e053e1f3
This commit is contained in:
Joel Galenson
2021-09-23 08:26:53 -07:00
parent 5ff942285c
commit ce7bbdc38a
3 changed files with 43 additions and 0 deletions

View File

@@ -63,6 +63,12 @@ func (procMacro *procMacroDecorator) compilerProps() []interface{} {
&procMacro.Properties)
}
func (procMacro *procMacroDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags {
flags = procMacro.baseCompiler.compilerFlags(ctx, flags)
flags.RustFlags = append(flags.RustFlags, "--extern proc_macro")
return flags
}
func (procMacro *procMacroDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path {
fileName := procMacro.getStem(ctx) + ctx.toolchain().ProcMacroSuffix()
outputFile := android.PathForModuleOut(ctx, fileName)