-
Notifications
You must be signed in to change notification settings - Fork 37
/
main.go
62 lines (55 loc) · 1.87 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
import (
"errors"
"log"
"github.com/spf13/cobra"
"github.com/ubuntu/wsl/wsl-builder/common"
)
func main() {
rootCmd := &cobra.Command{
Use: "prepare COMMAND",
Short: "Prepares the build tree before running msbuild",
Long: `This tool downloads the assets and prepares the build tree before
running msbuild to build WSL application.`,
RunE: func(cmd *cobra.Command, args []string) error {
return nil
},
}
buildGHMatrixCmd := &cobra.Command{
Use: "build-github-matrix CSV_FILE",
Short: "Return a json list of all build combinations we support",
Long: `This builds and returns the list of all desired build combinations
we should trigger on Github Actions, following the release schedule`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("this command accepts exactly one CSV file")
}
metaPath, err := common.GetPath("meta")
if err != nil {
return err
}
return buildGHMatrix(args[0], metaPath)
},
}
rootCmd.AddCommand(buildGHMatrixCmd)
var noChecksum *bool
var buildID *int
prepareBuildCmd := &cobra.Command{
Use: "prepare BUILDID_PATH APP_ID ROOTFSES",
Short: "Prepares the build source before calling msbuild",
Long: `This gets the root file systems and prepares the build before building
the appx bundle. ROOTFSES must be a comma separated list of
local file paths or urls each followed by ::<arch>`,
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
return prepareBuild(args[0], args[1], args[2], *noChecksum, *buildID)
},
}
rootCmd.AddCommand(prepareBuildCmd)
noChecksum = prepareBuildCmd.Flags().Bool("no-checksum", false, "Disable checksum verification on rootfses")
buildID = prepareBuildCmd.Flags().Int("build-id", -1, "Force a build ID")
err := rootCmd.Execute()
if err != nil {
log.Fatal(err)
}
}