Jihoon Kang | f2c5398 | 2024-10-09 17:32:52 +0000 | [diff] [blame] | 1 | // Copyright (C) 2024 The Android Open Source Project |
| 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 | |
| 15 | package filesystem |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | |
| 20 | "github.com/google/blueprint" |
| 21 | "github.com/google/blueprint/proptools" |
| 22 | ) |
| 23 | |
| 24 | type PartitionNameProperties struct { |
| 25 | // Name of the Boot_partition_name partition filesystem module |
| 26 | Boot_partition_name *string |
| 27 | // Name of the System partition filesystem module |
| 28 | System_partition_name *string |
| 29 | // Name of the System_ext partition filesystem module |
| 30 | System_ext_partition_name *string |
| 31 | // Name of the Product partition filesystem module |
| 32 | Product_partition_name *string |
| 33 | // Name of the Vendor partition filesystem module |
| 34 | Vendor_partition_name *string |
Spandan Das | c571716 | 2024-11-01 18:33:57 +0000 | [diff] [blame^] | 35 | // Name of the Odm partition filesystem module |
| 36 | Odm_partition_name *string |
Jihoon Kang | f2c5398 | 2024-10-09 17:32:52 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | type androidDevice struct { |
| 40 | android.ModuleBase |
| 41 | |
| 42 | partitionProps PartitionNameProperties |
| 43 | } |
| 44 | |
| 45 | func AndroidDeviceFactory() android.Module { |
| 46 | module := &androidDevice{} |
| 47 | module.AddProperties(&module.partitionProps) |
| 48 | android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 49 | |
| 50 | return module |
| 51 | } |
| 52 | |
| 53 | type partitionDepTagType struct { |
| 54 | blueprint.BaseDependencyTag |
| 55 | } |
| 56 | |
| 57 | var filesystemDepTag partitionDepTagType |
| 58 | |
| 59 | func (a *androidDevice) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 60 | addDependencyIfDefined := func(dep *string) { |
| 61 | if dep != nil { |
| 62 | ctx.AddDependency(ctx.Module(), filesystemDepTag, proptools.String(dep)) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | addDependencyIfDefined(a.partitionProps.Boot_partition_name) |
| 67 | addDependencyIfDefined(a.partitionProps.System_partition_name) |
| 68 | addDependencyIfDefined(a.partitionProps.System_ext_partition_name) |
| 69 | addDependencyIfDefined(a.partitionProps.Product_partition_name) |
| 70 | addDependencyIfDefined(a.partitionProps.Vendor_partition_name) |
Spandan Das | c571716 | 2024-11-01 18:33:57 +0000 | [diff] [blame^] | 71 | addDependencyIfDefined(a.partitionProps.Odm_partition_name) |
Jihoon Kang | f2c5398 | 2024-10-09 17:32:52 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 75 | |
| 76 | } |