Don't commit intermediate files

Don't commit the extracted JSON files as well only need the generated `*.generated.go` files.
This commit is contained in:
Joshua Spence
2021-07-16 10:28:55 +10:00
parent 7ebb3b204f
commit 8f8e19eb2a
69 changed files with 30 additions and 1806 deletions

View File

@@ -193,9 +193,9 @@ func main() {
embedTypes = !*noEmbeddedTypesFlag
versionDir := flag.Arg(0)
if versionDir == "" {
fmt.Print("error: no version directory specified\n\n")
version := flag.Arg(0)
if version == "" {
fmt.Print("error: no version specified\n\n")
usage()
os.Exit(1)
}
@@ -205,7 +205,7 @@ func main() {
panic(err)
}
fieldsDir := filepath.Join(wd, *versionBaseDirFlag, versionDir)
fieldsDir := filepath.Join(wd, *versionBaseDirFlag, fmt.Sprintf("v%s", version))
outDir := filepath.Join(wd, *outputDirFlag)
fieldsInfo, err := os.Stat(fieldsDir)
@@ -214,14 +214,18 @@ func main() {
panic(err)
}
err = os.MkdirAll(fieldsDir, 0755)
if err != nil {
panic(err)
}
// download fields, create
jarFile, err := downloadJar(versionDir)
jarFile, err := downloadJar(version, fieldsDir)
if err != nil {
panic(err)
}
err = extractJSON(jarFile, fieldsDir)
os.Remove(jarFile)
if err != nil {
panic(err)
}
@@ -361,6 +365,18 @@ func main() {
}
}
// Write version file.
versionGo := fmt.Sprintf(`
// Generated code. DO NOT EDIT.
package unifi
const UnifiVersion = %q
`, version)
if err := ioutil.WriteFile(filepath.Join(outDir, "version.generated.go"), []byte(versionGo), 0644); err != nil {
panic(err)
}
fmt.Printf("%s\n", outDir)
}