diff options
author | Colin Cross <ccross@android.com> | 2018-10-15 16:18:06 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2018-10-18 23:54:38 +0000 |
commit | 4b964c00a6f114a85cf13ef825e72df25985f8e6 (patch) | |
tree | bf42766bf69b4ecc7cb40158b3403569bbb46bc8 /java/app.go | |
parent | 78e3cb096bc82bc5a92eb112faf6c0f5411431d2 (diff) | |
download | android_build_soong-4b964c00a6f114a85cf13ef825e72df25985f8e6.tar.gz android_build_soong-4b964c00a6f114a85cf13ef825e72df25985f8e6.tar.bz2 android_build_soong-4b964c00a6f114a85cf13ef825e72df25985f8e6.zip |
Fix instrumentation_for to match LOCAL_INSTRUMENTATION_FOR
The value from instrumentation_for should not go to
aapt2 link --rename-instrumentation-target-package, that should
be the equivalent of LOCAL_MANIFEST_INSTRUMENTATION_FOR. That
property is never used in Make, so it is left unimplemented in
Soong.
Add the module listed in instrumentation_for as a shared library
for javac, but don't import its resources.
Bug: 117804211
Test: m checkbuild
Change-Id: I7f035dc0ecb964a3ca391ae1ca2b87cb0f6a7cec
Diffstat (limited to 'java/app.go')
-rw-r--r-- | java/app.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/java/app.go b/java/app.go index d21b62ae..5d25dcf1 100644 --- a/java/app.go +++ b/java/app.go @@ -318,12 +318,6 @@ type AndroidTest struct { } func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { - if String(a.appTestProperties.Instrumentation_for) != "" { - a.AndroidApp.extraLinkFlags = append(a.AndroidApp.extraLinkFlags, - "--rename-instrumentation-target-package", - String(a.appTestProperties.Instrumentation_for)) - } - a.generateAndroidBuildActions(ctx) a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.testProperties.Test_config_template, a.manifestPath) @@ -335,6 +329,12 @@ func (a *AndroidTest) DepsMutator(ctx android.BottomUpMutatorContext) { android.ExtractSourceDeps(ctx, a.testProperties.Test_config_template) android.ExtractSourcesDeps(ctx, a.testProperties.Data) a.AndroidApp.DepsMutator(ctx) + if a.appTestProperties.Instrumentation_for != nil { + // The android_app dependency listed in instrumentation_for needs to be added to the classpath for javac, + // but not added to the aapt2 link includes like a normal android_app or android_library dependency, so + // use instrumentationForTag instead of libTag. + ctx.AddVariationDependencies(nil, instrumentationForTag, String(a.appTestProperties.Instrumentation_for)) + } } func AndroidTestFactory() android.Module { |