From bf19a9796547d6e98b861510bddd62a7babbe188 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 26 May 2020 13:21:35 +0100 Subject: [PATCH] java_sdk_library: Expose implementation within APEX Access to the implementation JARs is restricted to avoid code from depending on implementation details that could change from one release to the next which could cause compatibility issues. That is not a problem when referenced from within the APEX that contains the java_sdk_library. As references from within the same APEX often need to access implementation specific details of the java_sdk_library and doing that from within the same APEX is safe this change all references to a java_sdk_library made within the same APEX to use the implementation jars instead of stub jars. Bug: 155164730 Test: m droid Change-Id: If239059690de61683c2ad2d8a0ce2e47286a3637 (cherry picked from commit 9b879594ed092b23a3fedfdad2b02e799c3c5dd8) --- apex/apex_test.go | 111 ++++++++++++++++++++++++++++++++++++++++---- java/sdk_library.go | 21 ++++++++- 2 files changed, 123 insertions(+), 9 deletions(-) diff --git a/apex/apex_test.go b/apex/apex_test.go index ad46c3098..3979149c2 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -19,6 +19,7 @@ import ( "os" "path" "reflect" + "regexp" "sort" "strings" "testing" @@ -4020,6 +4021,15 @@ func TestLegacyAndroid10Support(t *testing.T) { } } +var filesForSdkLibrary = map[string][]byte{ + "api/current.txt": nil, + "api/removed.txt": nil, + "api/system-current.txt": nil, + "api/system-removed.txt": nil, + "api/test-current.txt": nil, + "api/test-removed.txt": nil, +} + func TestJavaSDKLibrary(t *testing.T) { ctx, _ := testApex(t, ` apex { @@ -4040,14 +4050,7 @@ func TestJavaSDKLibrary(t *testing.T) { api_packages: ["foo"], apex_available: [ "myapex" ], } - `, withFiles(map[string][]byte{ - "api/current.txt": nil, - "api/removed.txt": nil, - "api/system-current.txt": nil, - "api/system-removed.txt": nil, - "api/test-current.txt": nil, - "api/test-removed.txt": nil, - })) + `, withFiles(filesForSdkLibrary)) // java_sdk_library installs both impl jar and permission XML ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{ @@ -4059,6 +4062,98 @@ func TestJavaSDKLibrary(t *testing.T) { ensureContains(t, sdkLibrary.RuleParams.Command, `