Allow building framework.jar and framework-res.apk
Update app support enough to build framework-res.apk, link
framework.jar against its generated files, and export it to
make.
Bug: 69917341
Test: m checkbuild tests docs
Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
diff --git a/android/package_ctx.go b/android/package_ctx.go
index b40e0a9..3f6a253 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -16,6 +16,7 @@
import (
"fmt"
+ "runtime"
"strings"
"github.com/google/blueprint"
@@ -141,7 +142,7 @@
})
}
-// HostBinVariable returns a Variable whose value is the path to a host tool
+// HostBinToolVariable returns a Variable whose value is the path to a host tool
// in the bin directory for host targets. It may only be called during a Go
// package's initialization - either from the init() function or as part of a
// package-scoped variable's initialization.
@@ -164,6 +165,33 @@
return pa, nil
}
+// HostJNIToolVariable returns a Variable whose value is the path to a host tool
+// in the lib directory for host targets. It may only be called during a Go
+// package's initialization - either from the init() function or as part of a
+// package-scoped variable's initialization.
+func (p PackageContext) HostJNIToolVariable(name, path string) blueprint.Variable {
+ return p.VariableFunc(name, func(config Config) (string, error) {
+ po, err := p.HostJNIToolPath(config, path)
+ if err != nil {
+ return "", err
+ }
+ return po.String(), nil
+ })
+}
+
+func (p PackageContext) HostJNIToolPath(config Config, path string) (Path, error) {
+ ctx := &configErrorWrapper{p, config, []error{}}
+ ext := ".so"
+ if runtime.GOOS == "darwin" {
+ ext = ".dylib"
+ }
+ pa := PathForOutput(ctx, "host", ctx.config.PrebuiltOS(), "lib64", path+ext)
+ if len(ctx.errors) > 0 {
+ return nil, ctx.errors[0]
+ }
+ return pa, nil
+}
+
// HostJavaToolVariable returns a Variable whose value is the path to a host
// tool in the frameworks directory for host targets. It may only be called
// during a Go package's initialization - either from the init() function or as