Mårten Kongstad | c82f118 | 2023-11-20 15:04:30 +0100 | [diff] [blame] | 1 | // Copyright 2023 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package aconfig |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | ) |
| 20 | |
| 21 | func ExportedJavaDeclarationsLibraryFactory() android.Singleton { |
| 22 | return &exportedJavaDeclarationsLibrarySingleton{} |
| 23 | } |
| 24 | |
| 25 | type exportedJavaDeclarationsLibrarySingleton struct { |
| 26 | intermediatePath android.OutputPath |
| 27 | } |
| 28 | |
| 29 | func (this *exportedJavaDeclarationsLibrarySingleton) GenerateBuildActions(ctx android.SingletonContext) { |
| 30 | // Find all of the aconfig_declarations modules |
| 31 | var cacheFiles android.Paths |
| 32 | ctx.VisitAllModules(func(module android.Module) { |
Yu Liu | 663e450 | 2024-08-12 18:23:59 +0000 | [diff] [blame] | 33 | decl, ok := android.OtherModuleProvider(ctx, module, android.AconfigDeclarationsProviderKey) |
Colin Cross | 5a37718 | 2023-12-14 14:46:23 -0800 | [diff] [blame] | 34 | if !ok { |
Mårten Kongstad | c82f118 | 2023-11-20 15:04:30 +0100 | [diff] [blame] | 35 | return |
| 36 | } |
Mårten Kongstad | c82f118 | 2023-11-20 15:04:30 +0100 | [diff] [blame] | 37 | cacheFiles = append(cacheFiles, decl.IntermediateCacheOutputPath) |
| 38 | }) |
| 39 | |
| 40 | // Generate build action for aconfig |
| 41 | this.intermediatePath = android.PathForIntermediates(ctx, "exported_java_aconfig_library.jar") |
| 42 | ctx.Build(pctx, android.BuildParams{ |
| 43 | Rule: exportedJavaRule, |
| 44 | Inputs: cacheFiles, |
| 45 | Output: this.intermediatePath, |
| 46 | Description: "exported_java_aconfig_library", |
| 47 | Args: map[string]string{ |
| 48 | "cache_files": android.JoinPathsWithPrefix(cacheFiles, " "), |
| 49 | }, |
| 50 | }) |
| 51 | ctx.Phony("exported_java_aconfig_library", this.intermediatePath) |
| 52 | } |
| 53 | |
| 54 | func (this *exportedJavaDeclarationsLibrarySingleton) MakeVars(ctx android.MakeVarsContext) { |
| 55 | ctx.DistForGoalWithFilename("sdk", this.intermediatePath, "android-flags.jar") |
| 56 | } |