// Copyright 2021 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 cc import ( "fmt" "path/filepath" "strings" "android/soong/android" "android/soong/bazel" "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) const ( cSrcPartition = "c" asSrcPartition = "as" cppSrcPartition = "cpp" ) // staticOrSharedAttributes are the Bazel-ified versions of StaticOrSharedProperties -- // properties which apply to either the shared or static version of a cc_library module. type staticOrSharedAttributes struct { Srcs bazel.LabelListAttribute Srcs_c bazel.LabelListAttribute Srcs_as bazel.LabelListAttribute Hdrs bazel.LabelListAttribute Copts bazel.StringListAttribute Deps bazel.LabelListAttribute Implementation_deps bazel.LabelListAttribute Dynamic_deps bazel.LabelListAttribute Implementation_dynamic_deps bazel.LabelListAttribute Whole_archive_deps bazel.LabelListAttribute System_dynamic_deps bazel.LabelListAttribute } func groupSrcsByExtension(ctx android.TopDownMutatorContext, srcs bazel.LabelListAttribute) bazel.PartitionToLabelListAttribute { // Check that a module is a filegroup type named