Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7de1073 authored by Ivan Lozano's avatar Ivan Lozano Committed by Jorge Moreira Broche
Browse files

rust: Remove libtest from stdlibs list

libtest does not need to be linked for every module type, so remove it
from the stdlibs list. Instead, link it only when building benchmarks or
tests.

Bug: 193782599
Test: cd external/rust/crates/; mma
Test: Rust tests still run correctly.
Merged-In: I536be8754da0987e09340744d9ebf668b8e734d0
Change-Id: I536be8754da0987e09340744d9ebf668b8e734d0
parent 9db406c8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ func (benchmark *benchmarkDecorator) compilerFlags(ctx ModuleContext, flags Flag
func (benchmark *benchmarkDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
	deps = benchmark.binaryDecorator.compilerDeps(ctx, deps)

	deps.Rustlibs = append(deps.Rustlibs, "libtest")
	deps.Rustlibs = append(deps.Rustlibs, "libcriterion")

	return deps
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ var (
	DefaultEdition     = "2018"
	Stdlibs            = []string{
		"libstd",
		"libtest",
	}

	// Mapping between Soong internal arch types and std::env constants.
+8 −0
Original line number Diff line number Diff line
@@ -169,3 +169,11 @@ func RustTestHostFactory() android.Module {
func (test *testDecorator) stdLinkage(ctx *depsContext) RustLinkage {
	return RlibLinkage
}

func (test *testDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
	deps = test.binaryDecorator.compilerDeps(ctx, deps)

	deps.Rustlibs = append(deps.Rustlibs, "libtest")

	return deps
}
+0 −2
Original line number Diff line number Diff line
@@ -162,12 +162,10 @@ func GatherRequiredDepsForTest() string {
			name: "libtest",
			crate_name: "test",
			srcs: ["foo.rs"],
			no_stdlibs: true,
			host_supported: true,
			vendor_available: true,
			vendor_ramdisk_available: true,
			native_coverage: false,
			sysroot: true,
			apex_available: ["//apex_available:platform", "//apex_available:anyapex"],
			min_sdk_version: "29",
		}