summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Chris Parsons <cparsons@google.com> 2023-06-08 14:28:51 +0000
committer Chris Parsons <cparsons@google.com> 2023-06-16 13:45:17 +0000
commit39a169721c3d5a085bb7940b363fd1a5dbaf4faf (patch)
treec6de7c548f41a55152a5d3d4109c3bd68f2b724d /java
parentd34e4c72f33d5a3813b52405779ac0148211a713 (diff)
Provide reason for unconverted bp2build modules
This also changes the expectation of ConvertWithBp2build. Each implementation must either create one or more Bazel target modules, or mark the module as unconvertible (with a specific reason). Manually verified no runtime hit in AOSP In AOSP, the metrics file size increases from 252K to 1.6M This changes some effective module counts in bp2build metrics: - Removes "package" modules from the module count list in metrics, as these will not be converted like regular modules. - Counts Handcrafted modules as being "unconverted", as bp2build is not responsible for them. Bug: 285631638 Test: Verified generated BUILD.bazel files are bit-for-bit identical with this change Test: Manually verified one case of each implemented reasonType Change-Id: I308dd451d8f28379b15671dae9f931bd0446f5c1
Diffstat (limited to 'java')
-rw-r--r--java/base.go3
-rw-r--r--java/sdk_library.go2
2 files changed, 5 insertions, 0 deletions
diff --git a/java/base.go b/java/base.go
index 677928320..2b81f5e36 100644
--- a/java/base.go
+++ b/java/base.go
@@ -20,6 +20,7 @@ import (
"strconv"
"strings"
+ "android/soong/ui/metrics/bp2build_metrics_proto"
"github.com/google/blueprint/pathtools"
"github.com/google/blueprint/proptools"
@@ -2205,5 +2206,7 @@ func (j *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
if testHost, ok := ctx.Module().(*TestHost); ok {
javaTestHostBp2Build(ctx, testHost)
}
+ default:
+ ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
}
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 89da19a19..6d8e2ebfb 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -24,6 +24,7 @@ import (
"strings"
"sync"
+ "android/soong/ui/metrics/bp2build_metrics_proto"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -2178,6 +2179,7 @@ type bazelSdkLibraryAttributes struct {
// java_sdk_library bp2build converter
func (module *SdkLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
if ctx.ModuleType() != "java_sdk_library" {
+ ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
return
}