MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / createComponent

Function createComponent

Source/automaticcomponenttoolkit.go:49–387  ·  view source on GitHub ↗
(component ComponentDefinition, outfolderBase string)

Source from the content-addressed store, hash-verified

47)
48
49func createComponent(component ComponentDefinition, outfolderBase string) (error) {
50
51 log.Printf("Creating Component \"%s\"", component.LibraryName)
52 for _, subComponent := range component.ImportedComponentDefinitions {
53 err := createComponent(subComponent, outfolderBase)
54 if (err != nil) {
55 return err
56 }
57 }
58
59 outputFolder := path.Join(outfolderBase, component.NameSpace+"_component")
60 outputFolderBindings := path.Join(outputFolder, "Bindings")
61 outputFolderExamples := path.Join(outputFolder, "Examples")
62 outputFolderImplementations := path.Join(outputFolder, "Implementations")
63
64 err := os.MkdirAll(outputFolder, os.ModePerm)
65 if err != nil {
66 return err
67 }
68
69 licenseFileName := path.Join(outputFolder, "license.txt")
70 log.Printf("Creating \"%s\"", licenseFileName)
71 licenseFile, err := CreateLanguageFile(licenseFileName, "")
72 if err != nil {
73 return err
74 }
75 licenseFile.WritePlainLicenseHeader(component, "", false)
76
77 if len(component.BindingList.Bindings) > 0 {
78 err = os.MkdirAll(outputFolderBindings, os.ModePerm)
79 if err != nil {
80 return err
81 }
82 }
83 for bindingindex := 0; bindingindex < len(component.BindingList.Bindings); bindingindex++ {
84 binding := component.BindingList.Bindings[bindingindex]
85 indentString := getIndentationString(binding.Indentation)
86 log.Printf("Exporting Interface Binding for Languge \"%s\"", binding.Language)
87
88 switch binding.Language {
89 case "C":
90 {
91 outputFolderBindingC := outputFolderBindings + "/C"
92
93 err = os.MkdirAll(outputFolderBindingC, os.ModePerm)
94 if err != nil {
95 return err
96 }
97
98 err = BuildBindingC(component, outputFolderBindingC)
99 if err != nil {
100 return err
101 }
102 }
103
104 case "CDynamic":
105 {
106 outputFolderBindingCDynamic := outputFolderBindings + "/CDynamic"

Callers 1

mainFunction · 0.85

Calls 15

CreateLanguageFileFunction · 0.85
getIndentationStringFunction · 0.85
BuildBindingCFunction · 0.85
CreateCTypesHeaderFunction · 0.85
BuildBindingCExplicitFunction · 0.85
CreateCPPTypesHeaderFunction · 0.85
CreateCPPAbiHeaderFunction · 0.85
BuildBindingCppExplicitFunction · 0.85
BuildBindingCppImplicitFunction · 0.85
BuildBindingGoFunction · 0.85
BuildBindingNodeFunction · 0.85

Tested by

no test coverage detected