|
| 1 | +package core |
| 2 | + |
| 3 | +import ( |
| 4 | + "path/filepath" |
| 5 | + |
| 6 | + "github.com/ARM-software/bob-build/core/file" |
| 7 | + "github.com/ARM-software/bob-build/core/module" |
| 8 | + "github.com/ARM-software/bob-build/core/toolchain" |
| 9 | + "github.com/google/blueprint" |
| 10 | +) |
| 11 | + |
| 12 | +type ImportCCBinaryProps struct { |
| 13 | + Src string |
| 14 | + Target toolchain.TgtType |
| 15 | +} |
| 16 | + |
| 17 | +type ModuleImportCCBinary struct { |
| 18 | + module.ModuleBase |
| 19 | + Properties struct { |
| 20 | + SplittableProps |
| 21 | + ImportCCBinaryProps |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +var _ splittable = (*ModuleImportCCBinary)(nil) |
| 26 | +var _ file.Provider = (*ModuleImportCCBinary)(nil) |
| 27 | + |
| 28 | +func importCCBinaryFactory(config *BobConfig) (blueprint.Module, []interface{}) { |
| 29 | + module := &ModuleImportCCBinary{} |
| 30 | + |
| 31 | + return module, []interface{}{&module.Properties, &module.SimpleName.Properties} |
| 32 | +} |
| 33 | + |
| 34 | +func (g *linuxGenerator) importCCBinaryActions(m *ModuleImportCCBinary, ctx blueprint.ModuleContext) { |
| 35 | + addPhony(m, ctx, file.GetOutputs(m), false) |
| 36 | +} |
| 37 | + |
| 38 | +func (g *androidNinjaGenerator) importCCBinaryActions(m *ModuleImportCCBinary, ctx blueprint.ModuleContext) { |
| 39 | + |
| 40 | +} |
| 41 | + |
| 42 | +func (g *androidBpGenerator) importCCBinaryActions(m *ModuleImportCCBinary, ctx blueprint.ModuleContext) { |
| 43 | + |
| 44 | +} |
| 45 | + |
| 46 | +func (m *ModuleImportCCBinary) GenerateBuildActions(ctx blueprint.ModuleContext) { |
| 47 | + getGenerator(ctx).importCCBinaryActions(m, ctx) |
| 48 | +} |
| 49 | + |
| 50 | +func (m *ModuleImportCCBinary) outputFileName() string { |
| 51 | + return m.Name() |
| 52 | +} |
| 53 | + |
| 54 | +func (m *ModuleImportCCBinary) shortName() string { |
| 55 | + return m.Name() |
| 56 | +} |
| 57 | + |
| 58 | +func (m *ModuleImportCCBinary) processPaths(ctx blueprint.BaseModuleContext) { |
| 59 | + m.Properties.Src = filepath.Join(projectModuleDir(ctx), m.Properties.Src) |
| 60 | +} |
| 61 | + |
| 62 | +func (m *ModuleImportCCBinary) OutFiles() file.Paths { |
| 63 | + return file.Paths{ |
| 64 | + file.NewPath( |
| 65 | + m.Properties.Src, |
| 66 | + file.FileNoNameSpace, |
| 67 | + file.TypeSrc|file.TypeInstallable, |
| 68 | + ), |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +func (m *ModuleImportCCBinary) OutFileTargets() (tgts []string) { |
| 73 | + return |
| 74 | +} |
| 75 | + |
| 76 | +// Support Splittable properties |
| 77 | +func (m *ModuleImportCCBinary) supportedVariants() []toolchain.TgtType { |
| 78 | + return []toolchain.TgtType{m.Properties.Target} |
| 79 | +} |
| 80 | + |
| 81 | +func (m *ModuleImportCCBinary) setVariant(variant toolchain.TgtType) { |
| 82 | + // No need to actually track this, as a single target is always supported |
| 83 | +} |
| 84 | + |
| 85 | +func (m *ModuleImportCCBinary) disable() { |
| 86 | + // This should never actually be called, as we will always support one target |
| 87 | + panic("disable() called on ModuleImportCCBinary") |
| 88 | +} |
| 89 | + |
| 90 | +func (m *ModuleImportCCBinary) getSplittableProps() *SplittableProps { |
| 91 | + return &m.Properties.SplittableProps |
| 92 | +} |
| 93 | + |
| 94 | +func (m *ModuleImportCCBinary) getTarget() toolchain.TgtType { |
| 95 | + return m.Properties.Target |
| 96 | +} |
| 97 | + |
| 98 | +// End Support Splittable properties |
0 commit comments