aboutsummaryrefslogtreecommitdiffstats
path: root/java/java.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2020-03-02 10:16:35 +0000
committerPaul Duffin <paulduffin@google.com>2020-04-22 12:51:34 +0100
commit9b358d7a587ce04d1e9a23d893fa2cac161ecffb (patch)
treec497fa9676ae3dccc90674a5dfcd59767dc06f79 /java/java.go
parent8fa6acf0026fd480ada76b540dea7c529602b574 (diff)
downloadbuild_soong-9b358d7a587ce04d1e9a23d893fa2cac161ecffb.tar.gz
build_soong-9b358d7a587ce04d1e9a23d893fa2cac161ecffb.tar.bz2
build_soong-9b358d7a587ce04d1e9a23d893fa2cac161ecffb.zip
Add support for multiple os types
Updates the member snapshot creation code to support multiple os types. It basically sorts the variants by os type, then applies the code to optimize the arch properties and then it optimizes the properties that are common across architectures and extracts any properties that are common across os types. The java and cc member types needed to be modified to make the location of the generated files within the snapshot os type dependent when there is more than one os type. That was done by adding an OsPrefix() method to the SdkMemberPropertiesBase which returns the os prefix to use when there is > 1 os type and otherwise returns an empty string. Added three tests, one for cc shared libraries, one for cc binary and one for java header libraries. Bug: 150451422 Bug: 153306490 Test: m nothing Merged-In: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac Change-Id: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/java/java.go b/java/java.go
index fbb19551..e3fa69d2 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1866,12 +1866,12 @@ const (
)
// path to the jar file of a java library. Relative to <sdk_root>/<api_dir>
-func sdkSnapshotFilePathForJar(name string) string {
- return sdkSnapshotFilePathForMember(name, jarFileSuffix)
+func sdkSnapshotFilePathForJar(osPrefix, name string) string {
+ return sdkSnapshotFilePathForMember(osPrefix, name, jarFileSuffix)
}
-func sdkSnapshotFilePathForMember(name string, suffix string) string {
- return filepath.Join(javaDir, name+suffix)
+func sdkSnapshotFilePathForMember(osPrefix, name string, suffix string) string {
+ return filepath.Join(javaDir, osPrefix, name+suffix)
}
type librarySdkMemberType struct {
@@ -1918,7 +1918,7 @@ func (p *librarySdkMemberProperties) PopulateFromVariant(variant android.SdkAwar
func (p *librarySdkMemberProperties) AddToPropertySet(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, propertySet android.BpPropertySet) {
if p.jarToExport != nil {
exportedJar := p.jarToExport
- snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.library.Name())
+ snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.OsPrefix(), p.library.Name())
builder.CopyToSnapshot(exportedJar, snapshotRelativeJavaLibPath)
for _, dir := range p.library.AidlIncludeDirs() {
@@ -2125,10 +2125,10 @@ func (p *testSdkMemberProperties) PopulateFromVariant(variant android.SdkAware)
func (p *testSdkMemberProperties) AddToPropertySet(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, propertySet android.BpPropertySet) {
if p.jarToExport != nil {
- snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.test.Name())
+ snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.OsPrefix(), p.test.Name())
builder.CopyToSnapshot(p.jarToExport, snapshotRelativeJavaLibPath)
- snapshotRelativeTestConfigPath := sdkSnapshotFilePathForMember(p.test.Name(), testConfigSuffix)
+ snapshotRelativeTestConfigPath := sdkSnapshotFilePathForMember(p.OsPrefix(), p.test.Name(), testConfigSuffix)
builder.CopyToSnapshot(p.test.testConfig, snapshotRelativeTestConfigPath)
propertySet.AddProperty("jars", []string{snapshotRelativeJavaLibPath})
@@ -2336,7 +2336,7 @@ func BinaryHostFactory() android.Module {
//
type ImportProperties struct {
- Jars []string `android:"path"`
+ Jars []string `android:"path,arch_variant"`
Sdk_version *string