diff options
Diffstat (limited to 'build/soong')
-rw-r--r-- | build/soong/Android.bp | 46 | ||||
-rw-r--r-- | build/soong/android/config.go | 13 | ||||
-rw-r--r-- | build/soong/android/variable.go | 100 | ||||
-rw-r--r-- | build/soong/generator/generator.go | 310 | ||||
-rw-r--r-- | build/soong/generator/variables.go | 28 | ||||
-rw-r--r-- | build/soong/soong_config.mk | 34 |
6 files changed, 0 insertions, 531 deletions
diff --git a/build/soong/Android.bp b/build/soong/Android.bp deleted file mode 100644 index 382b68ee..00000000 --- a/build/soong/Android.bp +++ /dev/null @@ -1,46 +0,0 @@ -bootstrap_go_package { - name: "soong-lineage", - pkgPath: "lineage/soong/android", - srcs: [ - "android/config.go", - "android/variable.go", - ], -} - -bootstrap_go_package { - name: "soong-lineage-generator", - pkgPath: "lineage/soong/generator", - deps: [ - "blueprint", - "blueprint-pathtools", - "soong", - "soong-android", - "soong-shared", - ], - srcs: [ - "generator/generator.go", - "generator/variables.go", - ], - pluginFor: ["soong_build"], -} - -lineage_generator { - name: "generated_kernel_includes", - - // The headers make command - cmd: "make $(KERNEL_MAKE_FLAGS) -C $(TARGET_KERNEL_SOURCE) O=$(genDir) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) headers_install", - - // Directories that can be imported by a cc_* module generated_headers property - export_include_dirs: ["usr/include", "usr/techpack/audio/include"], - - // Sources for dependency tracking - dep_root: "$(TARGET_KERNEL_SOURCE)", - dep_files: [ "Makefile", "include/**/*", "arch/$(KERNEL_ARCH)/include/**/*", "techpack/audio/include/**/*"], -} - -cc_library_headers { - name: "generated_kernel_headers", - generated_headers: ["generated_kernel_includes"], - export_generated_headers: ["generated_kernel_includes"], - vendor_available: true, -} diff --git a/build/soong/android/config.go b/build/soong/android/config.go deleted file mode 100644 index e926c9d8..00000000 --- a/build/soong/android/config.go +++ /dev/null @@ -1,13 +0,0 @@ -package android - -// Global config used by Lineage soong additions -var LineageConfig = struct { - // List of packages that are permitted - // for java source overlays. - JavaSourceOverlayModuleWhitelist []string -}{ - // JavaSourceOverlayModuleWhitelist - []string{ - "org.lineageos.hardware", - }, -} diff --git a/build/soong/android/variable.go b/build/soong/android/variable.go deleted file mode 100644 index 2136f01e..00000000 --- a/build/soong/android/variable.go +++ /dev/null @@ -1,100 +0,0 @@ -package android -type Product_variables struct { - Additional_gralloc_10_usage_bits struct { - Cppflags []string - } - Apply_msm8974_1440p_egl_workaround struct { - Cflags []string - } - Bootloader_message_offset struct { - Cflags []string - } - Has_legacy_camera_hal1 struct { - Cflags []string - } - Should_skip_waiting_for_qsee struct { - Cflags []string - } - Supports_hw_fde struct { - Cflags []string - Header_libs []string - Shared_libs []string - } - Supports_hw_fde_perf struct { - Cflags []string - } - Supports_legacy_hw_fde struct { - Cflags []string - } - Target_omx_legacy_rescaling struct { - Cppflags []string - } - Target_process_sdk_version_override struct { - Cppflags []string - } - Target_shim_libs struct { - Cppflags []string - } - Uses_generic_camera_parameter_library struct { - Srcs []string - } - Uses_metadata_as_fde_key struct { - Cflags []string - } - Uses_nvidia_enhancements struct { - Cppflags []string - } - Uses_qcom_bsp_legacy struct { - Cppflags []string - } - Uses_qti_camera_device struct { - Cppflags []string - Shared_libs []string - } - Uses_qcom_um_family struct { - Cflags []string - Srcs []string - } - Uses_qcom_um_3_18_family struct { - Header_libs []string - Shared_libs []string - } - Uses_qcom_um_4_4_family struct { - Header_libs []string - Shared_libs []string - } - Uses_qcom_um_4_9_family struct { - Header_libs []string - Shared_libs []string - } - Uses_qcom_um_4_14_family struct { - Header_libs []string - Shared_libs []string - } -} - -type ProductVariables struct { - Additional_gralloc_10_usage_bits *string `json:",omitempty"` - Apply_msm8974_1440p_egl_workaround *bool `json:",omitempty"` - Bootloader_message_offset *int `json:",omitempty"` - Has_legacy_camera_hal1 *bool `json:",omitempty"` - Java_Source_Overlays *string `json:",omitempty"` - Should_skip_waiting_for_qsee *bool `json:",omitempty"` - Specific_camera_parameter_library *string `json:",omitempty"` - Supports_hw_fde *bool `json:",omitempty"` - Supports_hw_fde_perf *bool `json:",omitempty"` - Supports_legacy_hw_fde *bool `json:",omitempty"` - Target_omx_legacy_rescaling *bool `json:",omitempty"` - Target_process_sdk_version_override *string `json:",omitempty"` - Target_shim_libs *string `json:",omitempty"` - Uses_generic_camera_parameter_library *bool `json:",omitempty"` - Uses_metadata_as_fde_key *bool `json:",omitempty"` - Uses_nvidia_enhancements *bool `json:",omitempty"` - Uses_qcom_bsp_legacy *bool `json:",omitempty"` - Uses_qti_camera_device *bool `json:",omitempty"` - Uses_qcom_um_family *bool `json:",omitempty"` - Uses_qcom_um_3_18_family *bool `json:",omitempty"` - Uses_qcom_um_4_4_family *bool `json:",omitempty"` - Uses_qcom_um_4_9_family *bool `json:",omitempty"` - Uses_qcom_um_4_14_family *bool `json:",omitempty"` -} diff --git a/build/soong/generator/generator.go b/build/soong/generator/generator.go deleted file mode 100644 index 7da1fde3..00000000 --- a/build/soong/generator/generator.go +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Copyright (C) 2018 The LineageOS 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 generator - -import ( - "fmt" - "strings" - - "github.com/google/blueprint" - "github.com/google/blueprint/bootstrap" - "github.com/google/blueprint/proptools" - - "android/soong/android" - "android/soong/shared" - "path/filepath" -) - -func init() { - android.RegisterModuleType("lineage_generator", GeneratorFactory) - - pctx.HostBinToolVariable("sboxCmd", "sbox") -} - -var String = proptools.String - -var ( - pctx = android.NewPackageContext("android/soong/generator") -) - -type HostToolProvider interface { - HostToolPath() android.OptionalPath -} - -type hostToolDependencyTag struct { - blueprint.BaseDependencyTag -} - -var hostToolDepTag hostToolDependencyTag - -type generatorProperties struct { - // The command to run on one or more input files. Cmd supports substitution of a few variables - // (the actual substitution is implemented in GenerateAndroidBuildActions below) - // - // Available variables for substitution: - // - // $(location): the path to the first entry in tools or tool_files - // $(location <label>): the path to the tool or tool_file with name <label> - // $(genDir): the sandbox directory for this tool; contains $(out) - // $$: a literal $ - // - Cmd *string - - // name of the modules (if any) that produces the host executable. Leave empty for - // prebuilts or scripts that do not need a module to build them. - Tools []string - - // Local file that is used as the tool - Tool_files []string - - // List of directories to export as headers - Export_include_dirs []string - - // List of directories to export as sources - Export_source_dirs []string - - // Root directory for dep_files. - // Relative to top build dir. - Dep_root *string - - // Declare list of files that should be used for timestamp dependency checking - Dep_files []string -} - -type Module struct { - android.ModuleBase - - properties generatorProperties - - rule blueprint.Rule - - // Tool dependencies - implicitDeps android.Paths - // Deps from input files declared in dep_files property. - inputDeps android.Paths - - exportedIncludeDirs android.Paths - exportedSourceDirs android.Paths - - outputDeps android.Paths -} - -// These three methods satisfy genrule.SourceFileGenerator. -// Which cc modules check for when including headers etc. -func (g *Module) GeneratedHeaderDirs() android.Paths { - return g.exportedIncludeDirs -} - -func (g *Module) GeneratedSourceFiles() android.Paths { - return g.exportedSourceDirs -} - -func (g *Module) GeneratedDeps() android.Paths { - return g.outputDeps -} - -func (g *Module) DepsMutator(ctx android.BottomUpMutatorContext) { - android.ExtractSourcesDeps(ctx, g.properties.Dep_files) - android.ExtractSourcesDeps(ctx, g.properties.Tool_files) - if g, ok := ctx.Module().(*Module); ok { - if len(g.properties.Tools) > 0 { - ctx.AddFarVariationDependencies([]blueprint.Variation{ - {"arch", ctx.Config().BuildOsVariant}, - }, hostToolDepTag, g.properties.Tools...) - } - } -} - -func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { - if len(g.properties.Export_include_dirs) > 0 { - for _, dir := range g.properties.Export_include_dirs { - g.exportedIncludeDirs = append(g.exportedIncludeDirs, - android.PathForModuleGen(ctx, dir)) - } - } else { - g.exportedIncludeDirs = append(g.exportedIncludeDirs, android.PathForModuleGen(ctx, "")) - } - if len(g.properties.Export_source_dirs) > 0 { - for _, dir := range g.properties.Export_source_dirs { - g.exportedSourceDirs = append(g.exportedSourceDirs, - android.PathForModuleGen(ctx, dir)) - } - } else { - g.exportedSourceDirs = append(g.exportedSourceDirs, android.PathForModuleGen(ctx, "")) - } - - tools := map[string]android.Path{} - - if len(g.properties.Tools) > 0 { - ctx.VisitDirectDepsBlueprint(func(module blueprint.Module) { - switch ctx.OtherModuleDependencyTag(module) { - case android.SourceDepTag: - // Nothing to do - case hostToolDepTag: - tool := ctx.OtherModuleName(module) - var path android.OptionalPath - - if t, ok := module.(HostToolProvider); ok { - if !t.(android.Module).Enabled() { - if ctx.Config().AllowMissingDependencies() { - ctx.AddMissingDependencies([]string{tool}) - } else { - ctx.ModuleErrorf("depends on disabled module %q", tool) - } - break - } - path = t.HostToolPath() - } else if t, ok := module.(bootstrap.GoBinaryTool); ok { - if s, err := filepath.Rel(android.PathForOutput(ctx).String(), t.InstallPath()); err == nil { - path = android.OptionalPathForPath(android.PathForOutput(ctx, s)) - } else { - ctx.ModuleErrorf("cannot find path for %q: %v", tool, err) - break - } - } else { - ctx.ModuleErrorf("%q is not a host tool provider", tool) - break - } - - if path.Valid() { - g.implicitDeps = append(g.implicitDeps, path.Path()) - if _, exists := tools[tool]; !exists { - tools[tool] = path.Path() - } else { - ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool], path.Path().String()) - } - } else { - ctx.ModuleErrorf("host tool %q missing output file", tool) - } - default: - ctx.ModuleErrorf("unknown dependency on %q", ctx.OtherModuleName(module)) - } - }) - } - - if ctx.Failed() { - return - } - - toolFiles := ctx.ExpandSources(g.properties.Tool_files, nil) - for _, tool := range toolFiles { - g.implicitDeps = append(g.implicitDeps, tool) - if _, exists := tools[tool.Rel()]; !exists { - tools[tool.Rel()] = tool - } else { - ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool.Rel()], tool.Rel()) - } - } - - // Determine root dir for dep_files. Defaults to current ctx ModuleDir. - depRoot := String(g.properties.Dep_root) - if depRoot == "" { - depRoot = ctx.ModuleDir() - } else { - depRoot = lineageExpandVariables(ctx, depRoot) - } - - // Glob dep_files property - for _, dep_file := range g.properties.Dep_files { - dep_file = lineageExpandVariables(ctx, dep_file) - globPath := filepath.Join(depRoot, dep_file) - paths, err := ctx.GlobWithDeps(globPath, nil) - if err != nil { - ctx.ModuleErrorf("unable to glob %s: %s", globPath, err.Error()) - return - } - for _, path := range paths { - g.inputDeps = append(g.inputDeps, android.PathForSourceRelaxed(ctx, path)) - } - } - - cmd := lineageExpandVariables(ctx, String(g.properties.Cmd)) - - rawCommand, err := android.Expand(cmd, func(name string) (string, error) { - switch name { - case "location": - if len(g.properties.Tools) == 0 && len(toolFiles) == 0 { - return "", fmt.Errorf("at least one `tools` or `tool_files` is required if $(location) is used") - } - - if len(g.properties.Tools) > 0 { - return tools[g.properties.Tools[0]].String(), nil - } else { - return tools[toolFiles[0].Rel()].String(), nil - } - case "genDir": - return "__SBOX_OUT_DIR__", nil - default: - if strings.HasPrefix(name, "location ") { - label := strings.TrimSpace(strings.TrimPrefix(name, "location ")) - if tool, ok := tools[label]; ok { - return tool.String(), nil - } else { - return "", fmt.Errorf("unknown location label %q", label) - } - } - return "", fmt.Errorf("unknown variable '$(%s)'", name) - } - }) - - if err != nil { - ctx.PropertyErrorf("cmd", "%s", err.Error()) - return - } - - // Dummy output dep - dummyDep := android.PathForModuleGen(ctx, ".dummy_dep") - - // tell the sbox command which directory to use as its sandbox root - buildDir := android.PathForOutput(ctx).String() - sandboxPath := shared.TempDirForOutDir(buildDir) - - genDir := android.PathForModuleGen(ctx) - // Escape the command for the shell - rawCommand = "'" + strings.Replace(rawCommand, "'", `'\''`, -1) + "'" - sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s --copy-all-output -c %s && touch %s", - sandboxPath, genDir, rawCommand, dummyDep.String()) - - ruleParams := blueprint.RuleParams{ - Command: sandboxCommand, - CommandDeps: []string{"$sboxCmd"}, - } - g.rule = ctx.Rule(pctx, "generator", ruleParams) - - params := android.BuildParams{ - Rule: g.rule, - Description: "generate", - Output: dummyDep, - Inputs: g.inputDeps, - Implicits: g.implicitDeps, - } - - g.outputDeps = append(g.outputDeps, dummyDep) - - ctx.Build(pctx, params) -} - -func NewGenerator() *Module { - module := &Module{} - module.AddProperties(&module.properties) - return module -} - -func GeneratorFactory() android.Module { - m := NewGenerator() - android.InitAndroidModule(m) - return m -} diff --git a/build/soong/generator/variables.go b/build/soong/generator/variables.go deleted file mode 100644 index 8485f94b..00000000 --- a/build/soong/generator/variables.go +++ /dev/null @@ -1,28 +0,0 @@ -package generator - -import ( - "fmt" - - "android/soong/android" -) - -func lineageExpandVariables(ctx android.ModuleContext, in string) string { - lineageVars := ctx.Config().VendorConfig("lineageVarsPlugin") - - out, err := android.Expand(in, func(name string) (string, error) { - if lineageVars.IsSet(name) { - return lineageVars.String(name), nil - } - // This variable is not for us, restore what the original - // variable string will have looked like for an Expand - // that comes later. - return fmt.Sprintf("$(%s)", name), nil - }) - - if err != nil { - ctx.PropertyErrorf("%s: %s", in, err.Error()) - return "" - } - - return out -} diff --git a/build/soong/soong_config.mk b/build/soong/soong_config.mk deleted file mode 100644 index 0820d67b..00000000 --- a/build/soong/soong_config.mk +++ /dev/null @@ -1,34 +0,0 @@ -add_json_str_omitempty = $(if $(strip $(2)),$(call add_json_str, $(1), $(2))) -add_json_val_default = $(call add_json_val, $(1), $(if $(strip $(2)), $(2), $(3))) - -_contents := $(_contents) "Lineage":{$(newline) - -# See build/core/soong_config.mk for the add_json_* functions you can use here. -$(call add_json_str_omitempty, Additional_gralloc_10_usage_bits, $(TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS)) -$(call add_json_bool, Apply_msm8974_1440p_egl_workaround, $(filter true,$(TARGET_MSM8974_1440P_EGL_WORKAROUND))) -$(call add_json_val_default, Bootloader_message_offset, $(BOOTLOADER_MESSAGE_OFFSET), 0) -$(call add_json_bool, Has_legacy_camera_hal1, $(filter true,$(TARGET_HAS_LEGACY_CAMERA_HAL1))) -$(call add_json_str, Java_Source_Overlays, $(JAVA_SOURCE_OVERLAYS)) -$(call add_json_bool, Should_skip_waiting_for_qsee, $(filter true,$(TARGET_KEYMASTER_SKIP_WAITING_FOR_QSEE))) -$(call add_json_str, Specific_camera_parameter_library, $(TARGET_SPECIFIC_CAMERA_PARAMETER_LIBRARY)) -$(call add_json_bool, Supports_hw_fde, $(filter true,$(TARGET_HW_DISK_ENCRYPTION))) -$(call add_json_bool, Supports_hw_fde_perf, $(filter true,$(TARGET_HW_DISK_ENCRYPTION_PERF))) -$(call add_json_bool, Supports_legacy_hw_fde, $(filter true,$(TARGET_LEGACY_HW_DISK_ENCRYPTION))) -$(call add_json_bool, Target_omx_legacy_rescaling, $(filter true,$(TARGET_OMX_LEGACY_RESCALING))) -$(call add_json_str_omitempty, Target_process_sdk_version_override, $(TARGET_PROCESS_SDK_VERSION_OVERRIDE)) -$(call add_json_str_omitempty, Target_shim_libs, $(TARGET_LD_SHIM_LIBS)) -$(call add_json_bool, Uses_generic_camera_parameter_library, $(if $(TARGET_SPECIFIC_CAMERA_PARAMETER_LIBRARY),,true)) -$(call add_json_bool, Uses_metadata_as_fde_key, $(filter true,$(TARGET_USES_METADATA_AS_FDE_KEY))) -$(call add_json_bool, Uses_nvidia_enhancements, $(filter true,$(NV_ANDROID_FRAMEWORK_ENHANCEMENTS))) -$(call add_json_bool, Uses_qcom_bsp_legacy, $(filter true,$(TARGET_USES_QCOM_BSP_LEGACY))) -$(call add_json_bool, Uses_qti_camera_device, $(filter true,$(TARGET_USES_QTI_CAMERA_DEVICE))) -$(call add_json_bool, Uses_qcom_um_family, $(filter true,$(TARGET_USES_QCOM_UM_FAMILY))) -$(call add_json_bool, Uses_qcom_um_3_18_family, $(filter true,$(TARGET_USES_QCOM_UM_3_18_FAMILY))) -$(call add_json_bool, Uses_qcom_um_4_4_family, $(filter true,$(TARGET_USES_QCOM_UM_4_4_FAMILY))) -$(call add_json_bool, Uses_qcom_um_4_9_family, $(filter true,$(TARGET_USES_QCOM_UM_4_9_FAMILY))) -$(call add_json_bool, Uses_qcom_um_4_14_family, $(filter true,$(TARGET_USES_QCOM_UM_4_14_FAMILY))) - -# This causes the build system to strip out the last comma in our nested struct, to keep the JSON valid. -_contents := $(_contents)__SV_END - -_contents := $(_contents) },$(newline) |