Build with Magefile #104341
@ -35,12 +35,65 @@ func GenerateGo(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GeneratePy() {
|
func GeneratePy() error {
|
||||||
panic("GeneratePy not implemented")
|
// The generator doesn't consistently overwrite existing files, nor does it
|
||||||
|
// remove no-longer-generated files.
|
||||||
|
sh.Rm("addon/flamenco/manager")
|
||||||
|
|
||||||
|
// See https://openapi-generator.tech/docs/generators/python for the options.
|
||||||
|
|
||||||
|
err := sh.Run("java",
|
||||||
|
"-jar", "addon/openapi-generator-cli.jar",
|
||||||
|
"generate",
|
||||||
|
"-i", "pkg/api/flamenco-openapi.yaml",
|
||||||
|
"-g", "python",
|
||||||
|
"-o", "addon/",
|
||||||
|
"--package-name", "flamenco.manager",
|
||||||
|
"--http-user-agent", fmt.Sprintf("Flamenco/%s / (Blender add-on)", version),
|
||||||
|
"-p", "generateSourceCodeOnly=true",
|
||||||
|
"-p", "projectName=Flamenco",
|
||||||
|
"-p", fmt.Sprintf("packageVersion=\"%s\"", version))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateJS() {
|
// The generator outputs files so that we can write our own tests. We don't,
|
||||||
panic("GenerateJS not implemented")
|
// though, so it's better to just remove those placeholders.
|
||||||
|
sh.Rm("addon/flamenco/manager/test")
|
||||||
|
|
||||||
|
// The generators always produce UNIX line-ends. This creates false file
|
||||||
|
// modifications with Git. Convert them to DOS line-ends to avoid this.
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// TODO: Go'ify this:
|
||||||
|
// git status --porcelain | grep '^ M addon/flamenco/manager' | cut -d' ' -f3 | xargs unix2dos --keepdate
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GenerateJS() error {
|
||||||
|
sh.Rm("web/app/src/manager-api")
|
||||||
|
sh.Rm("web/_tmp-manager-api-javascript")
|
||||||
|
|
||||||
|
// See https://openapi-generator.tech/docs/generators/javascript for the options.
|
||||||
|
// Version '0.0.0' is used as NPM doesn't like Git hashes as versions.
|
||||||
|
//
|
||||||
|
// -p modelPropertyNaming=original is needed because otherwise the generator will
|
||||||
|
// use original naming internally, but generate docs with camelCase, and then
|
||||||
|
// things don't work properly.
|
||||||
|
return sh.Run("java",
|
||||||
|
"-jar", "addon/openapi-generator-cli.jar",
|
||||||
|
"generate",
|
||||||
|
"-i", "pkg/api/flamenco-openapi.yaml",
|
||||||
|
"-g", "javascript",
|
||||||
|
"-o", "web/_tmp-manager-api-javascript",
|
||||||
|
"--http-user-agent", fmt.Sprintf("Flamenco/%s / webbrowser", version),
|
||||||
|
"-p", "projectName=flamenco-manager",
|
||||||
|
"-p", "projectVersion=0.0.0",
|
||||||
|
"-p", "apiPackage=manager",
|
||||||
|
"-p", "disallowAdditionalPropertiesIfNotPresent=false",
|
||||||
|
"-p", "usePromises=true",
|
||||||
|
"-p", "moduleName=flamencoManager")
|
||||||
}
|
}
|
||||||
|
|
||||||
// unix2dosModifiedFiles changes line ends in files Git considers modified that match the given pattern.
|
// unix2dosModifiedFiles changes line ends in files Git considers modified that match the given pattern.
|
||||||
|
Loading…
Reference in New Issue
Block a user