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
This commit is contained in:
Colin Cross
2017-11-22 16:20:45 -08:00
parent 46029a4131
commit 5ab4e6d817
8 changed files with 117 additions and 18 deletions

View File

@@ -16,6 +16,7 @@ package android
import (
"fmt"
"runtime"
"strings"
"github.com/google/blueprint"
@@ -141,7 +142,7 @@ func (p PackageContext) SourcePathVariableWithEnvOverride(name, path, env string
})
}
// 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 @@ func (p PackageContext) HostBinToolPath(config Config, path string) (Path, error
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