Loading android/paths.go +4 −4 Original line number Diff line number Diff line Loading @@ -181,13 +181,13 @@ type errorfContext interface { var _ errorfContext = blueprint.SingletonContext(nil) // moduleErrorf is the interface containing the ModuleErrorf method matching // ModuleErrorfContext is the interface containing the ModuleErrorf method matching // the ModuleErrorf method in blueprint.ModuleContext. type moduleErrorf interface { type ModuleErrorfContext interface { ModuleErrorf(format string, args ...interface{}) } var _ moduleErrorf = blueprint.ModuleContext(nil) var _ ModuleErrorfContext = blueprint.ModuleContext(nil) // reportPathError will register an error with the attached context. It // attempts ctx.ModuleErrorf for a better error message first, then falls Loading @@ -200,7 +200,7 @@ func reportPathError(ctx PathContext, err error) { // attempts ctx.ModuleErrorf for a better error message first, then falls // back to ctx.Errorf. func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) { if mctx, ok := ctx.(moduleErrorf); ok { if mctx, ok := ctx.(ModuleErrorfContext); ok { mctx.ModuleErrorf(format, args...) } else if ectx, ok := ctx.(errorfContext); ok { ectx.Errorf(format, args...) Loading apex/apex.go +2 −2 Original line number Diff line number Diff line Loading @@ -1628,7 +1628,7 @@ func apexFileForCompatConfig(ctx android.BaseModuleContext, config java.Platform type javaModule interface { android.Module BaseModuleName() string DexJarBuildPath() java.OptionalDexJarPath DexJarBuildPath(ctx android.ModuleErrorfContext) java.OptionalDexJarPath JacocoReportClassesFile() android.Path LintDepSets() java.LintDepSets Stem() string Loading @@ -1642,7 +1642,7 @@ var _ javaModule = (*java.SdkLibraryImport)(nil) // apexFileForJavaModule creates an apexFile for a java module's dex implementation jar. func apexFileForJavaModule(ctx android.BaseModuleContext, module javaModule) apexFile { return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath().PathOrNil()) return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath(ctx).PathOrNil()) } // apexFileForJavaModuleWithFile creates an apexFile for a java module with the supplied file. Loading apex/apex_test.go +12 −3 Original line number Diff line number Diff line Loading @@ -5355,6 +5355,13 @@ func TestPrebuiltApexNameWithPlatformBootclasspath(t *testing.T) { ).RunTest(t) } // A minimal context object for use with DexJarBuildPath type moduleErrorfTestCtx struct { } func (ctx moduleErrorfTestCtx) ModuleErrorf(format string, args ...interface{}) { } // These tests verify that the prebuilt_apex/deapexer to java_import wiring allows for the // propagation of paths to dex implementation jars from the former to the latter. func TestPrebuiltExportDexImplementationJars(t *testing.T) { Loading @@ -5364,7 +5371,7 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) { t.Helper() // Make sure the import has been given the correct path to the dex jar. p := ctx.ModuleForTests(name, "android_common_myapex").Module().(java.UsesLibraryDependency) dexJarBuildPath := p.DexJarBuildPath().PathOrNil() dexJarBuildPath := p.DexJarBuildPath(moduleErrorfTestCtx{}).PathOrNil() stem := android.RemoveOptionalPrebuiltPrefix(name) android.AssertStringEquals(t, "DexJarBuildPath should be apex-related path.", ".intermediates/myapex.deapexer/android_common/deapexer/javalib/"+stem+".jar", Loading Loading @@ -8491,6 +8498,8 @@ func TestDuplicateButEquivalentDeapexersFromPrebuiltApexes(t *testing.T) { PrepareForTestWithApexBuildComponents, ) errCtx := moduleErrorfTestCtx{} bpBase := ` apex_set { name: "com.android.myapex", Loading Loading @@ -8540,7 +8549,7 @@ func TestDuplicateButEquivalentDeapexersFromPrebuiltApexes(t *testing.T) { usesLibraryDep := module.(java.UsesLibraryDependency) android.AssertPathRelativeToTopEquals(t, "dex jar path", "out/soong/.intermediates/com.android.myapex.deapexer/android_common/deapexer/javalib/libfoo.jar", usesLibraryDep.DexJarBuildPath().Path()) usesLibraryDep.DexJarBuildPath(errCtx).Path()) }) t.Run("java_sdk_library_import", func(t *testing.T) { Loading @@ -8563,7 +8572,7 @@ func TestDuplicateButEquivalentDeapexersFromPrebuiltApexes(t *testing.T) { usesLibraryDep := module.(java.UsesLibraryDependency) android.AssertPathRelativeToTopEquals(t, "dex jar path", "out/soong/.intermediates/com.android.myapex.deapexer/android_common/deapexer/javalib/libfoo.jar", usesLibraryDep.DexJarBuildPath().Path()) usesLibraryDep.DexJarBuildPath(errCtx).Path()) }) t.Run("prebuilt_bootclasspath_fragment", func(t *testing.T) { Loading apex/bootclasspath_fragment_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -677,7 +677,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { func getDexJarPath(result *android.TestResult, name string) string { module := result.Module(name, "android_common") return module.(java.UsesLibraryDependency).DexJarBuildPath().Path().RelativeToTop().String() return module.(java.UsesLibraryDependency).DexJarBuildPath(moduleErrorfTestCtx{}).Path().RelativeToTop().String() } // TestBootclasspathFragment_HiddenAPIList checks to make sure that the correct parameters are Loading java/aar.go +1 −1 Original line number Diff line number Diff line Loading @@ -1284,7 +1284,7 @@ func (a *AARImport) ImplementationAndResourcesJars() android.Paths { return android.Paths{a.classpathFile} } func (a *AARImport) DexJarBuildPath() android.Path { func (a *AARImport) DexJarBuildPath(ctx android.ModuleErrorfContext) android.Path { return nil } Loading Loading
android/paths.go +4 −4 Original line number Diff line number Diff line Loading @@ -181,13 +181,13 @@ type errorfContext interface { var _ errorfContext = blueprint.SingletonContext(nil) // moduleErrorf is the interface containing the ModuleErrorf method matching // ModuleErrorfContext is the interface containing the ModuleErrorf method matching // the ModuleErrorf method in blueprint.ModuleContext. type moduleErrorf interface { type ModuleErrorfContext interface { ModuleErrorf(format string, args ...interface{}) } var _ moduleErrorf = blueprint.ModuleContext(nil) var _ ModuleErrorfContext = blueprint.ModuleContext(nil) // reportPathError will register an error with the attached context. It // attempts ctx.ModuleErrorf for a better error message first, then falls Loading @@ -200,7 +200,7 @@ func reportPathError(ctx PathContext, err error) { // attempts ctx.ModuleErrorf for a better error message first, then falls // back to ctx.Errorf. func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) { if mctx, ok := ctx.(moduleErrorf); ok { if mctx, ok := ctx.(ModuleErrorfContext); ok { mctx.ModuleErrorf(format, args...) } else if ectx, ok := ctx.(errorfContext); ok { ectx.Errorf(format, args...) Loading
apex/apex.go +2 −2 Original line number Diff line number Diff line Loading @@ -1628,7 +1628,7 @@ func apexFileForCompatConfig(ctx android.BaseModuleContext, config java.Platform type javaModule interface { android.Module BaseModuleName() string DexJarBuildPath() java.OptionalDexJarPath DexJarBuildPath(ctx android.ModuleErrorfContext) java.OptionalDexJarPath JacocoReportClassesFile() android.Path LintDepSets() java.LintDepSets Stem() string Loading @@ -1642,7 +1642,7 @@ var _ javaModule = (*java.SdkLibraryImport)(nil) // apexFileForJavaModule creates an apexFile for a java module's dex implementation jar. func apexFileForJavaModule(ctx android.BaseModuleContext, module javaModule) apexFile { return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath().PathOrNil()) return apexFileForJavaModuleWithFile(ctx, module, module.DexJarBuildPath(ctx).PathOrNil()) } // apexFileForJavaModuleWithFile creates an apexFile for a java module with the supplied file. Loading
apex/apex_test.go +12 −3 Original line number Diff line number Diff line Loading @@ -5355,6 +5355,13 @@ func TestPrebuiltApexNameWithPlatformBootclasspath(t *testing.T) { ).RunTest(t) } // A minimal context object for use with DexJarBuildPath type moduleErrorfTestCtx struct { } func (ctx moduleErrorfTestCtx) ModuleErrorf(format string, args ...interface{}) { } // These tests verify that the prebuilt_apex/deapexer to java_import wiring allows for the // propagation of paths to dex implementation jars from the former to the latter. func TestPrebuiltExportDexImplementationJars(t *testing.T) { Loading @@ -5364,7 +5371,7 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) { t.Helper() // Make sure the import has been given the correct path to the dex jar. p := ctx.ModuleForTests(name, "android_common_myapex").Module().(java.UsesLibraryDependency) dexJarBuildPath := p.DexJarBuildPath().PathOrNil() dexJarBuildPath := p.DexJarBuildPath(moduleErrorfTestCtx{}).PathOrNil() stem := android.RemoveOptionalPrebuiltPrefix(name) android.AssertStringEquals(t, "DexJarBuildPath should be apex-related path.", ".intermediates/myapex.deapexer/android_common/deapexer/javalib/"+stem+".jar", Loading Loading @@ -8491,6 +8498,8 @@ func TestDuplicateButEquivalentDeapexersFromPrebuiltApexes(t *testing.T) { PrepareForTestWithApexBuildComponents, ) errCtx := moduleErrorfTestCtx{} bpBase := ` apex_set { name: "com.android.myapex", Loading Loading @@ -8540,7 +8549,7 @@ func TestDuplicateButEquivalentDeapexersFromPrebuiltApexes(t *testing.T) { usesLibraryDep := module.(java.UsesLibraryDependency) android.AssertPathRelativeToTopEquals(t, "dex jar path", "out/soong/.intermediates/com.android.myapex.deapexer/android_common/deapexer/javalib/libfoo.jar", usesLibraryDep.DexJarBuildPath().Path()) usesLibraryDep.DexJarBuildPath(errCtx).Path()) }) t.Run("java_sdk_library_import", func(t *testing.T) { Loading @@ -8563,7 +8572,7 @@ func TestDuplicateButEquivalentDeapexersFromPrebuiltApexes(t *testing.T) { usesLibraryDep := module.(java.UsesLibraryDependency) android.AssertPathRelativeToTopEquals(t, "dex jar path", "out/soong/.intermediates/com.android.myapex.deapexer/android_common/deapexer/javalib/libfoo.jar", usesLibraryDep.DexJarBuildPath().Path()) usesLibraryDep.DexJarBuildPath(errCtx).Path()) }) t.Run("prebuilt_bootclasspath_fragment", func(t *testing.T) { Loading
apex/bootclasspath_fragment_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -677,7 +677,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { func getDexJarPath(result *android.TestResult, name string) string { module := result.Module(name, "android_common") return module.(java.UsesLibraryDependency).DexJarBuildPath().Path().RelativeToTop().String() return module.(java.UsesLibraryDependency).DexJarBuildPath(moduleErrorfTestCtx{}).Path().RelativeToTop().String() } // TestBootclasspathFragment_HiddenAPIList checks to make sure that the correct parameters are Loading
java/aar.go +1 −1 Original line number Diff line number Diff line Loading @@ -1284,7 +1284,7 @@ func (a *AARImport) ImplementationAndResourcesJars() android.Paths { return android.Paths{a.classpathFile} } func (a *AARImport) DexJarBuildPath() android.Path { func (a *AARImport) DexJarBuildPath(ctx android.ModuleErrorfContext) android.Path { return nil } Loading