blob: 291938fa866b8c9cc0f3bc66eb5fb09de07277e8 [file] [log] [blame]
Mårten Kongstadc82f1182023-11-20 15:04:30 +01001// 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
15package aconfig
16
17import (
18 "android/soong/android"
19)
20
21func ExportedJavaDeclarationsLibraryFactory() android.Singleton {
22 return &exportedJavaDeclarationsLibrarySingleton{}
23}
24
25type exportedJavaDeclarationsLibrarySingleton struct {
26 intermediatePath android.OutputPath
27}
28
29func (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) {
LaMont Jonesaa005ae2023-12-19 19:01:57 +000033 decl, ok := android.SingletonModuleProvider(ctx, module, android.AconfigDeclarationsProviderKey)
Colin Cross5a377182023-12-14 14:46:23 -080034 if !ok {
Mårten Kongstadc82f1182023-11-20 15:04:30 +010035 return
36 }
Mårten Kongstadc82f1182023-11-20 15:04:30 +010037 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
54func (this *exportedJavaDeclarationsLibrarySingleton) MakeVars(ctx android.MakeVarsContext) {
55 ctx.DistForGoalWithFilename("sdk", this.intermediatePath, "android-flags.jar")
56}