diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index db3bf67..b807d71 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -74,7 +74,7 @@ jobs: env["GOARCH"] = goarch # Build the binary: - args = ["make", "cmds"] + args = ["make", "binary"] subprocess.run(check=True, env=env, args=args) # Copy the generated binary to the assets directory: diff --git a/Makefile b/Makefile index c3026b6..374cf9c 100644 --- a/Makefile +++ b/Makefile @@ -14,24 +14,22 @@ # limitations under the License. # +# Disable CGO so that we always generate static binaries: +export CGO_ENABLED=0 + # Details of the version of 'antlr' to use: antlr_version:=4.9.3 antlr_url:=https://www.antlr.org/download/antlr-$(antlr_version)-complete.jar antlr_sum:=afcd40946d3de4d81e28d7c88d467289e0587285d27adb172aecc5494a17df36 -# Explicitly enable Go modules so that compilation will work correctly even when -# the project directory is inside the directory indicated by the 'GOPATH' -# environment variable: -export GO111MODULE=on - # Version of the OpenAPI verification tool: openapi_generator_version:=3.3.4 openapi_generator_url:=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$(openapi_generator_version)/openapi-generator-cli-$(openapi_generator_version).jar openapi_generator_sum:=24cb04939110cffcdd7062d2f50c6f61159dc3e0ca3b8aecbae6ade53ad3dc8c -.PHONY: cmds -cmds: generate - go build -o metamodel ./cmd +.PHONY: binary +binary: generate + go build ./cmd/metamodel .PHONY: generate generate: antlr @@ -65,7 +63,7 @@ unit_tests: ginkgo -r pkg .PHONY: golang_tests -go_tests: cmds +go_tests: binary rm -rf tests/go/generated ./metamodel generate go \ --model=tests/model \ diff --git a/cmd/check/cmd.go b/cmd/metamodel/check/cmd.go similarity index 100% rename from cmd/check/cmd.go rename to cmd/metamodel/check/cmd.go diff --git a/cmd/generate/cmd.go b/cmd/metamodel/generate/cmd.go similarity index 79% rename from cmd/generate/cmd.go rename to cmd/metamodel/generate/cmd.go index 06d5408..7c6f16b 100644 --- a/cmd/generate/cmd.go +++ b/cmd/metamodel/generate/cmd.go @@ -19,9 +19,9 @@ package generate import ( "github.com/spf13/cobra" - "github.com/openshift-online/ocm-api-metamodel/cmd/generate/docs" - "github.com/openshift-online/ocm-api-metamodel/cmd/generate/golang" - "github.com/openshift-online/ocm-api-metamodel/cmd/generate/openapi" + "github.com/openshift-online/ocm-api-metamodel/cmd/metamodel/generate/docs" + "github.com/openshift-online/ocm-api-metamodel/cmd/metamodel/generate/golang" + "github.com/openshift-online/ocm-api-metamodel/cmd/metamodel/generate/openapi" ) // Cmd is the definition of the command: diff --git a/cmd/generate/docs/cmd.go b/cmd/metamodel/generate/docs/cmd.go similarity index 100% rename from cmd/generate/docs/cmd.go rename to cmd/metamodel/generate/docs/cmd.go diff --git a/cmd/generate/golang/cmd.go b/cmd/metamodel/generate/golang/cmd.go similarity index 100% rename from cmd/generate/golang/cmd.go rename to cmd/metamodel/generate/golang/cmd.go diff --git a/cmd/generate/openapi/cmd.go b/cmd/metamodel/generate/openapi/cmd.go similarity index 100% rename from cmd/generate/openapi/cmd.go rename to cmd/metamodel/generate/openapi/cmd.go diff --git a/cmd/main.go b/cmd/metamodel/main.go similarity index 88% rename from cmd/main.go rename to cmd/metamodel/main.go index df6dcb2..72125f1 100644 --- a/cmd/main.go +++ b/cmd/metamodel/main.go @@ -24,9 +24,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/pflag" - "github.com/openshift-online/ocm-api-metamodel/cmd/check" - "github.com/openshift-online/ocm-api-metamodel/cmd/generate" - "github.com/openshift-online/ocm-api-metamodel/cmd/version" + "github.com/openshift-online/ocm-api-metamodel/cmd/metamodel/check" + "github.com/openshift-online/ocm-api-metamodel/cmd/metamodel/generate" + "github.com/openshift-online/ocm-api-metamodel/cmd/metamodel/version" ) // Root command: diff --git a/cmd/version/cmd.go b/cmd/metamodel/version/cmd.go similarity index 100% rename from cmd/version/cmd.go rename to cmd/metamodel/version/cmd.go