aboutsummaryrefslogtreecommitdiffstats
path: root/java/java.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2020-05-17 08:34:50 +0100
committerPaul Duffin <paulduffin@google.com>2020-05-18 11:31:53 +0100
commitc8f2f186d1603f992bedbaa1f878bb03dc7c512b (patch)
tree9bc4d521212298241dc3bccf4427e91fdae96408 /java/java.go
parentc5d954a48d13211dfe3e4d609490d1c522269de5 (diff)
downloadbuild_soong-c8f2f186d1603f992bedbaa1f878bb03dc7c512b.tar.gz
build_soong-c8f2f186d1603f992bedbaa1f878bb03dc7c512b.tar.bz2
build_soong-c8f2f186d1603f992bedbaa1f878bb03dc7c512b.zip
Extract common behavior between Module and Import
Although the duplication being eliminated here is minimal follow up changes will add more functionality that is common to Module and Import. Test: m nothing Bug: 156723295 Merged-In: I1733405526764272beba63470a9bc8a958d41024 Change-Id: I1733405526764272beba63470a9bc8a958d41024 (cherry picked from commit 0d3c2e136b24272a51feed84eec947b7f42cf057)
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go34
1 files changed, 24 insertions, 10 deletions
diff --git a/java/java.go b/java/java.go
index a5d69e30..da9bd3df 100644
--- a/java/java.go
+++ b/java/java.go
@@ -354,6 +354,22 @@ func (me *CompilerDeviceProperties) EffectiveOptimizeEnabled() bool {
return BoolDefault(me.Optimize.Enabled, me.Optimize.EnabledByDefault)
}
+// Functionality common to Module and Import
+type embeddableInModuleAndImport struct {
+}
+
+// Module/Import's DepIsInSameApex(...) delegates to this method.
+//
+// This cannot implement DepIsInSameApex(...) directly as that leads to ambiguity with
+// the one provided by ApexModuleBase.
+func (e *embeddableInModuleAndImport) depIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
+ // dependencies other than the static linkage are all considered crossing APEX boundary
+ if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
+ return true
+ }
+ return false
+}
+
// Module contains the properties and members used by all java module types
type Module struct {
android.ModuleBase
@@ -361,6 +377,9 @@ type Module struct {
android.ApexModuleBase
android.SdkBase
+ // Functionality common to Module and Import.
+ embeddableInModuleAndImport
+
properties CompilerProperties
protoProperties android.ProtoProperties
deviceProperties CompilerDeviceProperties
@@ -1765,11 +1784,7 @@ func (j *Module) hasCode(ctx android.ModuleContext) bool {
}
func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
- // Dependencies other than the static linkage are all considered crossing APEX boundary
- if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
- return true
- }
- return false
+ return j.depIsInSameApex(ctx, dep)
}
func (j *Module) Stem() string {
@@ -2377,6 +2392,9 @@ type Import struct {
prebuilt android.Prebuilt
android.SdkBase
+ // Functionality common to Module and Import.
+ embeddableInModuleAndImport
+
properties ImportProperties
combinedClasspathFile android.Path
@@ -2508,11 +2526,7 @@ func (j *Import) SrcJarArgs() ([]string, android.Paths) {
}
func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
- // dependencies other than the static linkage are all considered crossing APEX boundary
- if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
- return true
- }
- return false
+ return j.depIsInSameApex(ctx, dep)
}
// Add compile time check for interface implementation