summaryrefslogtreecommitdiff
path: root/sdk/sdk.go
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2019-11-04 12:23:40 +0900
committer Jiyong Park <jiyong@google.com> 2019-11-07 12:24:48 +0900
commit232e785b9894a2df107b557378b84a900bbb68e5 (patch)
treec75ae0daeff4ef4620598e0438f3026e1c0e013c /sdk/sdk.go
parentb9a80a071657aacec5c03a5b5baa2ec0d2f5a729 (diff)
SDK snapshot is dist'ed
`m module_sdk dist` produces snapshots of all SDKs in the source tree. A snapshot is a zip file consists of Android.bp, exported headers, exported AIDL files, stubs for native libs and jars. The zip file is expected to be downloaded from the build server and extracted to a directory (which probably will be /prebuilts/module_sdks/<module_name>/current). Bug: 138182343 Test: m (sdk_test.go updated) Change-Id: Idbe4bc24795fe08f26fc1cf7497028f9d162053a
Diffstat (limited to 'sdk/sdk.go')
-rw-r--r--sdk/sdk.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/sdk/sdk.go b/sdk/sdk.go
index cb81a1466..4eb3665fb 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -29,6 +29,7 @@ import (
)
func init() {
+ pctx.Import("android/soong/android")
android.RegisterModuleType("sdk", ModuleFactory)
android.RegisterModuleType("sdk_snapshot", SnapshotModuleFactory)
android.PreDepsMutators(RegisterPreDepsMutators)
@@ -41,8 +42,7 @@ type sdk struct {
properties sdkProperties
- updateScript android.OutputPath
- freezeScript android.OutputPath
+ snapshotFile android.OptionalPath
}
type sdkProperties struct {
@@ -104,11 +104,24 @@ func (s *sdk) frozenVersions(ctx android.BaseModuleContext) []string {
}
func (s *sdk) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- s.buildSnapshotGenerationScripts(ctx)
+ if !s.snapshot() {
+ // We don't need to create a snapshot out of sdk_snapshot.
+ // That doesn't make sense. We need a snapshot to create sdk_snapshot.
+ s.snapshotFile = android.OptionalPathForPath(s.buildSnapshot(ctx))
+ }
}
func (s *sdk) AndroidMkEntries() android.AndroidMkEntries {
- return s.androidMkEntriesForScript()
+ if !s.snapshotFile.Valid() {
+ return android.AndroidMkEntries{}
+ }
+
+ return android.AndroidMkEntries{
+ Class: "FAKE",
+ OutputFile: s.snapshotFile,
+ DistFile: s.snapshotFile,
+ Include: "$(BUILD_PHONY_PACKAGE)",
+ }
}
// RegisterPreDepsMutators registers pre-deps mutators to support modules implementing SdkAware