summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f06fb17)
raw | patch | inline | side by side (parent: f06fb17)
author | Yifan Hong <elsk@google.com> | |
Fri, 12 Oct 2018 20:08:52 +0000 (13:08 -0700) | ||
committer | Yifan Hong <elsk@google.com> | |
Mon, 15 Oct 2018 22:42:11 +0000 (15:42 -0700) |
* Kernel config requirements are built as
separate rules in kernel/configs. All kernel requirements
(including minlts and configs) are represented there.
* device framework compatibility matrix and final
framework compatibility matrix need special environment
variables, so they are not generic enough to be written
in the soong rule.
See compatibility_matrices/Android.bp for sample usages.
Test: builds and compare output before change
Change-Id: I53bf88362314f96487ca243c9292570b7931f24b
separate rules in kernel/configs. All kernel requirements
(including minlts and configs) are represented there.
* device framework compatibility matrix and final
framework compatibility matrix need special environment
variables, so they are not generic enough to be written
in the soong rule.
See compatibility_matrices/Android.bp for sample usages.
Test: builds and compare output before change
Change-Id: I53bf88362314f96487ca243c9292570b7931f24b
compatibility_matrices/Android.bp | [new file with mode: 0644] | patch | blob |
compatibility_matrices/Android.mk | patch | blob | history | |
compatibility_matrices/build/Android.bp | [new file with mode: 0644] | patch | blob |
compatibility_matrices/build/vintf_compatibility_matrix.go | [new file with mode: 0644] | patch | blob |
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// 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.
+
+vintf_compatibility_matrix {
+ name: "framework_compatibility_matrix.legacy.xml",
+ stem: "compatibility_matrix.legacy.xml",
+ srcs: [
+ "compatibility_matrix.legacy.xml",
+ ],
+ kernel_configs: [
+ // legacy uses O kernel requirements
+ "kernel_config_o_3.18",
+ "kernel_config_o_4.4",
+ "kernel_config_o_4.9",
+ ]
+}
+vintf_compatibility_matrix {
+ name: "framework_compatibility_matrix.1.xml",
+ stem: "compatibility_matrix.1.xml",
+ srcs: [
+ "compatibility_matrix.1.xml",
+ ],
+ kernel_configs: [
+ "kernel_config_o_3.18",
+ "kernel_config_o_4.4",
+ "kernel_config_o_4.9",
+ ]
+}
+vintf_compatibility_matrix {
+ name: "framework_compatibility_matrix.2.xml",
+ stem: "compatibility_matrix.2.xml",
+ srcs: [
+ "compatibility_matrix.2.xml",
+ ],
+ kernel_configs: [
+ "kernel_config_o_mr1_3.18",
+ "kernel_config_o_mr1_4.4",
+ "kernel_config_o_mr1_4.9",
+ ]
+}
+
+vintf_compatibility_matrix {
+ name: "framework_compatibility_matrix.3.xml",
+ stem: "compatibility_matrix.3.xml",
+ srcs: [
+ "compatibility_matrix.3.xml",
+ ],
+ kernel_configs: [
+ "kernel_config_p_4.4",
+ "kernel_config_p_4.9",
+ "kernel_config_p_4.14",
+ ]
+}
+
+vintf_compatibility_matrix {
+ name: "framework_compatibility_matrix.current.xml",
+ stem: "compatibility_matrix.current.xml",
+ srcs: [
+ "compatibility_matrix.current.xml",
+ ],
+ kernel_configs: [
+ "kernel_config_current_4.4",
+ "kernel_config_current_4.9",
+ "kernel_config_current_4.14",
+ ]
+}
index 22d04120021b1a0ee18496ac98eb8724c6da6f58..d53709dbf4dde22ea1c0eb7b0bcad71ce76266a2 100644 (file)
my_kernel_config_data := kernel/configs
-# Install all compatibility_matrix.*.xml to /system/etc/vintf
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/clear_vars.mk
-LOCAL_MODULE := framework_compatibility_matrix.legacy.xml
-LOCAL_MODULE_STEM := compatibility_matrix.legacy.xml
-LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM)
-LOCAL_KERNEL_CONFIG_DATA_PATHS := \
- 3.18.0:$(my_kernel_config_data)/o/android-3.18 \
- 4.4.0:$(my_kernel_config_data)/o/android-4.4 \
- 4.9.0:$(my_kernel_config_data)/o/android-4.9 \
-
-include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/clear_vars.mk
-LOCAL_MODULE := framework_compatibility_matrix.1.xml
-LOCAL_MODULE_STEM := compatibility_matrix.1.xml
-LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM)
-LOCAL_KERNEL_CONFIG_DATA_PATHS := \
- 3.18.0:$(my_kernel_config_data)/o/android-3.18 \
- 4.4.0:$(my_kernel_config_data)/o/android-4.4 \
- 4.9.0:$(my_kernel_config_data)/o/android-4.9 \
-
-include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/clear_vars.mk
-LOCAL_MODULE := framework_compatibility_matrix.2.xml
-LOCAL_MODULE_STEM := compatibility_matrix.2.xml
-LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM)
-LOCAL_KERNEL_CONFIG_DATA_PATHS := \
- 3.18.0:$(my_kernel_config_data)/o-mr1/android-3.18 \
- 4.4.0:$(my_kernel_config_data)/o-mr1/android-4.4 \
- 4.9.0:$(my_kernel_config_data)/o-mr1/android-4.9 \
-
-include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/clear_vars.mk
-LOCAL_MODULE := framework_compatibility_matrix.3.xml
-LOCAL_MODULE_STEM := compatibility_matrix.3.xml
-LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM)
-LOCAL_KERNEL_CONFIG_DATA_PATHS := \
- 4.4.107:$(my_kernel_config_data)/p/android-4.4 \
- 4.9.84:$(my_kernel_config_data)/p/android-4.9 \
- 4.14.42:$(my_kernel_config_data)/p/android-4.14 \
-
-include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/clear_vars.mk
-LOCAL_MODULE := framework_compatibility_matrix.current.xml
-LOCAL_MODULE_STEM := compatibility_matrix.current.xml
-LOCAL_SRC_FILES := $(LOCAL_MODULE_STEM)
-LOCAL_KERNEL_CONFIG_DATA_PATHS := \
- 4.4.0:$(my_kernel_config_data)/android-4.4 \
- 4.9.0:$(my_kernel_config_data)/android-4.9 \
- 4.14.0:$(my_kernel_config_data)/android-4.14 \
-
-include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
-
-my_kernel_config_data :=
-
# Framework Compatibility Matrix (common to all FCM versions)
include $(CLEAR_VARS)
diff --git a/compatibility_matrices/build/Android.bp b/compatibility_matrices/build/Android.bp
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// 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.
+
+bootstrap_go_package {
+ name: "vintf-compatibility-matrix-soong-rules",
+ pkgPath: "android/soong/vintf-compatibility-matrix",
+ deps: [
+ "blueprint",
+ "blueprint-proptools",
+ "kernel-config-soong-rules",
+ "soong",
+ "soong-android",
+ ],
+ srcs: [
+ "vintf_compatibility_matrix.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/compatibility_matrices/build/vintf_compatibility_matrix.go b/compatibility_matrices/build/vintf_compatibility_matrix.go
--- /dev/null
@@ -0,0 +1,132 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// 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 vintf
+
+import (
+ "fmt"
+ "io"
+ "strings"
+
+ "github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
+
+ "android/soong/android"
+ "android/soong/kernel/configs"
+)
+
+type dependencyTag struct {
+ blueprint.BaseDependencyTag
+ name string
+}
+
+var (
+ pctx = android.NewPackageContext("android/vintf")
+
+ assembleVintfRule = pctx.AndroidStaticRule("assemble_vintf", blueprint.RuleParams{
+ Command: `${assembleVintfCmd} -i ${inputs} -o ${out}`,
+ CommandDeps: []string{"${assembleVintfCmd}"},
+ Description: "assemble_vintf -i ${inputs}",
+ }, "inputs")
+
+ kernelConfigTag = dependencyTag{name: "kernel-config"}
+)
+
+const (
+ relpath = "vintf"
+)
+
+type vintfCompatibilityMatrixProperties struct {
+ // set the name of the output
+ Stem *string
+
+ // list of source compatibility matrix XML files
+ Srcs []string
+
+ // list of kernel_config modules to be combined to final output
+ Kernel_configs []string
+}
+
+type vintfCompatibilityMatrixRule struct {
+ android.ModuleBase
+ properties vintfCompatibilityMatrixProperties
+
+ genFile android.WritablePath
+}
+
+func init() {
+ pctx.HostBinToolVariable("assembleVintfCmd", "assemble_vintf")
+ android.RegisterModuleType("vintf_compatibility_matrix", vintfCompatibilityMatrixFactory)
+}
+
+func vintfCompatibilityMatrixFactory() android.Module {
+ g := &vintfCompatibilityMatrixRule{}
+ g.AddProperties(&g.properties)
+ android.InitAndroidArchModule(g, android.DeviceSupported, android.MultilibCommon)
+ return g
+}
+
+var _ android.AndroidMkDataProvider = (*vintfCompatibilityMatrixRule)(nil)
+
+func (g *vintfCompatibilityMatrixRule) DepsMutator(ctx android.BottomUpMutatorContext) {
+ android.ExtractSourcesDeps(ctx, g.properties.Srcs)
+ ctx.AddDependency(ctx.Module(), kernelConfigTag, g.properties.Kernel_configs...)
+}
+
+func (g *vintfCompatibilityMatrixRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+
+ outputFilename := proptools.String(g.properties.Stem)
+ if outputFilename == "" {
+ outputFilename = g.Name()
+ }
+
+ inputPaths := android.PathsForModuleSrc(ctx, g.properties.Srcs)
+ ctx.VisitDirectDepsWithTag(kernelConfigTag, func(m android.Module) {
+ if k, ok := m.(*configs.KernelConfigRule); ok {
+ inputPaths = append(inputPaths, k.OutputPath())
+ } else {
+ ctx.PropertyErrorf("kernel_config",
+ "module %q is not a kernel_config", ctx.OtherModuleName(m))
+ }
+ })
+
+ g.genFile = android.PathForModuleGen(ctx, outputFilename)
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: assembleVintfRule,
+ Description: "Framework Compatibility Matrix",
+ Implicits: inputPaths,
+ Output: g.genFile,
+ Args: map[string]string{
+ "inputs": strings.Join(inputPaths.Strings(), ":"),
+ },
+ })
+
+ ctx.InstallFile(android.PathForModuleInstall(ctx, "etc", relpath), outputFilename, g.genFile)
+}
+
+func (g *vintfCompatibilityMatrixRule) AndroidMk() android.AndroidMkData {
+ return android.AndroidMkData{
+ Class: "ETC",
+ OutputFile: android.OptionalPathForPath(g.genFile),
+ Extra: []android.AndroidMkExtraFunc{
+ func(w io.Writer, outputFile android.Path) {
+ fmt.Fprintln(w, "LOCAL_MODULE_RELATIVE_PATH :=", relpath)
+ if proptools.String(g.properties.Stem) != "" {
+ fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", proptools.String(g.properties.Stem))
+ }
+ },
+ },
+ }
+}