summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/license.go2
-rw-r--r--android/paths.go7
-rw-r--r--android/sdk.go34
3 files changed, 24 insertions, 19 deletions
diff --git a/android/license.go b/android/license.go
index 3bc6199b2..cb375a2e5 100644
--- a/android/license.go
+++ b/android/license.go
@@ -51,6 +51,7 @@ type licenseProperties struct {
type licenseModule struct {
ModuleBase
DefaultableModuleBase
+ SdkBase
properties licenseProperties
}
@@ -75,6 +76,7 @@ func LicenseFactory() Module {
// The visibility property needs to be checked and parsed by the visibility module.
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
+ InitSdkAwareModule(module)
initAndroidModuleBase(module)
InitDefaultableModule(module)
diff --git a/android/paths.go b/android/paths.go
index b934687ea..5d458cbb1 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -24,6 +24,7 @@ import (
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/pathtools"
)
@@ -449,6 +450,12 @@ func getPathsFromModuleDep(ctx ModuleWithDepsPathContext, path, moduleName, tag
return outputFiles, nil
} else if tag != "" {
return nil, fmt.Errorf("path dependency %q is not an output file producing module", path)
+ } else if goBinary, ok := module.(bootstrap.GoBinaryTool); ok {
+ if rel, err := filepath.Rel(PathForOutput(ctx).String(), goBinary.InstallPath()); err == nil {
+ return Paths{PathForOutput(ctx, rel).WithoutRel()}, nil
+ } else {
+ return nil, fmt.Errorf("cannot find output path for %q: %w", goBinary.InstallPath(), err)
+ }
} else if srcProducer, ok := module.(SourceFileProducer); ok {
return srcProducer.Srcs(), nil
} else {
diff --git a/android/sdk.go b/android/sdk.go
index 6fc1910d0..0adfd89c3 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -41,6 +41,11 @@ type sdkAwareWithoutModule interface {
sdkBase() *SdkBase
MakeMemberOf(sdk SdkRef)
IsInAnySdk() bool
+
+ // IsVersioned determines whether the module is versioned, i.e. has a name of the form
+ // <name>@<version>
+ IsVersioned() bool
+
ContainingSdk() SdkRef
MemberName() string
BuildWithSdks(sdks SdkRefs)
@@ -82,7 +87,7 @@ const SdkVersionSeparator = '@'
func ParseSdkRef(ctx BaseModuleContext, str string, property string) SdkRef {
tokens := strings.Split(str, string(SdkVersionSeparator))
if len(tokens) < 1 || len(tokens) > 2 {
- ctx.PropertyErrorf(property, "%q does not follow name#version syntax", str)
+ ctx.PropertyErrorf(property, "%q does not follow name@version syntax", str)
return SdkRef{Name: "invalid sdk name", Version: "invalid sdk version"}
}
@@ -140,6 +145,11 @@ func (s *SdkBase) IsInAnySdk() bool {
return s.properties.ContainingSdk != nil
}
+// IsVersioned returns true if this module is versioned.
+func (s *SdkBase) IsVersioned() bool {
+ return strings.Contains(s.module.Name(), "@")
+}
+
// ContainingSdk returns the SDK that this module is a member of
func (s *SdkBase) ContainingSdk() SdkRef {
if s.properties.ContainingSdk != nil {
@@ -292,9 +302,7 @@ type SdkMember interface {
}
// SdkMemberTypeDependencyTag is the interface that a tag must implement in order to allow the
-// dependent module to be automatically added to the sdk. In order for this to work the
-// SdkMemberType of the depending module must return true from
-// SdkMemberType.HasTransitiveSdkMembers.
+// dependent module to be automatically added to the sdk.
type SdkMemberTypeDependencyTag interface {
blueprint.DependencyTag
@@ -375,13 +383,6 @@ type SdkMemberType interface {
// True if the member type supports the sdk/sdk_snapshot, false otherwise.
UsableWithSdkAndSdkSnapshot() bool
- // Return true if modules of this type can have dependencies which should be
- // treated as if they are sdk members.
- //
- // Any dependency that is to be treated as a member of the sdk needs to implement
- // SdkAware and be added with an SdkMemberTypeDependencyTag tag.
- HasTransitiveSdkMembers() bool
-
// Return true if prebuilt host artifacts may be specific to the host OS. Only
// applicable to modules where HostSupported() is true. If this is true,
// snapshots will list each host OS variant explicitly and disable all other
@@ -447,10 +448,9 @@ type SdkMemberType interface {
// Base type for SdkMemberType implementations.
type SdkMemberTypeBase struct {
- PropertyName string
- SupportsSdk bool
- TransitiveSdkMembers bool
- HostOsDependent bool
+ PropertyName string
+ SupportsSdk bool
+ HostOsDependent bool
}
func (b *SdkMemberTypeBase) SdkPropertyName() string {
@@ -461,10 +461,6 @@ func (b *SdkMemberTypeBase) UsableWithSdkAndSdkSnapshot() bool {
return b.SupportsSdk
}
-func (b *SdkMemberTypeBase) HasTransitiveSdkMembers() bool {
- return b.TransitiveSdkMembers
-}
-
func (b *SdkMemberTypeBase) IsHostOsDependent() bool {
return b.HostOsDependent
}