build

package
v0.0.0-...-8366815 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveBuildConfig

func SaveBuildConfig(projectPath, configPath string, config *BuildConfig) error

SaveBuildConfig saves build configuration to file

Types

type AndroidBuildConfig

type AndroidBuildConfig struct {
	Enabled     bool               `yaml:"enabled"`
	BuildTypes  []AndroidBuildType `yaml:"build_types"`
	Environment map[string]string  `yaml:"environment"`
}

AndroidBuildConfig contains Android build configuration

type AndroidBuildType

type AndroidBuildType struct {
	Name        string   `yaml:"name"`
	Type        string   `yaml:"type"`       // apk, appbundle
	BuildMode   string   `yaml:"build_mode"` // release, debug, profile
	SplitPerABI bool     `yaml:"split_per_abi"`
	CustomArgs  []string `yaml:"custom_args"`
}

AndroidBuildType represents an Android build type

type ArtifactFilters

type ArtifactFilters struct {
	Date     string
	Platform string
}

ArtifactFilters contains filters for listing artifacts

type ArtifactManager

type ArtifactManager struct {
	ProjectPath string
	Config      *ArtifactsConfig
}

ArtifactManager manages build artifacts

func NewArtifactManager

func NewArtifactManager(projectPath string, config *ArtifactsConfig) *ArtifactManager

NewArtifactManager creates a new artifact manager

func (*ArtifactManager) CleanAll

func (am *ArtifactManager) CleanAll() error

CleanAll removes all build artifacts

func (*ArtifactManager) CleanOlderThan

func (am *ArtifactManager) CleanOlderThan(duration string) error

CleanOlderThan removes artifacts older than the specified duration

func (*ArtifactManager) GetBuildStatus

func (am *ArtifactManager) GetBuildStatus() (*BuildStatus, error)

GetBuildStatus returns the current build status

func (*ArtifactManager) GetOutputDir

func (am *ArtifactManager) GetOutputDir() string

GetOutputDir returns the base output directory

func (*ArtifactManager) ListArtifacts

func (am *ArtifactManager) ListArtifacts(filters ArtifactFilters) ([]*BuildArtifact, error)

ListArtifacts lists artifacts based on filters

func (*ArtifactManager) OrganizeArtifact

func (am *ArtifactManager) OrganizeArtifact(artifact *BuildArtifact) error

OrganizeArtifact organizes a build artifact into the proper directory structure

type ArtifactsConfig

type ArtifactsConfig struct {
	BaseOutputDir string             `yaml:"base_output_dir"`
	Organization  OrganizationConfig `yaml:"organization"`
	Naming        NamingConfig       `yaml:"naming"`
	Cleanup       CleanupConfig      `yaml:"cleanup"`
}

ArtifactsConfig contains artifact management configuration

type BuildArtifact

type BuildArtifact struct {
	Platform     Platform  `json:"platform"`
	BuildType    string    `json:"build_type"`
	Architecture string    `json:"architecture"`
	FileName     string    `json:"file_name"`
	FilePath     string    `json:"file_path"`
	Size         int64     `json:"size"`
	BuildTime    time.Time `json:"build_time"`
	AppName      string    `json:"app_name"`
	Version      string    `json:"version"`
}

BuildArtifact represents a build output file

type BuildConfig

type BuildConfig struct {
	Metadata  MetadataConfig  `yaml:"metadata"`
	PreBuild  PreBuildConfig  `yaml:"pre_build"`
	Platforms PlatformsConfig `yaml:"platforms"`
	Artifacts ArtifactsConfig `yaml:"artifacts"`
	Execution ExecutionConfig `yaml:"execution"`
}

BuildConfig represents the complete build configuration

func DefaultBuildConfig

func DefaultBuildConfig() *BuildConfig

DefaultBuildConfig returns a default build configuration

func LoadBuildConfig

func LoadBuildConfig(projectPath, configPath string) (*BuildConfig, error)

LoadBuildConfig loads build configuration from file

type BuildManager

type BuildManager struct {
	ProjectPath     string
	Config          *BuildConfig
	ArtifactManager *ArtifactManager
	Logger          *utils.Logger
}

BuildManager manages the build process

func NewBuildManager

func NewBuildManager(projectPath string, config *BuildConfig) (*BuildManager, error)

NewBuildManager creates a new build manager

func (*BuildManager) ExecuteBuild

func (bm *BuildManager) ExecuteBuild(platforms []Platform, options BuildOptions) (*BuildResult, error)

ExecuteBuild executes the build process for specified platforms

func (*BuildManager) ShowBuildPlan

func (bm *BuildManager) ShowBuildPlan(platforms []Platform, options BuildOptions) error

ShowBuildPlan shows what would be executed in a dry run

type BuildOptions

type BuildOptions struct {
	SkipPreBuild    bool
	ContinueOnError bool
	DryRun          bool
	Parallel        bool
	Environment     string
}

BuildOptions contains options for the build process

type BuildResult

type BuildResult struct {
	Success         bool
	PlatformResults map[Platform]*PlatformBuildResult
	Artifacts       []*BuildArtifact
	BuildTime       time.Time
	Duration        time.Duration
	LogFile         string
}

BuildResult contains the results of a build process

type BuildStatus

type BuildStatus struct {
	TotalArtifacts int
	LastBuildTime  time.Time
	RecentBuilds   []RecentBuild
}

BuildStatus represents the current build status

type BuildStep

type BuildStep struct {
	Name        string            `yaml:"name"`
	Command     string            `yaml:"command"`
	Required    bool              `yaml:"required"`
	Timeout     int               `yaml:"timeout"` // seconds
	WorkingDir  string            `yaml:"working_dir"`
	Environment map[string]string `yaml:"env"`
	Condition   string            `yaml:"condition"`
}

BuildStep represents a single build step

func (*BuildStep) GetTimeout

func (bs *BuildStep) GetTimeout() time.Duration

GetTimeout returns the timeout duration for a build step

type CleanupConfig

type CleanupConfig struct {
	Enabled        bool `yaml:"enabled"`
	KeepLastBuilds int  `yaml:"keep_last_builds"`
	MaxAgeDays     int  `yaml:"max_age_days"`
}

CleanupConfig contains artifact cleanup settings

type CommandExecutor

type CommandExecutor struct {
	WorkingDir  string
	Environment map[string]string
	Logger      *utils.Logger
}

CommandExecutor handles execution of build commands

func NewCommandExecutor

func NewCommandExecutor(workingDir string, logger *utils.Logger) *CommandExecutor

NewCommandExecutor creates a new command executor

func (*CommandExecutor) ExecuteFlutterBuild

func (ce *CommandExecutor) ExecuteFlutterBuild(args []string, platform Platform) error

ExecuteFlutterBuild executes a Flutter build command

func (*CommandExecutor) ExecuteFlutterBuildWithEnv

func (ce *CommandExecutor) ExecuteFlutterBuildWithEnv(args []string, platform Platform, envFile string) error

ExecuteFlutterBuildWithEnv executes a Flutter build command with optional environment file

func (*CommandExecutor) ExecuteStep

func (ce *CommandExecutor) ExecuteStep(step BuildStep) error

ExecuteStep executes a single build step

func (*CommandExecutor) ExecuteWithProgress

func (ce *CommandExecutor) ExecuteWithProgress(cmd *exec.Cmd, stepName string, progressCallback func(string)) error

ExecuteWithProgress executes a command with progress indication

func (*CommandExecutor) SetEnvironment

func (ce *CommandExecutor) SetEnvironment(env map[string]string)

SetEnvironment sets environment variables for the executor

func (*CommandExecutor) ValidateFlutterInstallation

func (ce *CommandExecutor) ValidateFlutterInstallation() error

ValidateFlutterInstallation validates that Flutter is installed and available

func (*CommandExecutor) ValidatePlatformRequirements

func (ce *CommandExecutor) ValidatePlatformRequirements(platform Platform) error

ValidatePlatformRequirements validates platform-specific requirements

type DetectedSetup

type DetectedSetup struct {
	HasBuildRunner     bool
	HasLauncherIcons   bool
	HasNativeAssets    bool
	HasNodeJS          bool
	CustomScripts      []string
	AvailablePlatforms []Platform
}

DetectedSetup contains information about detected project setup

type ExecutionConfig

type ExecutionConfig struct {
	ParallelBuilds  bool   `yaml:"parallel_builds"`
	MaxParallel     int    `yaml:"max_parallel"`
	ContinueOnError bool   `yaml:"continue_on_error"`
	SaveLogs        bool   `yaml:"save_logs"`
	LogLevel        string `yaml:"log_level"`
}

ExecutionConfig contains build execution settings

type IOSBuildConfig

type IOSBuildConfig struct {
	Enabled    bool           `yaml:"enabled"`
	BuildTypes []IOSBuildType `yaml:"build_types"`
}

IOSBuildConfig contains iOS build configuration

type IOSBuildType

type IOSBuildType struct {
	Name         string   `yaml:"name"`
	Type         string   `yaml:"type"`          // ipa, archive
	BuildMode    string   `yaml:"build_mode"`    // release, debug, profile
	ExportMethod string   `yaml:"export_method"` // app-store, development, ad-hoc
	CustomArgs   []string `yaml:"custom_args"`
}

IOSBuildType represents an iOS build type

type LinuxBuildConfig

type LinuxBuildConfig struct {
	Enabled    bool             `yaml:"enabled"`
	BuildTypes []LinuxBuildType `yaml:"build_types"`
}

LinuxBuildConfig contains Linux build configuration

type LinuxBuildType

type LinuxBuildType struct {
	Name       string   `yaml:"name"`
	Type       string   `yaml:"type"`       // linux
	BuildMode  string   `yaml:"build_mode"` // release, debug, profile
	CustomArgs []string `yaml:"custom_args"`
}

LinuxBuildType represents a Linux build type

type MacOSBuildConfig

type MacOSBuildConfig struct {
	Enabled    bool             `yaml:"enabled"`
	BuildTypes []MacOSBuildType `yaml:"build_types"`
}

MacOSBuildConfig contains macOS build configuration

type MacOSBuildType

type MacOSBuildType struct {
	Name       string   `yaml:"name"`
	Type       string   `yaml:"type"`       // macos
	BuildMode  string   `yaml:"build_mode"` // release, debug, profile
	CustomArgs []string `yaml:"custom_args"`
}

MacOSBuildType represents a macOS build type

type MetadataConfig

type MetadataConfig struct {
	AppNameSource string `yaml:"app_name_source"` // namer, pubspec, custom
	CustomAppName string `yaml:"custom_app_name"` // used if source is custom
	VersionSource string `yaml:"version_source"`  // pubspec, custom
	CustomVersion string `yaml:"custom_version"`  // used if source is custom
}

MetadataConfig contains build metadata configuration

type NamingConfig

type NamingConfig struct {
	Pattern         string `yaml:"pattern"`
	FallbackAppName string `yaml:"fallback_app_name"`
}

NamingConfig contains artifact naming settings

type OrganizationConfig

type OrganizationConfig struct {
	ByDate      bool   `yaml:"by_date"`
	DateFormat  string `yaml:"date_format"`
	ByPlatform  bool   `yaml:"by_platform"`
	ByBuildType bool   `yaml:"by_build_type"`
}

OrganizationConfig contains artifact organization settings

type Platform

type Platform string

Platform represents a supported build platform

const (
	PlatformAndroid Platform = "android"
	PlatformIOS     Platform = "ios"
	PlatformWeb     Platform = "web"
	PlatformMacOS   Platform = "macos"
	PlatformLinux   Platform = "linux"
	PlatformWindows Platform = "windows"
)

type PlatformBuildResult

type PlatformBuildResult struct {
	Platform  Platform
	Success   bool
	Artifacts []*BuildArtifact
	Error     error
	Duration  time.Duration
}

PlatformBuildResult contains the result of building for a specific platform

type PlatformsConfig

type PlatformsConfig struct {
	Android AndroidBuildConfig `yaml:"android"`
	IOS     IOSBuildConfig     `yaml:"ios"`
	Web     WebBuildConfig     `yaml:"web"`
	MacOS   MacOSBuildConfig   `yaml:"macos"`
	Linux   LinuxBuildConfig   `yaml:"linux"`
	Windows WindowsBuildConfig `yaml:"windows"`
}

PlatformsConfig contains platform-specific configurations

type PreBuildConfig

type PreBuildConfig struct {
	Global  []BuildStep `yaml:"global"`
	Android []BuildStep `yaml:"android"`
	IOS     []BuildStep `yaml:"ios"`
	Web     []BuildStep `yaml:"web"`
}

PreBuildConfig contains pre-build step configurations

type RecentBuild

type RecentBuild struct {
	Date          string
	ArtifactCount int
}

RecentBuild represents information about a recent build

type SetupWizard

type SetupWizard struct {
	ProjectPath string
	// contains filtered or unexported fields
}

SetupWizard provides interactive build configuration setup

func NewSetupWizard

func NewSetupWizard(projectPath string) *SetupWizard

NewSetupWizard creates a new setup wizard

func (*SetupWizard) Run

func (sw *SetupWizard) Run() (*BuildConfig, error)

Run executes the interactive setup wizard

type WebBuildConfig

type WebBuildConfig struct {
	Enabled    bool           `yaml:"enabled"`
	BuildTypes []WebBuildType `yaml:"build_types"`
}

WebBuildConfig contains Web build configuration

type WebBuildType

type WebBuildType struct {
	Name       string   `yaml:"name"`
	Type       string   `yaml:"type"`       // web
	BuildMode  string   `yaml:"build_mode"` // release, debug, profile
	PWA        bool     `yaml:"pwa"`
	CustomArgs []string `yaml:"custom_args"`
}

WebBuildType represents a Web build type

type WindowsBuildConfig

type WindowsBuildConfig struct {
	Enabled    bool               `yaml:"enabled"`
	BuildTypes []WindowsBuildType `yaml:"build_types"`
}

WindowsBuildConfig contains Windows build configuration

type WindowsBuildType

type WindowsBuildType struct {
	Name       string   `yaml:"name"`
	Type       string   `yaml:"type"`       // windows
	BuildMode  string   `yaml:"build_mode"` // release, debug, profile
	CustomArgs []string `yaml:"custom_args"`
}

WindowsBuildType represents a Windows build type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL