コード例 #1
0
func (s *AddAdditionalEntriesToContext) Run(ctx *types.Context) error {
	if ctx.BuildPath != "" {
		buildPath := ctx.BuildPath
		preprocPath, err := filepath.Abs(filepath.Join(buildPath, constants.FOLDER_PREPROC))
		if err != nil {
			return i18n.WrapError(err)
		}
		sketchBuildPath, err := filepath.Abs(filepath.Join(buildPath, constants.FOLDER_SKETCH))
		if err != nil {
			return i18n.WrapError(err)
		}
		librariesBuildPath, err := filepath.Abs(filepath.Join(buildPath, constants.FOLDER_LIBRARIES))
		if err != nil {
			return i18n.WrapError(err)
		}
		coreBuildPath, err := filepath.Abs(filepath.Join(buildPath, constants.FOLDER_CORE))
		if err != nil {
			return i18n.WrapError(err)
		}

		ctx.PreprocPath = preprocPath
		ctx.SketchBuildPath = sketchBuildPath
		ctx.LibrariesBuildPath = librariesBuildPath
		ctx.CoreBuildPath = coreBuildPath
	}

	if ctx.WarningsLevel == "" {
		ctx.WarningsLevel = DEFAULT_WARNINGS_LEVEL
	}

	ctx.CollectedSourceFiles = &types.UniqueStringQueue{}
	ctx.FoldersWithSourceFiles = &types.UniqueSourceFolderQueue{}

	ctx.LibrariesResolutionResults = make(map[string]types.LibraryResolutionResult)
	ctx.HardwareRewriteResults = make(map[*types.Platform][]types.PlatforKeyRewrite)

	return nil
}