Rename device_config --> aconfig and definitions --> declarations
Bug: 285303012 Test: for x in next trunk trunk_food trunk_staging ; do lunch aosp_panther-$x-eng ; m nothing ; done Change-Id: I3375f46b3ecbbc516d1bee6ab3f80725fcccde8f
This commit is contained in:
parent
81b25ed02b
commit
981c926269
13 changed files with 137 additions and 137 deletions
|
@ -3,8 +3,8 @@ package {
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap_go_package {
|
bootstrap_go_package {
|
||||||
name: "soong-device_config",
|
name: "soong-aconfig",
|
||||||
pkgPath: "android/soong/device_config",
|
pkgPath: "android/soong/aconfig",
|
||||||
deps: [
|
deps: [
|
||||||
"blueprint",
|
"blueprint",
|
||||||
"blueprint-pathtools",
|
"blueprint-pathtools",
|
||||||
|
@ -16,17 +16,17 @@ bootstrap_go_package {
|
||||||
"soong-java",
|
"soong-java",
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
"device_config_definitions.go",
|
"aconfig_declarations.go",
|
||||||
"device_config_values.go",
|
"aconfig_values.go",
|
||||||
"device_config_value_set.go",
|
"aconfig_value_set.go",
|
||||||
"init.go",
|
"init.go",
|
||||||
"java_device_config_definitions_library.go",
|
"java_aconfig_library.go",
|
||||||
"testing.go",
|
"testing.go",
|
||||||
],
|
],
|
||||||
testSrcs: [
|
testSrcs: [
|
||||||
"device_config_definitions_test.go",
|
"aconfig_declarations_test.go",
|
||||||
"device_config_values_test.go",
|
"aconfig_values_test.go",
|
||||||
"device_config_value_set_test.go",
|
"aconfig_value_set_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
@ -21,11 +21,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DefinitionsModule struct {
|
type DeclarationsModule struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
android.DefaultableModuleBase
|
android.DefaultableModuleBase
|
||||||
|
|
||||||
// Properties for "device_config_definitions"
|
// Properties for "aconfig_declarations"
|
||||||
properties struct {
|
properties struct {
|
||||||
// aconfig files, relative to this Android.bp file
|
// aconfig files, relative to this Android.bp file
|
||||||
Srcs []string `android:"path"`
|
Srcs []string `android:"path"`
|
||||||
|
@ -33,15 +33,15 @@ type DefinitionsModule struct {
|
||||||
// Release config flag package
|
// Release config flag package
|
||||||
Package string
|
Package string
|
||||||
|
|
||||||
// Values from TARGET_RELEASE / RELEASE_DEVICE_CONFIG_VALUE_SETS
|
// Values from TARGET_RELEASE / RELEASE_ACONFIG_VALUE_SETS
|
||||||
Values []string `blueprint:"mutated"`
|
Values []string `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
intermediatePath android.WritablePath
|
intermediatePath android.WritablePath
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefinitionsFactory() android.Module {
|
func DeclarationsFactory() android.Module {
|
||||||
module := &DefinitionsModule{}
|
module := &DeclarationsModule{}
|
||||||
|
|
||||||
android.InitAndroidModule(module)
|
android.InitAndroidModule(module)
|
||||||
android.InitDefaultableModule(module)
|
android.InitDefaultableModule(module)
|
||||||
|
@ -58,7 +58,7 @@ type implicitValuesTagType struct {
|
||||||
|
|
||||||
var implicitValuesTag = implicitValuesTagType{}
|
var implicitValuesTag = implicitValuesTagType{}
|
||||||
|
|
||||||
func (module *DefinitionsModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (module *DeclarationsModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
// Validate Properties
|
// Validate Properties
|
||||||
if len(module.properties.Srcs) == 0 {
|
if len(module.properties.Srcs) == 0 {
|
||||||
ctx.PropertyErrorf("srcs", "missing source files")
|
ctx.PropertyErrorf("srcs", "missing source files")
|
||||||
|
@ -68,14 +68,14 @@ func (module *DefinitionsModule) DepsMutator(ctx android.BottomUpMutatorContext)
|
||||||
ctx.PropertyErrorf("package", "missing package property")
|
ctx.PropertyErrorf("package", "missing package property")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a dependency on the device_config_value_sets defined in
|
// Add a dependency on the aconfig_value_sets defined in
|
||||||
// RELEASE_DEVICE_CONFIG_VALUE_SETS, and add any device_config_values that
|
// RELEASE_ACONFIG_VALUE_SETS, and add any aconfig_values that
|
||||||
// match our package.
|
// match our package.
|
||||||
valuesFromConfig := ctx.Config().ReleaseDeviceConfigValueSets()
|
valuesFromConfig := ctx.Config().ReleaseAconfigValueSets()
|
||||||
ctx.AddDependency(ctx.Module(), implicitValuesTag, valuesFromConfig...)
|
ctx.AddDependency(ctx.Module(), implicitValuesTag, valuesFromConfig...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (module *DefinitionsModule) OutputFiles(tag string) (android.Paths, error) {
|
func (module *DeclarationsModule) OutputFiles(tag string) (android.Paths, error) {
|
||||||
switch tag {
|
switch tag {
|
||||||
case "":
|
case "":
|
||||||
// The default output of this module is the intermediates format, which is
|
// The default output of this module is the intermediates format, which is
|
||||||
|
@ -83,7 +83,7 @@ func (module *DefinitionsModule) OutputFiles(tag string) (android.Paths, error)
|
||||||
// correctly.
|
// correctly.
|
||||||
return []android.Path{module.intermediatePath}, nil
|
return []android.Path{module.intermediatePath}, nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported device_config_definitions module reference tag %q", tag)
|
return nil, fmt.Errorf("unsupported aconfig_declarations module reference tag %q", tag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,16 +96,16 @@ func joinAndPrefix(prefix string, values []string) string {
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provider published by device_config_value_set
|
// Provider published by aconfig_value_set
|
||||||
type definitionsProviderData struct {
|
type declarationsProviderData struct {
|
||||||
Package string
|
Package string
|
||||||
IntermediatePath android.WritablePath
|
IntermediatePath android.WritablePath
|
||||||
}
|
}
|
||||||
|
|
||||||
var definitionsProviderKey = blueprint.NewProvider(definitionsProviderData{})
|
var declarationsProviderKey = blueprint.NewProvider(declarationsProviderData{})
|
||||||
|
|
||||||
func (module *DefinitionsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
// Get the values that came from the global RELEASE_DEVICE_CONFIG_VALUE_SETS flag
|
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
if !ctx.OtherModuleHasProvider(dep, valueSetProviderKey) {
|
if !ctx.OtherModuleHasProvider(dep, valueSetProviderKey) {
|
||||||
// Other modules get injected as dependencies too, for example the license modules
|
// Other modules get injected as dependencies too, for example the license modules
|
||||||
|
@ -127,7 +127,7 @@ func (module *DefinitionsModule) GenerateAndroidBuildActions(ctx android.ModuleC
|
||||||
Rule: aconfigRule,
|
Rule: aconfigRule,
|
||||||
Inputs: inputFiles,
|
Inputs: inputFiles,
|
||||||
Output: intermediatePath,
|
Output: intermediatePath,
|
||||||
Description: "device_config_definitions",
|
Description: "aconfig_declarations",
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"release_version": ctx.Config().ReleaseVersion(),
|
"release_version": ctx.Config().ReleaseVersion(),
|
||||||
"package": module.properties.Package,
|
"package": module.properties.Package,
|
||||||
|
@ -135,7 +135,7 @@ func (module *DefinitionsModule) GenerateAndroidBuildActions(ctx android.ModuleC
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.SetProvider(definitionsProviderKey, definitionsProviderData{
|
ctx.SetProvider(declarationsProviderKey, declarationsProviderData{
|
||||||
Package: module.properties.Package,
|
Package: module.properties.Package,
|
||||||
IntermediatePath: intermediatePath,
|
IntermediatePath: intermediatePath,
|
||||||
})
|
})
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -21,9 +21,9 @@ import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDeviceConfigDefinitions(t *testing.T) {
|
func TestAconfigDeclarations(t *testing.T) {
|
||||||
bp := `
|
bp := `
|
||||||
device_config_definitions {
|
aconfig_declarations {
|
||||||
name: "module_name",
|
name: "module_name",
|
||||||
package: "com.example.package",
|
package: "com.example.package",
|
||||||
srcs: ["foo.aconfig"],
|
srcs: ["foo.aconfig"],
|
||||||
|
@ -31,10 +31,10 @@ func TestDeviceConfigDefinitions(t *testing.T) {
|
||||||
`
|
`
|
||||||
result := runTest(t, android.FixtureExpectsNoErrors, bp)
|
result := runTest(t, android.FixtureExpectsNoErrors, bp)
|
||||||
|
|
||||||
module := result.ModuleForTests("module_name", "").Module().(*DefinitionsModule)
|
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
|
||||||
|
|
||||||
// Check that the provider has the right contents
|
// Check that the provider has the right contents
|
||||||
depData := result.ModuleProvider(module, definitionsProviderKey).(definitionsProviderData)
|
depData := result.ModuleProvider(module, declarationsProviderKey).(declarationsProviderData)
|
||||||
android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
|
android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
|
||||||
if !strings.HasSuffix(depData.IntermediatePath.String(), "/intermediate.pb") {
|
if !strings.HasSuffix(depData.IntermediatePath.String(), "/intermediate.pb") {
|
||||||
t.Errorf("Missing intermediates path in provider: %s", depData.IntermediatePath.String())
|
t.Errorf("Missing intermediates path in provider: %s", depData.IntermediatePath.String())
|
|
@ -12,20 +12,20 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Properties for "device_config_value_set"
|
// Properties for "aconfig_value_set"
|
||||||
type ValueSetModule struct {
|
type ValueSetModule struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
android.DefaultableModuleBase
|
android.DefaultableModuleBase
|
||||||
|
|
||||||
properties struct {
|
properties struct {
|
||||||
// device_config_values modules
|
// aconfig_values modules
|
||||||
Values []string
|
Values []string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,10 @@ type valueSetType struct {
|
||||||
|
|
||||||
var valueSetTag = valueSetType{}
|
var valueSetTag = valueSetType{}
|
||||||
|
|
||||||
// Provider published by device_config_value_set
|
// Provider published by aconfig_value_set
|
||||||
type valueSetProviderData struct {
|
type valueSetProviderData struct {
|
||||||
// The package of each of the
|
// The package of each of the
|
||||||
// (map of package --> device_config_module)
|
// (map of package --> aconfig_module)
|
||||||
AvailablePackages map[string]android.Paths
|
AvailablePackages map[string]android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ func (module *ValueSetModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
for _, dep := range deps {
|
for _, dep := range deps {
|
||||||
_, ok := dep.(*ValuesModule)
|
_, ok := dep.(*ValuesModule)
|
||||||
if !ok {
|
if !ok {
|
||||||
ctx.PropertyErrorf("values", "values must be a device_config_values module")
|
ctx.PropertyErrorf("values", "values must be a aconfig_values module")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ func (module *ValueSetModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
|
||||||
func (module *ValueSetModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (module *ValueSetModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
// Accumulate the packages of the values modules listed, and set that as an
|
// Accumulate the packages of the values modules listed, and set that as an
|
||||||
// valueSetProviderKey provider that device_config modules can read and use
|
// valueSetProviderKey provider that aconfig modules can read and use
|
||||||
// to append values to their aconfig actions.
|
// to append values to their aconfig actions.
|
||||||
packages := make(map[string]android.Paths)
|
packages := make(map[string]android.Paths)
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -20,15 +20,15 @@ import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDeviceConfigValueSet(t *testing.T) {
|
func TestAconfigValueSet(t *testing.T) {
|
||||||
bp := `
|
bp := `
|
||||||
device_config_values {
|
aconfig_values {
|
||||||
name: "one",
|
name: "one",
|
||||||
srcs: [ "blah.aconfig_values" ],
|
srcs: [ "blah.aconfig_values" ],
|
||||||
package: "foo.package"
|
package: "foo.package"
|
||||||
}
|
}
|
||||||
|
|
||||||
device_config_value_set {
|
aconfig_value_set {
|
||||||
name: "module_name",
|
name: "module_name",
|
||||||
values: [ "one" ],
|
values: [ "one" ],
|
||||||
}
|
}
|
|
@ -12,14 +12,14 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Properties for "device_config_value"
|
// Properties for "aconfig_value"
|
||||||
type ValuesModule struct {
|
type ValuesModule struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
android.DefaultableModuleBase
|
android.DefaultableModuleBase
|
||||||
|
@ -45,7 +45,7 @@ func ValuesFactory() android.Module {
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provider published by device_config_value_set
|
// Provider published by aconfig_value_set
|
||||||
type valuesProviderData struct {
|
type valuesProviderData struct {
|
||||||
// The package that this values module values
|
// The package that this values module values
|
||||||
Package string
|
Package string
|
||||||
|
@ -61,7 +61,7 @@ func (module *ValuesModule) GenerateAndroidBuildActions(ctx android.ModuleContex
|
||||||
ctx.PropertyErrorf("package", "missing package property")
|
ctx.PropertyErrorf("package", "missing package property")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provide the our source files list to the device_config_value_set as a list of files
|
// Provide the our source files list to the aconfig_value_set as a list of files
|
||||||
providerData := valuesProviderData{
|
providerData := valuesProviderData{
|
||||||
Package: module.properties.Package,
|
Package: module.properties.Package,
|
||||||
Values: android.PathsForModuleSrc(ctx, module.properties.Srcs),
|
Values: android.PathsForModuleSrc(ctx, module.properties.Srcs),
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -20,9 +20,9 @@ import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDeviceConfigValues(t *testing.T) {
|
func TestAconfigValues(t *testing.T) {
|
||||||
bp := `
|
bp := `
|
||||||
device_config_values {
|
aconfig_values {
|
||||||
name: "module_name",
|
name: "module_name",
|
||||||
srcs: [ "blah.aconfig_values" ],
|
srcs: [ "blah.aconfig_values" ],
|
||||||
package: "foo.package"
|
package: "foo.package"
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
@ -20,9 +20,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pctx = android.NewPackageContext("android/soong/device_config")
|
pctx = android.NewPackageContext("android/soong/aconfig")
|
||||||
|
|
||||||
// For device_config_definitions: Generate cache file
|
// For aconfig_declarations: Generate cache file
|
||||||
aconfigRule = pctx.AndroidStaticRule("aconfig",
|
aconfigRule = pctx.AndroidStaticRule("aconfig",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: `${aconfig} create-cache` +
|
Command: `${aconfig} create-cache` +
|
||||||
|
@ -38,7 +38,7 @@ var (
|
||||||
Restat: true,
|
Restat: true,
|
||||||
}, "release_version", "package", "values")
|
}, "release_version", "package", "values")
|
||||||
|
|
||||||
// For java_device_config_definitions_library: Generate java file
|
// For java_aconfig_library: Generate java file
|
||||||
srcJarRule = pctx.AndroidStaticRule("aconfig_srcjar",
|
srcJarRule = pctx.AndroidStaticRule("aconfig_srcjar",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: `rm -rf ${out}.tmp` +
|
Command: `rm -rf ${out}.tmp` +
|
||||||
|
@ -63,8 +63,8 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerBuildComponents(ctx android.RegistrationContext) {
|
func registerBuildComponents(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterModuleType("device_config_definitions", DefinitionsFactory)
|
ctx.RegisterModuleType("aconfig_declarations", DeclarationsFactory)
|
||||||
ctx.RegisterModuleType("device_config_values", ValuesFactory)
|
ctx.RegisterModuleType("aconfig_values", ValuesFactory)
|
||||||
ctx.RegisterModuleType("device_config_value_set", ValueSetFactory)
|
ctx.RegisterModuleType("aconfig_value_set", ValueSetFactory)
|
||||||
ctx.RegisterModuleType("java_device_config_definitions_library", JavaDefinitionsLibraryFactory)
|
ctx.RegisterModuleType("java_aconfig_library", JavaDeclarationsLibraryFactory)
|
||||||
}
|
}
|
71
aconfig/java_aconfig_library.go
Normal file
71
aconfig/java_aconfig_library.go
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
// Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package aconfig
|
||||||
|
|
||||||
|
import (
|
||||||
|
"android/soong/android"
|
||||||
|
"android/soong/java"
|
||||||
|
"fmt"
|
||||||
|
"github.com/google/blueprint"
|
||||||
|
)
|
||||||
|
|
||||||
|
type declarationsTagType struct {
|
||||||
|
blueprint.BaseDependencyTag
|
||||||
|
}
|
||||||
|
|
||||||
|
var declarationsTag = declarationsTagType{}
|
||||||
|
|
||||||
|
type JavaAconfigDeclarationsLibraryProperties struct {
|
||||||
|
// name of the aconfig_declarations module to generate a library for
|
||||||
|
Aconfig_declarations string
|
||||||
|
}
|
||||||
|
|
||||||
|
type JavaAconfigDeclarationsLibraryCallbacks struct {
|
||||||
|
properties JavaAconfigDeclarationsLibraryProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
func JavaDeclarationsLibraryFactory() android.Module {
|
||||||
|
callbacks := &JavaAconfigDeclarationsLibraryCallbacks{}
|
||||||
|
return java.GeneratedJavaLibraryModuleFactory("java_aconfig_library", callbacks, &callbacks.properties)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) DepsMutator(module *java.GeneratedJavaLibraryModule, ctx android.BottomUpMutatorContext) {
|
||||||
|
declarations := callbacks.properties.Aconfig_declarations
|
||||||
|
if len(declarations) == 0 {
|
||||||
|
// TODO: Add test for this case
|
||||||
|
ctx.PropertyErrorf("aconfig_declarations", "aconfig_declarations property required")
|
||||||
|
} else {
|
||||||
|
ctx.AddDependency(ctx.Module(), declarationsTag, declarations)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuildActions(ctx android.ModuleContext) android.Path {
|
||||||
|
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
|
||||||
|
declarationsModules := ctx.GetDirectDepsWithTag(declarationsTag)
|
||||||
|
if len(declarationsModules) != 1 {
|
||||||
|
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
||||||
|
}
|
||||||
|
declarations := ctx.OtherModuleProvider(declarationsModules[0], declarationsProviderKey).(declarationsProviderData)
|
||||||
|
|
||||||
|
srcJarPath := android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: srcJarRule,
|
||||||
|
Input: declarations.IntermediatePath,
|
||||||
|
Output: srcJarPath,
|
||||||
|
Description: "aconfig.srcjar",
|
||||||
|
})
|
||||||
|
|
||||||
|
return srcJarPath
|
||||||
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package device_config
|
package aconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -20,10 +20,10 @@ import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
var PrepareForTestWithDeviceConfigBuildComponents = android.FixtureRegisterWithContext(registerBuildComponents)
|
var PrepareForTestWithAconfigBuildComponents = android.FixtureRegisterWithContext(registerBuildComponents)
|
||||||
|
|
||||||
func runTest(t *testing.T, errorHandler android.FixtureErrorHandler, bp string) *android.TestResult {
|
func runTest(t *testing.T, errorHandler android.FixtureErrorHandler, bp string) *android.TestResult {
|
||||||
return android.GroupFixturePreparers(PrepareForTestWithDeviceConfigBuildComponents).
|
return android.GroupFixturePreparers(PrepareForTestWithAconfigBuildComponents).
|
||||||
ExtendWithErrorHandler(errorHandler).
|
ExtendWithErrorHandler(errorHandler).
|
||||||
RunTestWithBp(t, bp)
|
RunTestWithBp(t, bp)
|
||||||
}
|
}
|
|
@ -184,8 +184,8 @@ func (c Config) ReleaseVersion() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The flag values files passed to aconfig, derived from RELEASE_VERSION
|
// The flag values files passed to aconfig, derived from RELEASE_VERSION
|
||||||
func (c Config) ReleaseDeviceConfigValueSets() []string {
|
func (c Config) ReleaseAconfigValueSets() []string {
|
||||||
return c.config.productVariables.ReleaseDeviceConfigValueSets
|
return c.config.productVariables.ReleaseAconfigValueSets
|
||||||
}
|
}
|
||||||
|
|
||||||
// A DeviceConfig object represents the configuration for a particular device
|
// A DeviceConfig object represents the configuration for a particular device
|
||||||
|
|
|
@ -478,7 +478,7 @@ type productVariables struct {
|
||||||
BuildVersionTags []string `json:",omitempty"`
|
BuildVersionTags []string `json:",omitempty"`
|
||||||
|
|
||||||
ReleaseVersion string `json:",omitempty"`
|
ReleaseVersion string `json:",omitempty"`
|
||||||
ReleaseDeviceConfigValueSets []string `json:",omitempty"`
|
ReleaseAconfigValueSets []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func boolPtr(v bool) *bool {
|
func boolPtr(v bool) *bool {
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
// Copyright 2023 Google Inc. All rights reserved.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package device_config
|
|
||||||
|
|
||||||
import (
|
|
||||||
"android/soong/android"
|
|
||||||
"android/soong/java"
|
|
||||||
"fmt"
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
|
||||||
|
|
||||||
type definitionsTagType struct {
|
|
||||||
blueprint.BaseDependencyTag
|
|
||||||
}
|
|
||||||
|
|
||||||
var definitionsTag = definitionsTagType{}
|
|
||||||
|
|
||||||
type JavaDeviceConfigDefinitionsLibraryProperties struct {
|
|
||||||
// name of the device_config_definitions module to generate a library for
|
|
||||||
Device_config_definitions string
|
|
||||||
}
|
|
||||||
|
|
||||||
type JavaDeviceConfigDefinitionsLibraryCallbacks struct {
|
|
||||||
properties JavaDeviceConfigDefinitionsLibraryProperties
|
|
||||||
}
|
|
||||||
|
|
||||||
func JavaDefinitionsLibraryFactory() android.Module {
|
|
||||||
callbacks := &JavaDeviceConfigDefinitionsLibraryCallbacks{}
|
|
||||||
return java.GeneratedJavaLibraryModuleFactory("java_device_config_definitions_library", callbacks, &callbacks.properties)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (callbacks *JavaDeviceConfigDefinitionsLibraryCallbacks) DepsMutator(module *java.GeneratedJavaLibraryModule, ctx android.BottomUpMutatorContext) {
|
|
||||||
definitions := callbacks.properties.Device_config_definitions
|
|
||||||
if len(definitions) == 0 {
|
|
||||||
// TODO: Add test for this case
|
|
||||||
ctx.PropertyErrorf("device_config_definitions", "device_config_definitions property required")
|
|
||||||
} else {
|
|
||||||
ctx.AddDependency(ctx.Module(), definitionsTag, definitions)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (callbacks *JavaDeviceConfigDefinitionsLibraryCallbacks) GenerateSourceJarBuildActions(ctx android.ModuleContext) android.Path {
|
|
||||||
// Get the values that came from the global RELEASE_DEVICE_CONFIG_VALUE_SETS flag
|
|
||||||
definitionsModules := ctx.GetDirectDepsWithTag(definitionsTag)
|
|
||||||
if len(definitionsModules) != 1 {
|
|
||||||
panic(fmt.Errorf("Exactly one device_config_definitions property required"))
|
|
||||||
}
|
|
||||||
definitions := ctx.OtherModuleProvider(definitionsModules[0], definitionsProviderKey).(definitionsProviderData)
|
|
||||||
|
|
||||||
srcJarPath := android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
|
||||||
Rule: srcJarRule,
|
|
||||||
Input: definitions.IntermediatePath,
|
|
||||||
Output: srcJarPath,
|
|
||||||
Description: "device_config.srcjar",
|
|
||||||
})
|
|
||||||
|
|
||||||
return srcJarPath
|
|
||||||
}
|
|
Loading…
Reference in a new issue