func (s *SketchSourceMerger) Run(ctx *types.Context) error { sketch := ctx.Sketch lineOffset := 0 includeSection := "" if !sketchIncludesArduinoH(&sketch.MainFile) { includeSection += "#include <Arduino.h>\n" lineOffset++ } includeSection += "#line 1 " + utils.QuoteCppString(sketch.MainFile.Name) + "\n" lineOffset++ ctx.IncludeSection = includeSection source := includeSection source += addSourceWrappedWithLineDirective(&sketch.MainFile) lineOffset += 1 for _, file := range sketch.OtherSketchFiles { source += addSourceWrappedWithLineDirective(&file) } ctx.LineOffset = lineOffset ctx.Source = source return nil }
func (s *PrintUsedAndNotUsedLibraries) Run(ctx *types.Context) error { var logLevel string // Print this message as warning when the sketch didn't compile, // as info when we're verbose and not all otherwise if s.SketchError { logLevel = constants.LOG_LEVEL_WARN } else if ctx.Verbose { logLevel = constants.LOG_LEVEL_INFO } else { return nil } logger := ctx.GetLogger() libraryResolutionResults := ctx.LibrariesResolutionResults for header, libResResult := range libraryResolutionResults { logger.Fprintln(os.Stdout, logLevel, constants.MSG_LIBRARIES_MULTIPLE_LIBS_FOUND_FOR, header) logger.Fprintln(os.Stdout, logLevel, constants.MSG_LIBRARIES_USED, libResResult.Library.Folder) for _, notUsedLibrary := range libResResult.NotUsedLibraries { logger.Fprintln(os.Stdout, logLevel, constants.MSG_LIBRARIES_NOT_USED, notUsedLibrary.Folder) } } time.Sleep(100 * time.Millisecond) return nil }
func (s *IncludesToIncludeFolders) Run(ctx *types.Context) error { includes := ctx.Includes headerToLibraries := ctx.HeaderToLibraries platform := ctx.TargetPlatform actualPlatform := ctx.ActualPlatform libraryResolutionResults := ctx.LibrariesResolutionResults importedLibraries := ctx.ImportedLibraries newlyImportedLibraries, err := resolveLibraries(includes, headerToLibraries, importedLibraries, []*types.Platform{actualPlatform, platform}, libraryResolutionResults) if err != nil { return i18n.WrapError(err) } foldersWithSources := ctx.FoldersWithSourceFiles for _, newlyImportedLibrary := range newlyImportedLibraries { if !sliceContainsLibrary(importedLibraries, newlyImportedLibrary) { importedLibraries = append(importedLibraries, newlyImportedLibrary) sourceFolders := types.LibraryToSourceFolder(newlyImportedLibrary) for _, sourceFolder := range sourceFolders { foldersWithSources.Push(sourceFolder) } } } ctx.ImportedLibraries = importedLibraries ctx.IncludeFolders = resolveIncludeFolders(newlyImportedLibraries, ctx.BuildProperties, ctx.Verbose) return nil }
func (s *FailIfImportedLibraryIsWrong) Run(ctx *types.Context) error { if len(ctx.ImportedLibraries) == 0 { return nil } logger := ctx.GetLogger() for _, library := range ctx.ImportedLibraries { if !library.IsLegacy { if stat, err := os.Stat(filepath.Join(library.Folder, constants.LIBRARY_FOLDER_ARCH)); err == nil && stat.IsDir() { return i18n.ErrorfWithLogger(logger, constants.MSG_ARCH_FOLDER_NOT_SUPPORTED) } for _, propName := range LIBRARY_MANDATORY_PROPERTIES { if _, ok := library.Properties[propName]; !ok { return i18n.ErrorfWithLogger(logger, constants.MSG_PROP_IN_LIBRARY, propName, library.Folder) } } if library.Layout == types.LIBRARY_RECURSIVE { if stat, err := os.Stat(filepath.Join(library.Folder, constants.LIBRARY_FOLDER_UTILITY)); err == nil && stat.IsDir() { return i18n.ErrorfWithLogger(logger, constants.MSG_LIBRARY_CAN_USE_SRC_AND_UTILITY_FOLDERS, library.Folder) } } } } return nil }
func (s *RecipeByPrefixSuffixRunner) Run(ctx *types.Context) error { logger := ctx.GetLogger() if ctx.DebugLevel >= 10 { logger.Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, constants.MSG_LOOKING_FOR_RECIPES, s.Prefix, s.Suffix) } buildProperties := ctx.BuildProperties.Clone() verbose := ctx.Verbose recipes := findRecipes(buildProperties, s.Prefix, s.Suffix) properties := buildProperties.Clone() for _, recipe := range recipes { if ctx.DebugLevel >= 10 { logger.Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, constants.MSG_RUNNING_RECIPE, recipe) } _, err := builder_utils.ExecRecipe(properties, recipe, false, verbose, verbose, logger) if err != nil { return i18n.WrapError(err) } } return nil }
func (s *WarnAboutPlatformRewrites) Run(ctx *types.Context) error { if ctx.DebugLevel < 0 { return nil } logger := ctx.GetLogger() hardwareRewriteResults := ctx.HardwareRewriteResults targetPlatform := ctx.TargetPlatform actualPlatform := ctx.ActualPlatform platforms := []*types.Platform{targetPlatform} if actualPlatform != targetPlatform { platforms = append(platforms, actualPlatform) } for _, platform := range platforms { if hardwareRewriteResults[platform] != nil { for _, rewrite := range hardwareRewriteResults[platform] { logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_WARNING_PLATFORM_OLD_VALUES, platform.Properties[constants.PLATFORM_NAME], rewrite.Key+"="+rewrite.OldValue, rewrite.Key+"="+rewrite.NewValue) } } } return nil }
func (s *Linker) Run(ctx *types.Context) error { objectFilesSketch := ctx.SketchObjectFiles objectFilesLibraries := ctx.LibrariesObjectFiles objectFilesCore := ctx.CoreObjectsFiles var objectFiles []string objectFiles = append(objectFiles, objectFilesSketch...) objectFiles = append(objectFiles, objectFilesLibraries...) objectFiles = append(objectFiles, objectFilesCore...) coreArchiveFilePath := ctx.CoreArchiveFilePath buildPath := ctx.BuildPath coreDotARelPath, err := filepath.Rel(buildPath, coreArchiveFilePath) if err != nil { return i18n.WrapError(err) } buildProperties := ctx.BuildProperties verbose := ctx.Verbose warningsLevel := ctx.WarningsLevel logger := ctx.GetLogger() err = link(objectFiles, coreDotARelPath, coreArchiveFilePath, buildProperties, verbose, warningsLevel, logger) if err != nil { return i18n.WrapError(err) } return nil }
func (s *SketchBuilder) Run(ctx *types.Context) error { sketchBuildPath := ctx.SketchBuildPath buildProperties := ctx.BuildProperties includes := ctx.IncludeFolders includes = utils.Map(includes, utils.WrapWithHyphenI) verbose := ctx.Verbose warningsLevel := ctx.WarningsLevel logger := ctx.GetLogger() err := utils.EnsureFolderExists(sketchBuildPath) if err != nil { return i18n.WrapError(err) } var objectFiles []string objectFiles, err = builder_utils.CompileFiles(objectFiles, sketchBuildPath, false, sketchBuildPath, buildProperties, includes, verbose, warningsLevel, logger) if err != nil { return i18n.WrapError(err) } // The "src/" subdirectory of a sketch is compiled recursively sketchSrcPath := filepath.Join(sketchBuildPath, constants.SKETCH_FOLDER_SRC) if info, err := os.Stat(sketchSrcPath); err == nil && info.IsDir() { objectFiles, err = builder_utils.CompileFiles(objectFiles, sketchSrcPath, true, sketchSrcPath, buildProperties, includes, verbose, warningsLevel, logger) if err != nil { return i18n.WrapError(err) } } ctx.SketchObjectFiles = objectFiles return nil }
func (s *CTagsRunner) Run(ctx *types.Context) error { buildProperties := ctx.BuildProperties ctagsTargetFilePath := ctx.CTagsTargetFile logger := ctx.GetLogger() properties := buildProperties.Clone() properties.Merge(buildProperties.SubTree(constants.BUILD_PROPERTIES_TOOLS_KEY).SubTree(constants.CTAGS)) properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = ctagsTargetFilePath pattern := properties[constants.BUILD_PROPERTIES_PATTERN] if pattern == constants.EMPTY_STRING { return i18n.ErrorfWithLogger(logger, constants.MSG_PATTERN_MISSING, constants.CTAGS) } commandLine := properties.ExpandPropsInString(pattern) command, err := utils.PrepareCommand(commandLine, logger) if err != nil { return i18n.WrapError(err) } verbose := ctx.Verbose if verbose { fmt.Println(commandLine) } sourceBytes, err := command.Output() if err != nil { return i18n.WrapError(err) } ctx.CTagsOutput = string(sourceBytes) return nil }
func (s *WarnAboutArchIncompatibleLibraries) Run(ctx *types.Context) error { if ctx.DebugLevel < 0 { return nil } targetPlatform := ctx.TargetPlatform buildProperties := ctx.BuildProperties logger := ctx.GetLogger() archs := []string{} archs = append(archs, targetPlatform.PlatformId) if buildProperties[constants.BUILD_PROPERTIES_ARCH_OVERRIDE_CHECK] != constants.EMPTY_STRING { overrides := strings.Split(buildProperties[constants.BUILD_PROPERTIES_ARCH_OVERRIDE_CHECK], ",") for _, override := range overrides { archs = append(archs, override) } } for _, importedLibrary := range ctx.ImportedLibraries { if !importedLibrary.SupportsArchitectures(archs) { logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_LIBRARY_INCOMPATIBLE_ARCH, importedLibrary.Name, importedLibrary.Archs, archs) } } return nil }
func printProgressIfProgressEnabledAndMachineLogger(progressEnabled bool, ctx *types.Context, progress float32) { if !progressEnabled { return } log := ctx.GetLogger() if log.Name() == "machine" { log.Println(constants.LOG_LEVEL_INFO, constants.MSG_PROGRESS, strconv.FormatFloat(float64(progress), 'f', 2, 32)) } }
func (s *HardwareLoader) Run(ctx *types.Context) error { logger := ctx.GetLogger() packages := &types.Packages{} packages.Packages = make(map[string]*types.Package) packages.Properties = make(map[string]string) folders := ctx.HardwareFolders folders, err := utils.AbsolutizePaths(folders) if err != nil { return i18n.WrapError(err) } for _, folder := range folders { stat, err := os.Stat(folder) if err != nil { return i18n.WrapError(err) } if !stat.IsDir() { return i18n.ErrorfWithLogger(logger, constants.MSG_MUST_BE_A_FOLDER, folder) } hardwarePlatformTxt, err := props.SafeLoad(filepath.Join(folder, constants.FILE_PLATFORM_TXT), logger) if err != nil { return i18n.WrapError(err) } packages.Properties.Merge(hardwarePlatformTxt) subfolders, err := utils.ReadDirFiltered(folder, utils.FilterDirs) if err != nil { return i18n.WrapError(err) } subfolders = utils.FilterOutFoldersByNames(subfolders, constants.FOLDER_TOOLS) for _, subfolder := range subfolders { subfolderPath := filepath.Join(folder, subfolder.Name()) packageId := subfolder.Name() if _, err := os.Stat(filepath.Join(subfolderPath, constants.FOLDER_HARDWARE)); err == nil { subfolderPath = filepath.Join(subfolderPath, constants.FOLDER_HARDWARE) } targetPackage := getOrCreatePackage(packages, packageId) err = loadPackage(targetPackage, subfolderPath, logger) if err != nil { return i18n.WrapError(err) } packages.Packages[packageId] = targetPackage } } ctx.Hardware = packages return nil }
func (s *CreateBuildOptionsMap) Run(ctx *types.Context) error { buildOptions := ctx.ExtractBuildOptions() bytes, err := json.MarshalIndent(buildOptions, "", " ") if err != nil { return i18n.WrapError(err) } ctx.BuildOptionsJson = string(bytes) return nil }
func (s *CTagsToPrototypes) Run(ctx *types.Context) error { tags := ctx.CTagsCollected lineWhereToInsertPrototypes := findLineWhereToInsertPrototypes(tags) if lineWhereToInsertPrototypes != -1 { ctx.PrototypesLineWhereToInsert = lineWhereToInsertPrototypes } ctx.Prototypes = toPrototypes(tags) return nil }
func skipTagsWhere(tags []*types.CTag, skipFunc skipFuncType, ctx *types.Context) { for _, tag := range tags { if !tag.SkipMe { skip := skipFunc(tag) if skip && ctx.DebugLevel >= 10 { ctx.GetLogger().Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, constants.MSG_SKIPPING_TAG_WITH_REASON, tag.FunctionName, runtime.FuncForPC(reflect.ValueOf(skipFunc).Pointer()).Name()) } tag.SkipMe = skip } } }
func (s *IncludesFinderWithRegExp) Run(ctx *types.Context) error { source := *s.Source match := INCLUDE_REGEXP.FindStringSubmatch(source) if match != nil { ctx.IncludeJustFound = strings.TrimSpace(match[1]) } else { ctx.IncludeJustFound = findIncludeForOldCompilers(source) } return nil }
func (s *SetCustomBuildProperties) Run(ctx *types.Context) error { logger := ctx.GetLogger() buildProperties := ctx.BuildProperties customBuildProperties, err := props.LoadFromSlice(ctx.CustomBuildProperties, logger) if err != nil { return i18n.WrapError(err) } for key, value := range customBuildProperties { buildProperties[key] = value } return nil }
func findIncludesUntilDone(ctx *types.Context, sourceFilePath string) error { targetFilePath := utils.NULLFile() importedLibraries := ctx.ImportedLibraries done := false for !done { commands := []types.Command{ &GCCPreprocRunnerForDiscoveringIncludes{SourceFilePath: sourceFilePath, TargetFilePath: targetFilePath}, &IncludesFinderWithRegExp{Source: &ctx.SourceGccMinusE}, &IncludesToIncludeFolders{}, } for _, command := range commands { err := runCommand(ctx, command) if err != nil { return i18n.WrapError(err) } } if len(ctx.IncludesJustFound) == 0 { done = true } else if len(ctx.ImportedLibraries) == len(importedLibraries) { err := runCommand(ctx, &GCCPreprocRunner{TargetFileName: constants.FILE_CTAGS_TARGET_FOR_GCC_MINUS_E}) return i18n.WrapError(err) } importedLibraries = ctx.ImportedLibraries ctx.IncludesJustFound = []string{} } return nil }
func tryPreprocessWithContext(t *testing.T, ctx *types.Context, sketchPath ...string) { sketchLocation := filepath.Join(sketchPath...) ctx.SketchLocation = sketchLocation err := builder.RunPreprocess(ctx) NoError(t, err, "Build error for "+sketchLocation) }
func (s *ToolsLoader) Run(ctx *types.Context) error { folders := ctx.ToolsFolders tools := []*types.Tool{} for _, folder := range folders { builtinToolsVersionsFile, err := findBuiltinToolsVersionsFile(folder) if err != nil { return i18n.WrapError(err) } if builtinToolsVersionsFile != constants.EMPTY_STRING { err = loadToolsFrom(&tools, builtinToolsVersionsFile) if err != nil { return i18n.WrapError(err) } } else { subfolders, err := collectAllToolsFolders(folder) if err != nil { return i18n.WrapError(err) } for _, subfolder := range subfolders { err = loadToolsFromFolderStructure(&tools, subfolder) if err != nil { return i18n.WrapError(err) } } } } ctx.Tools = tools return nil }
func removeDefinedProtypes(tags []*types.CTag, ctx *types.Context) { definedPrototypes := make(map[string]bool) for _, tag := range tags { if tag.Kind == KIND_PROTOTYPE { definedPrototypes[tag.Prototype] = true } } for _, tag := range tags { if definedPrototypes[tag.Prototype] { if ctx.DebugLevel >= 10 { ctx.GetLogger().Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, constants.MSG_SKIPPING_TAG_ALREADY_DEFINED, tag.FunctionName) } tag.SkipMe = true } } }
func (s *AddBuildBoardPropertyIfMissing) Run(ctx *types.Context) error { packages := ctx.Hardware logger := ctx.GetLogger() for _, aPackage := range packages.Packages { for _, platform := range aPackage.Platforms { for _, board := range platform.Boards { if board.Properties[constants.BUILD_PROPERTIES_BUILD_BOARD] == constants.EMPTY_STRING { board.Properties[constants.BUILD_PROPERTIES_BUILD_BOARD] = strings.ToUpper(platform.PlatformId + "_" + board.BoardId) logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_MISSING_BUILD_BOARD, aPackage.PackageId, platform.PlatformId, board.BoardId, board.Properties[constants.BUILD_PROPERTIES_BUILD_BOARD]) } } } } return nil }
func (s *Sizer) Run(ctx *types.Context) error { if s.SketchError { return nil } buildProperties := ctx.BuildProperties verbose := ctx.Verbose warningsLevel := ctx.WarningsLevel logger := ctx.GetLogger() err := checkSize(buildProperties, verbose, warningsLevel, logger) if err != nil { return i18n.WrapError(err) } return nil }
func (s *IncludesFinderWithRegExp) Run(ctx *types.Context) error { source := *s.Source matches := INCLUDE_REGEXP.FindAllStringSubmatch(source, -1) includes := []string{} for _, match := range matches { includes = append(includes, strings.TrimSpace(match[1])) } if len(includes) == 0 { include := findIncludesForOldCompilers(source) if include != "" { includes = append(includes, include) } } ctx.IncludesJustFound = includes ctx.Includes = utils.AppendIfNotPresent(ctx.Includes, includes...) return nil }
func (s *MergeSketchWithBootloader) Run(ctx *types.Context) error { buildProperties := ctx.BuildProperties if !utils.MapStringStringHas(buildProperties, constants.BUILD_PROPERTIES_BOOTLOADER_NOBLINK) && !utils.MapStringStringHas(buildProperties, constants.BUILD_PROPERTIES_BOOTLOADER_FILE) { return nil } buildPath := ctx.BuildPath sketch := ctx.Sketch sketchFileName := filepath.Base(sketch.MainFile.Name) logger := ctx.GetLogger() sketchInBuildPath := filepath.Join(buildPath, sketchFileName+".hex") sketchInSubfolder := filepath.Join(buildPath, constants.FOLDER_SKETCH, sketchFileName+".hex") builtSketchPath := constants.EMPTY_STRING if _, err := os.Stat(sketchInBuildPath); err == nil { builtSketchPath = sketchInBuildPath } else if _, err := os.Stat(sketchInSubfolder); err == nil { builtSketchPath = sketchInSubfolder } else { return nil } bootloader := constants.EMPTY_STRING if utils.MapStringStringHas(buildProperties, constants.BUILD_PROPERTIES_BOOTLOADER_NOBLINK) { bootloader = buildProperties[constants.BUILD_PROPERTIES_BOOTLOADER_NOBLINK] } else { bootloader = buildProperties[constants.BUILD_PROPERTIES_BOOTLOADER_FILE] } bootloader = buildProperties.ExpandPropsInString(bootloader) bootloaderPath := filepath.Join(buildProperties[constants.BUILD_PROPERTIES_RUNTIME_PLATFORM_PATH], constants.FOLDER_BOOTLOADERS, bootloader) if _, err := os.Stat(bootloaderPath); err != nil { logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_BOOTLOADER_FILE_MISSING, bootloaderPath) return nil } mergedSketchPath := filepath.Join(filepath.Dir(builtSketchPath), sketchFileName+".with_bootloader.hex") err := merge(builtSketchPath, bootloaderPath, mergedSketchPath) return err }
func (s *SketchLoader) Run(ctx *types.Context) error { if ctx.SketchLocation == "" { return nil } sketchLocation := ctx.SketchLocation sketchLocation, err := filepath.Abs(sketchLocation) if err != nil { return i18n.WrapError(err) } mainSketchStat, err := os.Stat(sketchLocation) if err != nil { return i18n.WrapError(err) } if mainSketchStat.IsDir() { sketchLocation = filepath.Join(sketchLocation, mainSketchStat.Name()+".ino") } ctx.SketchLocation = sketchLocation allSketchFilePaths, err := collectAllSketchFiles(filepath.Dir(sketchLocation)) if err != nil { return i18n.WrapError(err) } logger := ctx.GetLogger() if !utils.SliceContains(allSketchFilePaths, sketchLocation) { return i18n.ErrorfWithLogger(logger, constants.MSG_CANT_FIND_SKETCH_IN_PATH, sketchLocation, filepath.Dir(sketchLocation)) } sketch, err := makeSketch(sketchLocation, allSketchFilePaths, logger) if err != nil { return i18n.WrapError(err) } ctx.SketchLocation = sketchLocation ctx.Sketch = sketch return nil }
func (s *PrototypesAdder) Run(ctx *types.Context) error { debugOutput := ctx.DebugPreprocessor source := ctx.Source source = strings.Replace(source, "\r\n", "\n", -1) source = strings.Replace(source, "\r", "\n", -1) sourceRows := strings.Split(source, "\n") firstFunctionLine := ctx.PrototypesLineWhereToInsert if isFirstFunctionOutsideOfSource(firstFunctionLine, sourceRows) { return nil } insertionLine := firstFunctionLine + ctx.LineOffset - 1 firstFunctionChar := len(strings.Join(sourceRows[:insertionLine], "\n")) + 1 prototypeSection := composePrototypeSection(firstFunctionLine, ctx.Prototypes) ctx.PrototypesSection = prototypeSection source = source[:firstFunctionChar] + prototypeSection + source[firstFunctionChar:] if debugOutput { fmt.Println("#PREPROCESSED SOURCE") prototypesRows := strings.Split(prototypeSection, "\n") prototypesRows = prototypesRows[:len(prototypesRows)-1] for i := 0; i < len(sourceRows)+len(prototypesRows); i++ { if i < insertionLine { fmt.Printf(" |%s\n", sourceRows[i]) } else if i < insertionLine+len(prototypesRows) { fmt.Printf("PRO|%s\n", prototypesRows[i-insertionLine]) } else { fmt.Printf(" |%s\n", sourceRows[i-len(prototypesRows)]) } } fmt.Println("#END OF PREPROCESSED SOURCE") } ctx.Source = source return nil }
func (s *PrintUsedAndNotUsedLibraries) Run(ctx *types.Context) error { if ctx.DebugLevel < 0 { return nil } logger := ctx.GetLogger() libraryResolutionResults := ctx.LibrariesResolutionResults for header, libResResult := range libraryResolutionResults { if !libResResult.IsLibraryFromPlatform { logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_LIBRARIES_MULTIPLE_LIBS_FOUND_FOR, header) logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_LIBRARIES_USED, libResResult.Library.Folder) for _, notUsedLibrary := range libResResult.NotUsedLibraries { logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_LIBRARIES_NOT_USED, notUsedLibrary.Folder) } } } time.Sleep(100 * time.Millisecond) return nil }
func (s *GCCPreprocRunner) Run(ctx *types.Context) error { properties, targetFilePath, err := prepareGCCPreprocRecipeProperties(ctx, s.SourceFilePath, s.TargetFileName, s.Includes) if err != nil { return i18n.WrapError(err) } if properties[constants.RECIPE_PREPROC_MACROS] == constants.EMPTY_STRING { //generate PREPROC_MACROS from RECIPE_CPP_PATTERN properties[constants.RECIPE_PREPROC_MACROS] = GeneratePreprocPatternFromCompile(properties[constants.RECIPE_CPP_PATTERN]) } verbose := ctx.Verbose logger := ctx.GetLogger() _, err = builder_utils.ExecRecipe(properties, constants.RECIPE_PREPROC_MACROS, true, verbose, false, logger) if err != nil { return i18n.WrapError(err) } ctx.FileToRead = targetFilePath return nil }
func (s *CoreBuilder) Run(ctx *types.Context) error { coreBuildPath := ctx.CoreBuildPath buildProperties := ctx.BuildProperties verbose := ctx.Verbose warningsLevel := ctx.WarningsLevel logger := ctx.GetLogger() err := utils.EnsureFolderExists(coreBuildPath) if err != nil { return i18n.WrapError(err) } archiveFile, objectFiles, err := compileCore(coreBuildPath, buildProperties, verbose, warningsLevel, logger) if err != nil { return i18n.WrapError(err) } ctx.CoreArchiveFilePath = archiveFile ctx.CoreObjectsFiles = objectFiles return nil }