• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2025 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	"strings"
19	"testing"
20
21	"android/soong/android"
22)
23
24func TestAllAconfigDeclarationsExtension(t *testing.T) {
25	result := android.GroupFixturePreparers(
26		PrepareForTestWithAconfigBuildComponents,
27		android.FixtureMergeMockFs(
28			android.MockFS{
29				"a.txt":     nil,
30				"flags.txt": nil,
31			},
32		),
33	).RunTestWithBp(t, `
34		all_aconfig_declarations {
35			name: "all_aconfig_declarations",
36		}
37
38		all_aconfig_declarations_extension {
39			name: "custom_aconfig_declarations",
40			base: "all_aconfig_declarations",
41			api_signature_files: [
42				"a.txt",
43			],
44			finalized_flags_file: "flags.txt",
45		}
46	`)
47
48	finalizedFlags := result.ModuleForTests(t, "custom_aconfig_declarations", "").Output("finalized-flags.txt")
49	android.AssertStringContainsEquals(t, "must depend on all_aconfig_declarations", strings.Join(finalizedFlags.Inputs.Strings(), " "), "all_aconfig_declarations.pb", true)
50}
51