aboutsummaryrefslogtreecommitdiffstats
path: root/android/package_ctx.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/package_ctx.go')
-rw-r--r--android/package_ctx.go30
1 files changed, 29 insertions, 1 deletions
diff --git a/android/package_ctx.go b/android/package_ctx.go
index b40e0a9c..3f6a253e 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -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