crucible build parity #14
+21
-18
@@ -1620,14 +1620,12 @@ func runBuildTopData(ctx context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
opts, err := parseBuildTopDataArgs("build-topdata", ctx.args[1:])
|
parsed, err := parseBuildTopDataArgs("build-topdata", ctx.args[1:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.SkipLFS {
|
if parsed.skipLFS {
|
||||||
// ponytail: bridge --skip-lfs flag to env rather than threading a new param
|
|
||||||
// through packageBuiltTopData; CRUCIBLE_SKIP_LFS is already checked there.
|
|
||||||
os.Setenv("CRUCIBLE_SKIP_LFS", "1") //nolint:errcheck
|
os.Setenv("CRUCIBLE_SKIP_LFS", "1") //nolint:errcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1635,7 +1633,7 @@ func runBuildTopData(ctx context) error {
|
|||||||
spin.configure(ctx.stderr, console.spinnerEnabled)
|
spin.configure(ctx.stderr, console.spinnerEnabled)
|
||||||
spin.start("Build Topdata: starting")
|
spin.start("Build Topdata: starting")
|
||||||
defer spin.stop()
|
defer spin.stop()
|
||||||
result, err := topdata.BuildAndPackageWithOptions(p, opts, console.progress)
|
result, err := topdata.BuildAndPackageWithOptions(p, parsed.opts, console.progress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1650,18 +1648,16 @@ func runBuildTopPackage(ctx context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
opts, err := parseBuildTopDataArgs("build-top-package", ctx.args[1:])
|
parsed, err := parseBuildTopDataArgs("build-top-package", ctx.args[1:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.BuildWiki {
|
if parsed.opts.BuildWiki {
|
||||||
return fmt.Errorf("--wiki is not supported with build-top-package; use build-topdata when wiki generation is required")
|
return fmt.Errorf("--wiki is not supported with build-top-package; use build-topdata when wiki generation is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.SkipLFS {
|
if parsed.skipLFS {
|
||||||
// ponytail: bridge --skip-lfs flag to env rather than threading a new param
|
|
||||||
// through packageBuiltTopData; CRUCIBLE_SKIP_LFS is already checked there.
|
|
||||||
os.Setenv("CRUCIBLE_SKIP_LFS", "1") //nolint:errcheck
|
os.Setenv("CRUCIBLE_SKIP_LFS", "1") //nolint:errcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1678,23 +1674,30 @@ func runBuildTopPackage(ctx context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseBuildTopDataArgs(commandName string, args []string) (topdata.BuildAndPackageOptions, error) {
|
type buildTopDataArgs struct {
|
||||||
opts := topdata.BuildAndPackageOptions{}
|
opts topdata.BuildAndPackageOptions
|
||||||
|
skipLFS bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseBuildTopDataArgs(commandName string, args []string) (buildTopDataArgs, error) {
|
||||||
|
var parsed buildTopDataArgs
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
switch arg {
|
switch arg {
|
||||||
case "--force":
|
case "--force":
|
||||||
opts.Force = true
|
parsed.opts.Force = true
|
||||||
case "--wiki":
|
case "--wiki":
|
||||||
opts.BuildWiki = true
|
parsed.opts.BuildWiki = true
|
||||||
case "--skip-lfs":
|
case "--skip-lfs":
|
||||||
opts.SkipLFS = true
|
// ponytail: CRUCIBLE_SKIP_LFS env is the single skip mechanism; set it at
|
||||||
|
// the CLI entry point rather than carrying a dead field through BuildAndPackageOptions.
|
||||||
|
parsed.skipLFS = true
|
||||||
case "-h", "--help":
|
case "-h", "--help":
|
||||||
return opts, fmt.Errorf("usage: %s [--force] [--wiki] [--skip-lfs]", commandName)
|
return parsed, fmt.Errorf("usage: %s [--force] [--wiki] [--skip-lfs]", commandName)
|
||||||
default:
|
default:
|
||||||
return opts, fmt.Errorf("unknown %s argument %q", commandName, arg)
|
return parsed, fmt.Errorf("unknown %s argument %q", commandName, arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return opts, nil
|
return parsed, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCompareTopData(ctx context) error {
|
func runCompareTopData(ctx context) error {
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ func BuildAndPackage(p *project.Project, progress func(string)) (PackageResult,
|
|||||||
type BuildAndPackageOptions struct {
|
type BuildAndPackageOptions struct {
|
||||||
Force bool
|
Force bool
|
||||||
BuildWiki bool
|
BuildWiki bool
|
||||||
SkipLFS bool
|
// ponytail: no SkipLFS field — CRUCIBLE_SKIP_LFS env is the single skip mechanism;
|
||||||
|
// the CLI flag sets it directly before calling into this package.
|
||||||
}
|
}
|
||||||
|
|
||||||
func BuildAndPackageWithOptions(p *project.Project, opts BuildAndPackageOptions, progress func(string)) (PackageResult, error) {
|
func BuildAndPackageWithOptions(p *project.Project, opts BuildAndPackageOptions, progress func(string)) (PackageResult, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user