blob: 1620390c2dbeae4bd4c5aeba5be4595d3f8cafd6 [file] [log] [blame]
Colin Cross69452e12023-11-15 11:20:53 -08001// Copyright 2015 Google Inc. All rights reserved.
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
15package android
16
17import (
18 "fmt"
Colin Cross69452e12023-11-15 11:20:53 -080019 "path"
20 "path/filepath"
Spandan Dasc1ded7e2024-11-01 00:52:33 +000021 "slices"
Colin Cross69452e12023-11-15 11:20:53 -080022 "strings"
Cole Faust9a346f62024-01-18 20:12:02 +000023
24 "github.com/google/blueprint"
Yu Liud3228ac2024-11-08 23:11:47 +000025 "github.com/google/blueprint/depset"
Cole Faust9a346f62024-01-18 20:12:02 +000026 "github.com/google/blueprint/proptools"
Colin Cross69452e12023-11-15 11:20:53 -080027)
28
29// BuildParameters describes the set of potential parameters to build a Ninja rule.
30// In general, these correspond to a Ninja concept.
31type BuildParams struct {
32 // A Ninja Rule that will be written to the Ninja file. This allows factoring out common code
33 // among multiple modules to reduce repetition in the Ninja file of action requirements. A rule
34 // can contain variables that should be provided in Args.
35 Rule blueprint.Rule
36 // Deps represents the depfile format. When using RuleBuilder, this defaults to GCC when depfiles
37 // are used.
38 Deps blueprint.Deps
39 // Depfile is a writeable path that allows correct incremental builds when the inputs have not
40 // been fully specified by the Ninja rule. Ninja supports a subset of the Makefile depfile syntax.
41 Depfile WritablePath
42 // A description of the build action.
43 Description string
44 // Output is an output file of the action. When using this field, references to $out in the Ninja
45 // command will refer to this file.
46 Output WritablePath
47 // Outputs is a slice of output file of the action. When using this field, references to $out in
48 // the Ninja command will refer to these files.
49 Outputs WritablePaths
Colin Cross69452e12023-11-15 11:20:53 -080050 // ImplicitOutput is an output file generated by the action. Note: references to `$out` in the
51 // Ninja command will NOT include references to this file.
52 ImplicitOutput WritablePath
53 // ImplicitOutputs is a slice of output files generated by the action. Note: references to `$out`
54 // in the Ninja command will NOT include references to these files.
55 ImplicitOutputs WritablePaths
56 // Input is an input file to the Ninja action. When using this field, references to $in in the
57 // Ninja command will refer to this file.
58 Input Path
59 // Inputs is a slice of input files to the Ninja action. When using this field, references to $in
60 // in the Ninja command will refer to these files.
61 Inputs Paths
62 // Implicit is an input file to the Ninja action. Note: references to `$in` in the Ninja command
63 // will NOT include references to this file.
64 Implicit Path
65 // Implicits is a slice of input files to the Ninja action. Note: references to `$in` in the Ninja
66 // command will NOT include references to these files.
67 Implicits Paths
68 // OrderOnly are Ninja order-only inputs to the action. When these are out of date, the output is
69 // not rebuilt until they are built, but changes in order-only dependencies alone do not cause the
70 // output to be rebuilt.
71 OrderOnly Paths
72 // Validation is an output path for a validation action. Validation outputs imply lower
73 // non-blocking priority to building non-validation outputs.
74 Validation Path
75 // Validations is a slice of output path for a validation action. Validation outputs imply lower
76 // non-blocking priority to building non-validation outputs.
77 Validations Paths
Cole Faust451912d2025-01-10 11:21:18 -080078 // Whether to output a default target statement which will be built by Ninja when no
Colin Cross69452e12023-11-15 11:20:53 -080079 // targets are specified on Ninja's command line.
80 Default bool
81 // Args is a key value mapping for replacements of variables within the Rule
82 Args map[string]string
83}
84
85type ModuleBuildParams BuildParams
86
87type ModuleContext interface {
88 BaseModuleContext
89
Colin Cross1496fb12024-09-09 16:44:10 -070090 // BlueprintModuleContext returns the blueprint.ModuleContext that the ModuleContext wraps. It may only be
91 // used by the golang module types that need to call into the bootstrap module types.
92 BlueprintModuleContext() blueprint.ModuleContext
Colin Cross69452e12023-11-15 11:20:53 -080093
94 // Deprecated: use ModuleContext.Build instead.
95 ModuleBuild(pctx PackageContext, params ModuleBuildParams)
96
97 // Returns a list of paths expanded from globs and modules referenced using ":module" syntax. The property must
98 // be tagged with `android:"path" to support automatic source module dependency resolution.
99 //
100 // Deprecated: use PathsForModuleSrc or PathsForModuleSrcExcludes instead.
101 ExpandSources(srcFiles, excludes []string) Paths
102
103 // Returns a single path expanded from globs and modules referenced using ":module" syntax. The property must
104 // be tagged with `android:"path" to support automatic source module dependency resolution.
105 //
106 // Deprecated: use PathForModuleSrc instead.
107 ExpandSource(srcFile, prop string) Path
108
109 ExpandOptionalSource(srcFile *string, prop string) OptionalPath
110
111 // InstallExecutable creates a rule to copy srcPath to name in the installPath directory,
112 // with the given additional dependencies. The file is marked executable after copying.
113 //
Yu Liubad1eef2024-08-21 22:37:35 +0000114 // The installed file can be accessed by InstallFilesInfo.InstallFiles, and the PackagingSpec
115 // for the installed file can be accessed by InstallFilesInfo.PackagingSpecs on this module
116 // or by InstallFilesInfo.TransitivePackagingSpecs on modules that depend on this module through
117 // dependency tags for which IsInstallDepNeeded returns true.
Colin Cross09ad3a62023-11-15 12:29:33 -0800118 InstallExecutable(installPath InstallPath, name string, srcPath Path, deps ...InstallPath) InstallPath
Colin Cross69452e12023-11-15 11:20:53 -0800119
120 // InstallFile creates a rule to copy srcPath to name in the installPath directory,
121 // with the given additional dependencies.
122 //
Yu Liubad1eef2024-08-21 22:37:35 +0000123 // The installed file can be accessed by InstallFilesInfo.InstallFiles, and the PackagingSpec
124 // for the installed file can be accessed by InstallFilesInfo.PackagingSpecs on this module
125 // or by InstallFilesInfo.TransitivePackagingSpecs on modules that depend on this module through
126 // dependency tags for which IsInstallDepNeeded returns true.
Colin Cross09ad3a62023-11-15 12:29:33 -0800127 InstallFile(installPath InstallPath, name string, srcPath Path, deps ...InstallPath) InstallPath
Colin Cross69452e12023-11-15 11:20:53 -0800128
Colin Crossa6182ab2024-08-21 10:47:44 -0700129 // InstallFileWithoutCheckbuild creates a rule to copy srcPath to name in the installPath directory,
130 // with the given additional dependencies, but does not add the file to the list of files to build
131 // during `m checkbuild`.
132 //
133 // The installed file will be returned by FilesToInstall(), and the PackagingSpec for the
134 // installed file will be returned by PackagingSpecs() on this module or by
135 // TransitivePackagingSpecs() on modules that depend on this module through dependency tags
136 // for which IsInstallDepNeeded returns true.
137 InstallFileWithoutCheckbuild(installPath InstallPath, name string, srcPath Path, deps ...InstallPath) InstallPath
138
Colin Cross69452e12023-11-15 11:20:53 -0800139 // InstallFileWithExtraFilesZip creates a rule to copy srcPath to name in the installPath
140 // directory, and also unzip a zip file containing extra files to install into the same
141 // directory.
142 //
Yu Liubad1eef2024-08-21 22:37:35 +0000143 // The installed file can be accessed by InstallFilesInfo.InstallFiles, and the PackagingSpec
144 // for the installed file can be accessed by InstallFilesInfo.PackagingSpecs on this module
145 // or by InstallFilesInfo.TransitivePackagingSpecs on modules that depend on this module through
146 // dependency tags for which IsInstallDepNeeded returns true.
Colin Cross09ad3a62023-11-15 12:29:33 -0800147 InstallFileWithExtraFilesZip(installPath InstallPath, name string, srcPath Path, extraZip Path, deps ...InstallPath) InstallPath
Colin Cross69452e12023-11-15 11:20:53 -0800148
149 // InstallSymlink creates a rule to create a symlink from src srcPath to name in the installPath
150 // directory.
151 //
Yu Liubad1eef2024-08-21 22:37:35 +0000152 // The installed symlink can be accessed by InstallFilesInfo.InstallFiles, and the PackagingSpec
153 // for the installed file can be accessed by InstallFilesInfo.PackagingSpecs on this module
154 // or by InstallFilesInfo.TransitivePackagingSpecs on modules that depend on this module through
155 // dependency tags for which IsInstallDepNeeded returns true.
Colin Cross69452e12023-11-15 11:20:53 -0800156 InstallSymlink(installPath InstallPath, name string, srcPath InstallPath) InstallPath
157
158 // InstallAbsoluteSymlink creates a rule to create an absolute symlink from src srcPath to name
159 // in the installPath directory.
160 //
Yu Liubad1eef2024-08-21 22:37:35 +0000161 // The installed symlink can be accessed by InstallFilesInfo.InstallFiles, and the PackagingSpec
162 // for the installed file can be accessed by InstallFilesInfo.PackagingSpecs on this module
163 // or by InstallFilesInfo.TransitivePackagingSpecs on modules that depend on this module through
164 // dependency tags for which IsInstallDepNeeded returns true.
Colin Cross69452e12023-11-15 11:20:53 -0800165 InstallAbsoluteSymlink(installPath InstallPath, name string, absPath string) InstallPath
166
Colin Cross5c1d5fb2023-11-15 12:39:40 -0800167 // InstallTestData creates rules to install test data (e.g. data files used during a test) into
168 // the installPath directory.
169 //
Yu Liubad1eef2024-08-21 22:37:35 +0000170 // The installed files can be accessed by InstallFilesInfo.InstallFiles, and the PackagingSpec
171 // for the installed files can be accessed by InstallFilesInfo.PackagingSpecs on this module
172 // or by InstallFilesInfo.TransitivePackagingSpecs on modules that depend on this module through
173 // dependency tags for which IsInstallDepNeeded returns true.
Colin Cross5c1d5fb2023-11-15 12:39:40 -0800174 InstallTestData(installPath InstallPath, data []DataPath) InstallPaths
175
Colin Cross69452e12023-11-15 11:20:53 -0800176 // PackageFile creates a PackagingSpec as if InstallFile was called, but without creating
177 // the rule to copy the file. This is useful to define how a module would be packaged
178 // without installing it into the global installation directories.
179 //
Yu Liubad1eef2024-08-21 22:37:35 +0000180 // The created PackagingSpec can be accessed by InstallFilesInfo.PackagingSpecs on this module
181 // or by InstallFilesInfo.TransitivePackagingSpecs on modules that depend on this module through
182 // dependency tags for which IsInstallDepNeeded returns true.
Colin Cross69452e12023-11-15 11:20:53 -0800183 PackageFile(installPath InstallPath, name string, srcPath Path) PackagingSpec
184
Colin Crossa6182ab2024-08-21 10:47:44 -0700185 CheckbuildFile(srcPaths ...Path)
186 UncheckedModule()
Colin Cross69452e12023-11-15 11:20:53 -0800187
188 InstallInData() bool
189 InstallInTestcases() bool
190 InstallInSanitizerDir() bool
191 InstallInRamdisk() bool
192 InstallInVendorRamdisk() bool
193 InstallInDebugRamdisk() bool
194 InstallInRecovery() bool
195 InstallInRoot() bool
Colin Crossea30d852023-11-29 16:00:16 -0800196 InstallInOdm() bool
197 InstallInProduct() bool
Colin Cross69452e12023-11-15 11:20:53 -0800198 InstallInVendor() bool
Spandan Das27ff7672024-11-06 19:23:57 +0000199 InstallInSystemDlkm() bool
200 InstallInVendorDlkm() bool
201 InstallInOdmDlkm() bool
Colin Cross69452e12023-11-15 11:20:53 -0800202 InstallForceOS() (*OsType, *ArchType)
203
Cole Fauste8a87832024-09-11 11:35:46 -0700204 RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string
Colin Cross69452e12023-11-15 11:20:53 -0800205 HostRequiredModuleNames() []string
206 TargetRequiredModuleNames() []string
207
208 ModuleSubDir() string
Colin Cross69452e12023-11-15 11:20:53 -0800209
210 Variable(pctx PackageContext, name, value string)
211 Rule(pctx PackageContext, name string, params blueprint.RuleParams, argNames ...string) blueprint.Rule
212 // Similar to blueprint.ModuleContext.Build, but takes Paths instead of []string,
213 // and performs more verification.
214 Build(pctx PackageContext, params BuildParams)
215 // Phony creates a Make-style phony rule, a rule with no commands that can depend on other
216 // phony rules or real files. Phony can be called on the same name multiple times to add
217 // additional dependencies.
218 Phony(phony string, deps ...Path)
219
220 // GetMissingDependencies returns the list of dependencies that were passed to AddDependencies or related methods,
221 // but do not exist.
222 GetMissingDependencies() []string
223
224 // LicenseMetadataFile returns the path where the license metadata for this module will be
225 // generated.
226 LicenseMetadataFile() Path
Colin Crossd6fd0132023-11-06 13:54:06 -0800227
228 // ModuleInfoJSON returns a pointer to the ModuleInfoJSON struct that can be filled out by
229 // GenerateAndroidBuildActions. If it is called then the struct will be written out and included in
230 // the module-info.json generated by Make, and Make will not generate its own data for this module.
231 ModuleInfoJSON() *ModuleInfoJSON
mrziwange6c85812024-05-22 14:36:09 -0700232
233 // SetOutputFiles stores the outputFiles to outputFiles property, which is used
234 // to set the OutputFilesProvider later.
235 SetOutputFiles(outputFiles Paths, tag string)
Wei Lia1aa2972024-06-21 13:08:51 -0700236
Yu Liu876b7ce2024-08-21 18:20:13 +0000237 GetOutputFiles() OutputFilesInfo
238
Yu Liubad1eef2024-08-21 22:37:35 +0000239 // SetLicenseInstallMap stores the set of dependency module:location mappings for files in an
240 // apex container for use when generation the license metadata file.
241 SetLicenseInstallMap(installMap []string)
242
Wei Lia1aa2972024-06-21 13:08:51 -0700243 // ComplianceMetadataInfo returns a ComplianceMetadataInfo instance for different module types to dump metadata,
244 // which usually happens in GenerateAndroidBuildActions() of a module type.
245 // See android.ModuleBase.complianceMetadataInfo
246 ComplianceMetadataInfo() *ComplianceMetadataInfo
Yu Liu9a993132024-08-27 23:21:06 +0000247
248 // Get the information about the containers this module belongs to.
249 getContainersInfo() ContainersInfo
250 setContainersInfo(info ContainersInfo)
251
252 setAconfigPaths(paths Paths)
Colin Cross69452e12023-11-15 11:20:53 -0800253}
254
255type moduleContext struct {
256 bp blueprint.ModuleContext
257 baseModuleContext
Colin Crossa6182ab2024-08-21 10:47:44 -0700258 packagingSpecs []PackagingSpec
259 installFiles InstallPaths
260 checkbuildFiles Paths
261 checkbuildTarget Path
262 uncheckedModule bool
263 module Module
264 phonies map[string]Paths
Yu Liu876b7ce2024-08-21 18:20:13 +0000265 // outputFiles stores the output of a module by tag and is used to set
266 // the OutputFilesProvider in GenerateBuildActions
267 outputFiles OutputFilesInfo
Colin Cross69452e12023-11-15 11:20:53 -0800268
Colin Crossa14fb6a2024-10-23 16:57:06 -0700269 TransitiveInstallFiles depset.DepSet[InstallPath]
Yu Liubad1eef2024-08-21 22:37:35 +0000270
271 // set of dependency module:location mappings used to populate the license metadata for
272 // apex containers.
273 licenseInstallMap []string
274
Yu Liuec810542024-08-26 18:09:15 +0000275 // The path to the generated license metadata file for the module.
276 licenseMetadataFile WritablePath
277
Yu Liud46e5ae2024-08-15 18:46:17 +0000278 katiInstalls katiInstalls
279 katiSymlinks katiInstalls
Yu Liu82a6d142024-08-27 19:02:29 +0000280 // katiInitRcInstalls and katiVintfInstalls track the install rules created by Soong that are
281 // allowed to have duplicates across modules and variants.
282 katiInitRcInstalls katiInstalls
283 katiVintfInstalls katiInstalls
284 initRcPaths Paths
285 vintfFragmentsPaths Paths
286 installedInitRcPaths InstallPaths
287 installedVintfFragmentsPaths InstallPaths
Colin Cross69452e12023-11-15 11:20:53 -0800288
Colin Cross5c1d5fb2023-11-15 12:39:40 -0800289 testData []DataPath
290
Colin Cross69452e12023-11-15 11:20:53 -0800291 // For tests
292 buildParams []BuildParams
293 ruleParams map[blueprint.Rule]blueprint.RuleParams
294 variables map[string]string
Yu Liu4297ad92024-08-27 19:50:13 +0000295
296 // moduleInfoJSON can be filled out by GenerateAndroidBuildActions to write a JSON file that will
297 // be included in the final module-info.json produced by Make.
298 moduleInfoJSON *ModuleInfoJSON
Yu Liu9a993132024-08-27 23:21:06 +0000299
300 // containersInfo stores the information about the containers and the information of the
301 // apexes the module belongs to.
302 containersInfo ContainersInfo
303
304 // Merged Aconfig files for all transitive deps.
305 aconfigFilePaths Paths
306
307 // complianceMetadataInfo is for different module types to dump metadata.
308 // See android.ModuleContext interface.
309 complianceMetadataInfo *ComplianceMetadataInfo
Colin Cross69452e12023-11-15 11:20:53 -0800310}
311
Cole Faust02987bd2024-03-21 17:58:43 -0700312var _ ModuleContext = &moduleContext{}
313
Colin Cross69452e12023-11-15 11:20:53 -0800314func (m *moduleContext) ninjaError(params BuildParams, err error) (PackageContext, BuildParams) {
315 return pctx, BuildParams{
316 Rule: ErrorRule,
317 Description: params.Description,
318 Output: params.Output,
319 Outputs: params.Outputs,
320 ImplicitOutput: params.ImplicitOutput,
321 ImplicitOutputs: params.ImplicitOutputs,
322 Args: map[string]string{
323 "error": err.Error(),
324 },
325 }
326}
327
328func (m *moduleContext) ModuleBuild(pctx PackageContext, params ModuleBuildParams) {
329 m.Build(pctx, BuildParams(params))
330}
331
Colin Cross69452e12023-11-15 11:20:53 -0800332// Convert build parameters from their concrete Android types into their string representations,
333// and combine the singular and plural fields of the same type (e.g. Output and Outputs).
334func convertBuildParams(params BuildParams) blueprint.BuildParams {
335 bparams := blueprint.BuildParams{
336 Rule: params.Rule,
337 Description: params.Description,
338 Deps: params.Deps,
339 Outputs: params.Outputs.Strings(),
340 ImplicitOutputs: params.ImplicitOutputs.Strings(),
Colin Cross69452e12023-11-15 11:20:53 -0800341 Inputs: params.Inputs.Strings(),
342 Implicits: params.Implicits.Strings(),
343 OrderOnly: params.OrderOnly.Strings(),
344 Validations: params.Validations.Strings(),
345 Args: params.Args,
Cole Faust451912d2025-01-10 11:21:18 -0800346 Default: params.Default,
Colin Cross69452e12023-11-15 11:20:53 -0800347 }
348
349 if params.Depfile != nil {
350 bparams.Depfile = params.Depfile.String()
351 }
352 if params.Output != nil {
353 bparams.Outputs = append(bparams.Outputs, params.Output.String())
354 }
Colin Cross69452e12023-11-15 11:20:53 -0800355 if params.ImplicitOutput != nil {
356 bparams.ImplicitOutputs = append(bparams.ImplicitOutputs, params.ImplicitOutput.String())
357 }
358 if params.Input != nil {
359 bparams.Inputs = append(bparams.Inputs, params.Input.String())
360 }
361 if params.Implicit != nil {
362 bparams.Implicits = append(bparams.Implicits, params.Implicit.String())
363 }
364 if params.Validation != nil {
365 bparams.Validations = append(bparams.Validations, params.Validation.String())
366 }
367
368 bparams.Outputs = proptools.NinjaEscapeList(bparams.Outputs)
369 bparams.ImplicitOutputs = proptools.NinjaEscapeList(bparams.ImplicitOutputs)
Colin Cross69452e12023-11-15 11:20:53 -0800370 bparams.Inputs = proptools.NinjaEscapeList(bparams.Inputs)
371 bparams.Implicits = proptools.NinjaEscapeList(bparams.Implicits)
372 bparams.OrderOnly = proptools.NinjaEscapeList(bparams.OrderOnly)
373 bparams.Validations = proptools.NinjaEscapeList(bparams.Validations)
374 bparams.Depfile = proptools.NinjaEscape(bparams.Depfile)
375
376 return bparams
377}
378
379func (m *moduleContext) Variable(pctx PackageContext, name, value string) {
380 if m.config.captureBuild {
381 m.variables[name] = value
382 }
383
384 m.bp.Variable(pctx.PackageContext, name, value)
385}
386
387func (m *moduleContext) Rule(pctx PackageContext, name string, params blueprint.RuleParams,
388 argNames ...string) blueprint.Rule {
389
390 if m.config.UseRemoteBuild() {
391 if params.Pool == nil {
392 // When USE_GOMA=true or USE_RBE=true are set and the rule is not supported by goma/RBE, restrict
393 // jobs to the local parallelism value
394 params.Pool = localPool
395 } else if params.Pool == remotePool {
396 // remotePool is a fake pool used to identify rule that are supported for remoting. If the rule's
397 // pool is the remotePool, replace with nil so that ninja runs it at NINJA_REMOTE_NUM_JOBS
398 // parallelism.
399 params.Pool = nil
400 }
401 }
402
403 rule := m.bp.Rule(pctx.PackageContext, name, params, argNames...)
404
405 if m.config.captureBuild {
406 m.ruleParams[rule] = params
407 }
408
409 return rule
410}
411
412func (m *moduleContext) Build(pctx PackageContext, params BuildParams) {
413 if params.Description != "" {
414 params.Description = "${moduleDesc}" + params.Description + "${moduleDescSuffix}"
415 }
416
417 if missingDeps := m.GetMissingDependencies(); len(missingDeps) > 0 {
418 pctx, params = m.ninjaError(params, fmt.Errorf("module %s missing dependencies: %s\n",
419 m.ModuleName(), strings.Join(missingDeps, ", ")))
420 }
421
422 if m.config.captureBuild {
423 m.buildParams = append(m.buildParams, params)
424 }
425
426 bparams := convertBuildParams(params)
Colin Cross69452e12023-11-15 11:20:53 -0800427 m.bp.Build(pctx.PackageContext, bparams)
428}
429
430func (m *moduleContext) Phony(name string, deps ...Path) {
Yu Liu54513622024-08-19 20:00:32 +0000431 m.phonies[name] = append(m.phonies[name], deps...)
Colin Cross69452e12023-11-15 11:20:53 -0800432}
433
434func (m *moduleContext) GetMissingDependencies() []string {
435 var missingDeps []string
436 missingDeps = append(missingDeps, m.Module().base().commonProperties.MissingDeps...)
437 missingDeps = append(missingDeps, m.bp.GetMissingDependencies()...)
438 missingDeps = FirstUniqueStrings(missingDeps)
439 return missingDeps
440}
441
Yu Liud3228ac2024-11-08 23:11:47 +0000442func (m *moduleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) Module {
Yu Liu3ae96652024-12-17 22:27:38 +0000443 deps := m.getDirectDepsInternal(name, tag)
444 if len(deps) == 1 {
445 return deps[0]
446 } else if len(deps) >= 2 {
447 panic(fmt.Errorf("Multiple dependencies having same BaseModuleName() %q found from %q",
448 name, m.ModuleName()))
449 } else {
450 return nil
Yu Liud3228ac2024-11-08 23:11:47 +0000451 }
Yu Liu3ae96652024-12-17 22:27:38 +0000452}
453
454func (m *moduleContext) GetDirectDepProxyWithTag(name string, tag blueprint.DependencyTag) *ModuleProxy {
455 deps := m.getDirectDepsProxyInternal(name, tag)
456 if len(deps) == 1 {
457 return &deps[0]
458 } else if len(deps) >= 2 {
459 panic(fmt.Errorf("Multiple dependencies having same BaseModuleName() %q found from %q",
460 name, m.ModuleName()))
461 } else {
462 return nil
463 }
Colin Cross69452e12023-11-15 11:20:53 -0800464}
465
466func (m *moduleContext) ModuleSubDir() string {
467 return m.bp.ModuleSubDir()
468}
469
Colin Cross69452e12023-11-15 11:20:53 -0800470func (m *moduleContext) InstallInData() bool {
471 return m.module.InstallInData()
472}
473
474func (m *moduleContext) InstallInTestcases() bool {
475 return m.module.InstallInTestcases()
476}
477
478func (m *moduleContext) InstallInSanitizerDir() bool {
479 return m.module.InstallInSanitizerDir()
480}
481
482func (m *moduleContext) InstallInRamdisk() bool {
483 return m.module.InstallInRamdisk()
484}
485
486func (m *moduleContext) InstallInVendorRamdisk() bool {
487 return m.module.InstallInVendorRamdisk()
488}
489
490func (m *moduleContext) InstallInDebugRamdisk() bool {
491 return m.module.InstallInDebugRamdisk()
492}
493
494func (m *moduleContext) InstallInRecovery() bool {
495 return m.module.InstallInRecovery()
496}
497
498func (m *moduleContext) InstallInRoot() bool {
499 return m.module.InstallInRoot()
500}
501
502func (m *moduleContext) InstallForceOS() (*OsType, *ArchType) {
503 return m.module.InstallForceOS()
504}
505
Colin Crossea30d852023-11-29 16:00:16 -0800506func (m *moduleContext) InstallInOdm() bool {
507 return m.module.InstallInOdm()
508}
509
510func (m *moduleContext) InstallInProduct() bool {
511 return m.module.InstallInProduct()
512}
513
Colin Cross69452e12023-11-15 11:20:53 -0800514func (m *moduleContext) InstallInVendor() bool {
515 return m.module.InstallInVendor()
516}
517
Spandan Das27ff7672024-11-06 19:23:57 +0000518func (m *moduleContext) InstallInSystemDlkm() bool {
519 return m.module.InstallInSystemDlkm()
520}
521
522func (m *moduleContext) InstallInVendorDlkm() bool {
523 return m.module.InstallInVendorDlkm()
524}
525
526func (m *moduleContext) InstallInOdmDlkm() bool {
527 return m.module.InstallInOdmDlkm()
528}
529
Colin Cross69452e12023-11-15 11:20:53 -0800530func (m *moduleContext) skipInstall() bool {
531 if m.module.base().commonProperties.SkipInstall {
532 return true
533 }
534
Colin Cross69452e12023-11-15 11:20:53 -0800535 // We'll need a solution for choosing which of modules with the same name in different
536 // namespaces to install. For now, reuse the list of namespaces exported to Make as the
537 // list of namespaces to install in a Soong-only build.
538 if !m.module.base().commonProperties.NamespaceExportedToMake {
539 return true
540 }
541
542 return false
543}
544
Jiyong Park3f627e62024-05-01 16:14:38 +0900545// Tells whether this module is installed to the full install path (ex:
546// out/target/product/<name>/<partition>) or not. If this returns false, the install build rule is
547// not created and this module can only be installed to packaging modules like android_filesystem.
548func (m *moduleContext) requiresFullInstall() bool {
549 if m.skipInstall() {
550 return false
551 }
552
Spandan Das034af2c2024-10-30 21:45:09 +0000553 if m.module.base().commonProperties.HideFromMake {
554 return false
555 }
556
Jiyong Park3f627e62024-05-01 16:14:38 +0900557 if proptools.Bool(m.module.base().commonProperties.No_full_install) {
558 return false
559 }
560
561 return true
562}
563
Colin Cross69452e12023-11-15 11:20:53 -0800564func (m *moduleContext) InstallFile(installPath InstallPath, name string, srcPath Path,
Colin Cross09ad3a62023-11-15 12:29:33 -0800565 deps ...InstallPath) InstallPath {
Colin Crossa6182ab2024-08-21 10:47:44 -0700566 return m.installFile(installPath, name, srcPath, deps, false, true, true, nil)
567}
568
569func (m *moduleContext) InstallFileWithoutCheckbuild(installPath InstallPath, name string, srcPath Path,
570 deps ...InstallPath) InstallPath {
571 return m.installFile(installPath, name, srcPath, deps, false, true, false, nil)
Colin Cross69452e12023-11-15 11:20:53 -0800572}
573
574func (m *moduleContext) InstallExecutable(installPath InstallPath, name string, srcPath Path,
Colin Cross09ad3a62023-11-15 12:29:33 -0800575 deps ...InstallPath) InstallPath {
Colin Crossa6182ab2024-08-21 10:47:44 -0700576 return m.installFile(installPath, name, srcPath, deps, true, true, true, nil)
Colin Cross69452e12023-11-15 11:20:53 -0800577}
578
579func (m *moduleContext) InstallFileWithExtraFilesZip(installPath InstallPath, name string, srcPath Path,
Colin Cross09ad3a62023-11-15 12:29:33 -0800580 extraZip Path, deps ...InstallPath) InstallPath {
Colin Crossa6182ab2024-08-21 10:47:44 -0700581 return m.installFile(installPath, name, srcPath, deps, false, true, true, &extraFilesZip{
Colin Cross69452e12023-11-15 11:20:53 -0800582 zip: extraZip,
583 dir: installPath,
584 })
585}
586
587func (m *moduleContext) PackageFile(installPath InstallPath, name string, srcPath Path) PackagingSpec {
588 fullInstallPath := installPath.Join(m, name)
589 return m.packageFile(fullInstallPath, srcPath, false)
590}
591
Colin Cross7ceb14a2024-10-30 11:40:21 -0700592func (m *moduleContext) getAconfigPaths() *Paths {
593 return &m.aconfigFilePaths
Yu Liu9a993132024-08-27 23:21:06 +0000594}
595
596func (m *moduleContext) setAconfigPaths(paths Paths) {
597 m.aconfigFilePaths = paths
Justin Yun74f3f302024-05-07 14:32:14 +0900598}
599
Spandan Dasc1ded7e2024-11-01 00:52:33 +0000600func (m *moduleContext) getOwnerAndOverrides() (string, []string) {
601 owner := m.ModuleName()
602 overrides := slices.Clone(m.Module().base().commonProperties.Overrides)
603 if b, ok := m.Module().(OverridableModule); ok {
604 if b.GetOverriddenBy() != "" {
605 // overriding variant of base module
606 overrides = append(overrides, m.ModuleName()) // com.android.foo
607 owner = m.Module().Name() // com.company.android.foo
608 }
609 }
610 return owner, overrides
611}
612
Colin Cross69452e12023-11-15 11:20:53 -0800613func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, executable bool) PackagingSpec {
614 licenseFiles := m.Module().EffectiveLicenseFiles()
Spandan Dasc1ded7e2024-11-01 00:52:33 +0000615 owner, overrides := m.getOwnerAndOverrides()
Colin Cross69452e12023-11-15 11:20:53 -0800616 spec := PackagingSpec{
617 relPathInPackage: Rel(m, fullInstallPath.PartitionDir(), fullInstallPath.String()),
618 srcPath: srcPath,
619 symlinkTarget: "",
620 executable: executable,
Colin Cross7ceb14a2024-10-30 11:40:21 -0700621 effectiveLicenseFiles: &licenseFiles,
Colin Cross69452e12023-11-15 11:20:53 -0800622 partition: fullInstallPath.partition,
Jiyong Park4152b192024-04-30 21:24:21 +0900623 skipInstall: m.skipInstall(),
Colin Cross7ceb14a2024-10-30 11:40:21 -0700624 aconfigPaths: m.getAconfigPaths(),
Jiyong Parkc6a773d2024-05-14 21:49:11 +0900625 archType: m.target.Arch.ArchType,
Colin Cross7ceb14a2024-10-30 11:40:21 -0700626 overrides: &overrides,
Spandan Dasc1ded7e2024-11-01 00:52:33 +0000627 owner: owner,
Colin Cross69452e12023-11-15 11:20:53 -0800628 }
629 m.packagingSpecs = append(m.packagingSpecs, spec)
630 return spec
631}
632
Colin Cross09ad3a62023-11-15 12:29:33 -0800633func (m *moduleContext) installFile(installPath InstallPath, name string, srcPath Path, deps []InstallPath,
Colin Crossa6182ab2024-08-21 10:47:44 -0700634 executable bool, hooks bool, checkbuild bool, extraZip *extraFilesZip) InstallPath {
Colin Cross69452e12023-11-15 11:20:53 -0800635
636 fullInstallPath := installPath.Join(m, name)
Colin Cross5c1d5fb2023-11-15 12:39:40 -0800637 if hooks {
638 m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, false)
639 }
Colin Cross69452e12023-11-15 11:20:53 -0800640
Jiyong Park3f627e62024-05-01 16:14:38 +0900641 if m.requiresFullInstall() {
Yu Liubad1eef2024-08-21 22:37:35 +0000642 deps = append(deps, InstallPaths(m.TransitiveInstallFiles.ToList())...)
Cole Faust74d243c2024-12-11 17:57:34 -0800643 if m.config.KatiEnabled() {
644 deps = append(deps, m.installedInitRcPaths...)
645 deps = append(deps, m.installedVintfFragmentsPaths...)
646 }
Colin Cross69452e12023-11-15 11:20:53 -0800647
648 var implicitDeps, orderOnlyDeps Paths
649
650 if m.Host() {
651 // Installed host modules might be used during the build, depend directly on their
652 // dependencies so their timestamp is updated whenever their dependency is updated
Colin Cross09ad3a62023-11-15 12:29:33 -0800653 implicitDeps = InstallPaths(deps).Paths()
Colin Cross69452e12023-11-15 11:20:53 -0800654 } else {
Colin Cross09ad3a62023-11-15 12:29:33 -0800655 orderOnlyDeps = InstallPaths(deps).Paths()
Colin Cross69452e12023-11-15 11:20:53 -0800656 }
657
658 if m.Config().KatiEnabled() {
659 // When creating the install rule in Soong but embedding in Make, write the rule to a
660 // makefile instead of directly to the ninja file so that main.mk can add the
661 // dependencies from the `required` property that are hard to resolve in Soong.
662 m.katiInstalls = append(m.katiInstalls, katiInstall{
663 from: srcPath,
664 to: fullInstallPath,
665 implicitDeps: implicitDeps,
666 orderOnlyDeps: orderOnlyDeps,
667 executable: executable,
668 extraFiles: extraZip,
669 })
670 } else {
Spandan Das4d78e012025-01-22 23:25:39 +0000671 rule := CpWithBash
Colin Cross69452e12023-11-15 11:20:53 -0800672 if executable {
Spandan Das4d78e012025-01-22 23:25:39 +0000673 rule = CpExecutableWithBash
Colin Cross69452e12023-11-15 11:20:53 -0800674 }
675
676 extraCmds := ""
677 if extraZip != nil {
678 extraCmds += fmt.Sprintf(" && ( unzip -qDD -d '%s' '%s' 2>&1 | grep -v \"zipfile is empty\"; exit $${PIPESTATUS[0]} )",
679 extraZip.dir.String(), extraZip.zip.String())
680 extraCmds += " || ( code=$$?; if [ $$code -ne 0 -a $$code -ne 1 ]; then exit $$code; fi )"
681 implicitDeps = append(implicitDeps, extraZip.zip)
682 }
683
684 m.Build(pctx, BuildParams{
685 Rule: rule,
686 Description: "install " + fullInstallPath.Base(),
687 Output: fullInstallPath,
688 Input: srcPath,
689 Implicits: implicitDeps,
690 OrderOnly: orderOnlyDeps,
Colin Cross69452e12023-11-15 11:20:53 -0800691 Args: map[string]string{
692 "extraCmds": extraCmds,
Spandan Das4d78e012025-01-22 23:25:39 +0000693 "cpFlags": "-f",
Colin Cross69452e12023-11-15 11:20:53 -0800694 },
695 })
696 }
697
698 m.installFiles = append(m.installFiles, fullInstallPath)
699 }
700
701 m.packageFile(fullInstallPath, srcPath, executable)
702
Colin Crossa6182ab2024-08-21 10:47:44 -0700703 if checkbuild {
704 m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
705 }
Colin Cross69452e12023-11-15 11:20:53 -0800706
707 return fullInstallPath
708}
709
710func (m *moduleContext) InstallSymlink(installPath InstallPath, name string, srcPath InstallPath) InstallPath {
711 fullInstallPath := installPath.Join(m, name)
712 m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, true)
713
714 relPath, err := filepath.Rel(path.Dir(fullInstallPath.String()), srcPath.String())
715 if err != nil {
716 panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err))
717 }
Jiyong Park3f627e62024-05-01 16:14:38 +0900718 if m.requiresFullInstall() {
Colin Cross69452e12023-11-15 11:20:53 -0800719
720 if m.Config().KatiEnabled() {
721 // When creating the symlink rule in Soong but embedding in Make, write the rule to a
722 // makefile instead of directly to the ninja file so that main.mk can add the
723 // dependencies from the `required` property that are hard to resolve in Soong.
724 m.katiSymlinks = append(m.katiSymlinks, katiInstall{
725 from: srcPath,
726 to: fullInstallPath,
727 })
728 } else {
729 // The symlink doesn't need updating when the target is modified, but we sometimes
730 // have a dependency on a symlink to a binary instead of to the binary directly, and
731 // the mtime of the symlink must be updated when the binary is modified, so use a
732 // normal dependency here instead of an order-only dependency.
733 m.Build(pctx, BuildParams{
Spandan Das4d78e012025-01-22 23:25:39 +0000734 Rule: SymlinkWithBash,
Colin Cross69452e12023-11-15 11:20:53 -0800735 Description: "install symlink " + fullInstallPath.Base(),
736 Output: fullInstallPath,
737 Input: srcPath,
Colin Cross69452e12023-11-15 11:20:53 -0800738 Args: map[string]string{
739 "fromPath": relPath,
740 },
741 })
742 }
743
744 m.installFiles = append(m.installFiles, fullInstallPath)
Colin Cross69452e12023-11-15 11:20:53 -0800745 }
746
Spandan Dasc1ded7e2024-11-01 00:52:33 +0000747 owner, overrides := m.getOwnerAndOverrides()
Colin Cross69452e12023-11-15 11:20:53 -0800748 m.packagingSpecs = append(m.packagingSpecs, PackagingSpec{
749 relPathInPackage: Rel(m, fullInstallPath.PartitionDir(), fullInstallPath.String()),
750 srcPath: nil,
751 symlinkTarget: relPath,
752 executable: false,
753 partition: fullInstallPath.partition,
Jiyong Park4152b192024-04-30 21:24:21 +0900754 skipInstall: m.skipInstall(),
Colin Cross7ceb14a2024-10-30 11:40:21 -0700755 aconfigPaths: m.getAconfigPaths(),
Jiyong Parkc6a773d2024-05-14 21:49:11 +0900756 archType: m.target.Arch.ArchType,
Colin Cross7ceb14a2024-10-30 11:40:21 -0700757 overrides: &overrides,
Spandan Dasc1ded7e2024-11-01 00:52:33 +0000758 owner: owner,
Colin Cross69452e12023-11-15 11:20:53 -0800759 })
760
761 return fullInstallPath
762}
763
764// installPath/name -> absPath where absPath might be a path that is available only at runtime
765// (e.g. /apex/...)
766func (m *moduleContext) InstallAbsoluteSymlink(installPath InstallPath, name string, absPath string) InstallPath {
767 fullInstallPath := installPath.Join(m, name)
768 m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true)
769
Jiyong Park3f627e62024-05-01 16:14:38 +0900770 if m.requiresFullInstall() {
Colin Cross69452e12023-11-15 11:20:53 -0800771 if m.Config().KatiEnabled() {
772 // When creating the symlink rule in Soong but embedding in Make, write the rule to a
773 // makefile instead of directly to the ninja file so that main.mk can add the
774 // dependencies from the `required` property that are hard to resolve in Soong.
775 m.katiSymlinks = append(m.katiSymlinks, katiInstall{
776 absFrom: absPath,
777 to: fullInstallPath,
778 })
779 } else {
780 m.Build(pctx, BuildParams{
781 Rule: Symlink,
782 Description: "install symlink " + fullInstallPath.Base() + " -> " + absPath,
783 Output: fullInstallPath,
Colin Cross69452e12023-11-15 11:20:53 -0800784 Args: map[string]string{
785 "fromPath": absPath,
786 },
787 })
788 }
789
790 m.installFiles = append(m.installFiles, fullInstallPath)
791 }
792
Spandan Dasc1ded7e2024-11-01 00:52:33 +0000793 owner, overrides := m.getOwnerAndOverrides()
Colin Cross69452e12023-11-15 11:20:53 -0800794 m.packagingSpecs = append(m.packagingSpecs, PackagingSpec{
795 relPathInPackage: Rel(m, fullInstallPath.PartitionDir(), fullInstallPath.String()),
796 srcPath: nil,
797 symlinkTarget: absPath,
798 executable: false,
799 partition: fullInstallPath.partition,
Jiyong Park4152b192024-04-30 21:24:21 +0900800 skipInstall: m.skipInstall(),
Colin Cross7ceb14a2024-10-30 11:40:21 -0700801 aconfigPaths: m.getAconfigPaths(),
Jiyong Parkc6a773d2024-05-14 21:49:11 +0900802 archType: m.target.Arch.ArchType,
Colin Cross7ceb14a2024-10-30 11:40:21 -0700803 overrides: &overrides,
Spandan Dasc1ded7e2024-11-01 00:52:33 +0000804 owner: owner,
Colin Cross69452e12023-11-15 11:20:53 -0800805 })
806
807 return fullInstallPath
808}
809
Colin Cross5c1d5fb2023-11-15 12:39:40 -0800810func (m *moduleContext) InstallTestData(installPath InstallPath, data []DataPath) InstallPaths {
811 m.testData = append(m.testData, data...)
812
813 ret := make(InstallPaths, 0, len(data))
814 for _, d := range data {
815 relPath := d.ToRelativeInstallPath()
Colin Crossa6182ab2024-08-21 10:47:44 -0700816 installed := m.installFile(installPath, relPath, d.SrcPath, nil, false, false, true, nil)
Colin Cross5c1d5fb2023-11-15 12:39:40 -0800817 ret = append(ret, installed)
818 }
819
820 return ret
821}
822
Colin Crossa6182ab2024-08-21 10:47:44 -0700823// CheckbuildFile specifies the output files that should be built by checkbuild.
824func (m *moduleContext) CheckbuildFile(srcPaths ...Path) {
825 m.checkbuildFiles = append(m.checkbuildFiles, srcPaths...)
826}
827
828// UncheckedModule marks the current module has having no files that should be built by checkbuild.
829func (m *moduleContext) UncheckedModule() {
830 m.uncheckedModule = true
Colin Cross69452e12023-11-15 11:20:53 -0800831}
832
Colin Cross1496fb12024-09-09 16:44:10 -0700833func (m *moduleContext) BlueprintModuleContext() blueprint.ModuleContext {
Colin Cross69452e12023-11-15 11:20:53 -0800834 return m.bp
835}
836
837func (m *moduleContext) LicenseMetadataFile() Path {
Yu Liuec810542024-08-26 18:09:15 +0000838 return m.licenseMetadataFile
Colin Cross69452e12023-11-15 11:20:53 -0800839}
840
Colin Crossd6fd0132023-11-06 13:54:06 -0800841func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON {
Yu Liu4297ad92024-08-27 19:50:13 +0000842 if moduleInfoJSON := m.moduleInfoJSON; moduleInfoJSON != nil {
Colin Crossd6fd0132023-11-06 13:54:06 -0800843 return moduleInfoJSON
844 }
845 moduleInfoJSON := &ModuleInfoJSON{}
Yu Liu4297ad92024-08-27 19:50:13 +0000846 m.moduleInfoJSON = moduleInfoJSON
Colin Crossd6fd0132023-11-06 13:54:06 -0800847 return moduleInfoJSON
848}
849
mrziwange6c85812024-05-22 14:36:09 -0700850func (m *moduleContext) SetOutputFiles(outputFiles Paths, tag string) {
Cole Faust5146e782024-11-15 14:47:49 -0800851 for _, outputFile := range outputFiles {
852 if outputFile == nil {
853 panic("outputfiles cannot be nil")
854 }
855 }
mrziwange6c85812024-05-22 14:36:09 -0700856 if tag == "" {
Yu Liu876b7ce2024-08-21 18:20:13 +0000857 if len(m.outputFiles.DefaultOutputFiles) > 0 {
mrziwange6c85812024-05-22 14:36:09 -0700858 m.ModuleErrorf("Module %s default OutputFiles cannot be overwritten", m.ModuleName())
859 }
Yu Liu876b7ce2024-08-21 18:20:13 +0000860 m.outputFiles.DefaultOutputFiles = outputFiles
mrziwange6c85812024-05-22 14:36:09 -0700861 } else {
Yu Liu876b7ce2024-08-21 18:20:13 +0000862 if m.outputFiles.TaggedOutputFiles == nil {
863 m.outputFiles.TaggedOutputFiles = make(map[string]Paths)
mrziwang57768d72024-06-06 11:31:51 -0700864 }
Yu Liu876b7ce2024-08-21 18:20:13 +0000865 if _, exists := m.outputFiles.TaggedOutputFiles[tag]; exists {
mrziwange6c85812024-05-22 14:36:09 -0700866 m.ModuleErrorf("Module %s OutputFiles at tag %s cannot be overwritten", m.ModuleName(), tag)
867 } else {
Yu Liu876b7ce2024-08-21 18:20:13 +0000868 m.outputFiles.TaggedOutputFiles[tag] = outputFiles
mrziwange6c85812024-05-22 14:36:09 -0700869 }
870 }
871}
872
Yu Liu876b7ce2024-08-21 18:20:13 +0000873func (m *moduleContext) GetOutputFiles() OutputFilesInfo {
874 return m.outputFiles
875}
876
Yu Liubad1eef2024-08-21 22:37:35 +0000877func (m *moduleContext) SetLicenseInstallMap(installMap []string) {
878 m.licenseInstallMap = append(m.licenseInstallMap, installMap...)
879}
880
Wei Lia1aa2972024-06-21 13:08:51 -0700881func (m *moduleContext) ComplianceMetadataInfo() *ComplianceMetadataInfo {
Yu Liu9a993132024-08-27 23:21:06 +0000882 if m.complianceMetadataInfo == nil {
883 m.complianceMetadataInfo = NewComplianceMetadataInfo()
Wei Lia1aa2972024-06-21 13:08:51 -0700884 }
Yu Liu9a993132024-08-27 23:21:06 +0000885 return m.complianceMetadataInfo
Wei Lia1aa2972024-06-21 13:08:51 -0700886}
887
Colin Cross69452e12023-11-15 11:20:53 -0800888// Returns a list of paths expanded from globs and modules referenced using ":module" syntax. The property must
889// be tagged with `android:"path" to support automatic source module dependency resolution.
890//
891// Deprecated: use PathsForModuleSrc or PathsForModuleSrcExcludes instead.
892func (m *moduleContext) ExpandSources(srcFiles, excludes []string) Paths {
893 return PathsForModuleSrcExcludes(m, srcFiles, excludes)
894}
895
896// Returns a single path expanded from globs and modules referenced using ":module" syntax. The property must
897// be tagged with `android:"path" to support automatic source module dependency resolution.
898//
899// Deprecated: use PathForModuleSrc instead.
900func (m *moduleContext) ExpandSource(srcFile, _ string) Path {
901 return PathForModuleSrc(m, srcFile)
902}
903
904// Returns an optional single path expanded from globs and modules referenced using ":module" syntax if
905// the srcFile is non-nil. The property must be tagged with `android:"path" to support automatic source module
906// dependency resolution.
907func (m *moduleContext) ExpandOptionalSource(srcFile *string, _ string) OptionalPath {
908 if srcFile != nil {
909 return OptionalPathForPath(PathForModuleSrc(m, *srcFile))
910 }
911 return OptionalPath{}
912}
913
Cole Fauste8a87832024-09-11 11:35:46 -0700914func (m *moduleContext) RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string {
Cole Faust43ddd082024-06-17 12:32:40 -0700915 return m.module.RequiredModuleNames(ctx)
Colin Cross69452e12023-11-15 11:20:53 -0800916}
917
918func (m *moduleContext) HostRequiredModuleNames() []string {
919 return m.module.HostRequiredModuleNames()
920}
921
922func (m *moduleContext) TargetRequiredModuleNames() []string {
923 return m.module.TargetRequiredModuleNames()
924}
Yu Liu9a993132024-08-27 23:21:06 +0000925
926func (m *moduleContext) getContainersInfo() ContainersInfo {
927 return m.containersInfo
928}
929
930func (m *moduleContext) setContainersInfo(info ContainersInfo) {
931 m.containersInfo = info
932}