Defer dexpreopt failure with missing implementation jar

Previously, if an implementation jar (Host) was not available to the
build it would panic when trying to generate the JSON representation of
the CLC. That prevents builds with missing implementation jars from
working even if those jars are never actually built.

This change defers the build failure until it is actually built.

Test: TARGET_PRODUCT=armv8 TARGET_BUILD_VARIANT=eng ./art/test/testrunner/run_build_test_target.py -j80 art-no-prebuild
      - run above in master-art before and after this change.
Bug: 202366925
Change-Id: I60a78a8bf6c13b83a9dceb5c43019a9e21f0b637
This commit is contained in:
Paul Duffin
2021-10-07 09:40:59 +01:00
parent 688cea69f4
commit 77a80fa397

View File

@@ -598,11 +598,18 @@ func toJsonClassLoaderContext(clcMap ClassLoaderContextMap) jsonClassLoaderConte
func toJsonClassLoaderContextRec(clcs []*ClassLoaderContext) []*jsonClassLoaderContext {
jClcs := make([]*jsonClassLoaderContext, len(clcs))
for i, clc := range clcs {
var host string
if clc.Host == nil {
// Defer build failure to when this CLC is actually used.
host = fmt.Sprintf("implementation-jar-for-%s-is-not-available.jar", clc.Name)
} else {
host = clc.Host.String()
}
jClcs[i] = &jsonClassLoaderContext{
Name: clc.Name,
Optional: clc.Optional,
Implicit: clc.Implicit,
Host: clc.Host.String(),
Host: host,
Device: clc.Device,
Subcontexts: toJsonClassLoaderContextRec(clc.Subcontexts),
}