Strip relative paths from java_import output files

androidx.annotation_annotation is used as a test data file, and
converting it from a java_library to a java_library_import causes
the relative path used in the test data path to change. Clear the
relative path in java_import the same way that other java based
modules do.

Bug: 288358614
Test: TestJavaLibraryOutputFileRel
Change-Id: I1f494110da32e916043ca94ac6ebeeafccc06f9a
This commit is contained in:
Colin Cross
2024-04-11 15:28:18 -07:00
parent 28ac2ffc80
commit 5e87f349b8
3 changed files with 57 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ package java
import (
"android/soong/android"
"reflect"
"slices"
"strings"
"testing"
)
@@ -84,7 +84,7 @@ func TestDeviceForHost(t *testing.T) {
deviceImportCombined.Output,
}
if !reflect.DeepEqual(combined.Inputs, expectedInputs) {
if !slices.Equal(combined.Inputs.Strings(), expectedInputs.Strings()) {
t.Errorf("expected host_module combined inputs:\n%q\ngot:\n%q",
expectedInputs, combined.Inputs)
}
@@ -95,7 +95,7 @@ func TestDeviceForHost(t *testing.T) {
deviceRes.Output,
}
if !reflect.DeepEqual(resCombined.Inputs, expectedInputs) {
if !slices.Equal(resCombined.Inputs.Strings(), expectedInputs.Strings()) {
t.Errorf("expected host_module res combined inputs:\n%q\ngot:\n%q",
expectedInputs, resCombined.Inputs)
}
@@ -165,7 +165,7 @@ func TestHostForDevice(t *testing.T) {
hostImportCombined.Output,
}
if !reflect.DeepEqual(combined.Inputs, expectedInputs) {
if !slices.Equal(combined.Inputs.Strings(), expectedInputs.Strings()) {
t.Errorf("expected device_module combined inputs:\n%q\ngot:\n%q",
expectedInputs, combined.Inputs)
}
@@ -176,7 +176,7 @@ func TestHostForDevice(t *testing.T) {
hostRes.Output,
}
if !reflect.DeepEqual(resCombined.Inputs, expectedInputs) {
if !slices.Equal(resCombined.Inputs.Strings(), expectedInputs.Strings()) {
t.Errorf("expected device_module res combined inputs:\n%q\ngot:\n%q",
expectedInputs, resCombined.Inputs)
}