From a353dc4d79bb8dfac3ffc45dd4526d83a667fe26 Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 26 Aug 2019 17:05:53 +0530 Subject: [PATCH 1/8] Making cross compile indepedent of gox vender package --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 59623f31bd9..d91fe4da6d7 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,12 @@ test-coverage: # compile for multiple platforms .PHONY: cross cross: - gox -osarch="darwin/amd64 linux/amd64 windows/amd64" -output="dist/bin/{{.OS}}-{{.Arch}}/odo" $(BUILD_FLAGS) ./cmd/odo/ + @for platform in darwin linux windows ; do \ + if [ $$platform == "windows" ]; then \ + IS_EXE := .exe; \ + fi \ + go build -o dist/bin/$$platform-amd64/odo$(IS_EXE) $(BUILD_FLAGS) ./cmd/odo/ \ + done .PHONY: generate-cli-structure generate-cli-structure: From c505ef4dab979a933ff92d7fe47fa9cf2c3ed295 Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 26 Aug 2019 20:00:52 +0530 Subject: [PATCH 2/8] Fixing Makefile failure --- Makefile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d91fe4da6d7..cd09b12ba40 100644 --- a/Makefile +++ b/Makefile @@ -79,15 +79,27 @@ goget-tools: test-coverage: ./scripts/generate-coverage.sh +# compile for linux platform +.PHONY: linux-amd64 +linux-amd64: + GOARCH=amd64 GOOS=linux go build $(BUILD_FLAGS) -o dist/bin/linux-amd64/odo ./cmd/odo/ + +# compile for darwin platform +.PHONY: darwin-amd64 +darwin-amd64: + GOARCH=amd64 GOOS=darwin go build $(BUILD_FLAGS) -o dist/bin/darwin-amd64/odo ./cmd/odo/ + +# compile for windows platform +.PHONY: windows-amd64 +windows-amd64: + GOARCH=amd64 GOOS=windows go build $(BUILD_FLAGS) -o dist/bin/windows-amd64/odo.exe ./cmd/odo/ + # compile for multiple platforms .PHONY: cross cross: - @for platform in darwin linux windows ; do \ - if [ $$platform == "windows" ]; then \ - IS_EXE := .exe; \ - fi \ - go build -o dist/bin/$$platform-amd64/odo$(IS_EXE) $(BUILD_FLAGS) ./cmd/odo/ \ - done + make darwin-amd64 + make linux-amd64 + make windows-amd64 .PHONY: generate-cli-structure generate-cli-structure: From fd66441d41268c986bca6143df3f7efbefdd4acb Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 26 Aug 2019 20:20:49 +0530 Subject: [PATCH 3/8] Updated Makefile --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index cd09b12ba40..95a26c3e59d 100644 --- a/Makefile +++ b/Makefile @@ -82,23 +82,23 @@ test-coverage: # compile for linux platform .PHONY: linux-amd64 linux-amd64: - GOARCH=amd64 GOOS=linux go build $(BUILD_FLAGS) -o dist/bin/linux-amd64/odo ./cmd/odo/ + go build $(BUILD_FLAGS) -o dist/bin/linux-amd64/odo ./cmd/odo/ # compile for darwin platform .PHONY: darwin-amd64 darwin-amd64: - GOARCH=amd64 GOOS=darwin go build $(BUILD_FLAGS) -o dist/bin/darwin-amd64/odo ./cmd/odo/ + go build $(BUILD_FLAGS) -o dist/bin/darwin-amd64/odo ./cmd/odo/ # compile for windows platform .PHONY: windows-amd64 windows-amd64: - GOARCH=amd64 GOOS=windows go build $(BUILD_FLAGS) -o dist/bin/windows-amd64/odo.exe ./cmd/odo/ + go build $(BUILD_FLAGS) -o "dist/bin/windows-amd64/odo.exe" ./cmd/odo/ # compile for multiple platforms .PHONY: cross cross: - make darwin-amd64 make linux-amd64 + make darwin-amd64 make windows-amd64 .PHONY: generate-cli-structure From b3ebfcbe9d4250bb376e15a119f75ecf3a96751f Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 26 Aug 2019 20:25:00 +0530 Subject: [PATCH 4/8] Updated Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 95a26c3e59d..e22f64a2564 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ darwin-amd64: # compile for windows platform .PHONY: windows-amd64 windows-amd64: - go build $(BUILD_FLAGS) -o "dist/bin/windows-amd64/odo.exe" ./cmd/odo/ + go build $(BUILD_FLAGS) -o dist/bin/windows-amd64/odo.exe ./cmd/odo/ # compile for multiple platforms .PHONY: cross From 8618899a10ce0c96799a85938db29c5810b8e65b Mon Sep 17 00:00:00 2001 From: arout Date: Mon, 26 Aug 2019 22:23:14 +0530 Subject: [PATCH 5/8] Updated Makefile as per review comment --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e22f64a2564..9e7c9aad6dc 100644 --- a/Makefile +++ b/Makefile @@ -82,17 +82,17 @@ test-coverage: # compile for linux platform .PHONY: linux-amd64 linux-amd64: - go build $(BUILD_FLAGS) -o dist/bin/linux-amd64/odo ./cmd/odo/ + GOARCH=amd64 GOOS=linux go build $(BUILD_FLAGS) -o dist/bin/linux-amd64/odo ./cmd/odo/ # compile for darwin platform .PHONY: darwin-amd64 darwin-amd64: - go build $(BUILD_FLAGS) -o dist/bin/darwin-amd64/odo ./cmd/odo/ + GOARCH=amd64 GOOS=darwin go build $(BUILD_FLAGS) -o dist/bin/darwin-amd64/odo ./cmd/odo/ # compile for windows platform .PHONY: windows-amd64 windows-amd64: - go build $(BUILD_FLAGS) -o dist/bin/windows-amd64/odo.exe ./cmd/odo/ + GOARCH=amd64 GOOS=windows go build $(BUILD_FLAGS) -o dist/bin/windows-amd64/odo.exe ./cmd/odo/ # compile for multiple platforms .PHONY: cross From 6d1f37ca855ad9cd1a8f5fbbd31026fc0fe389e7 Mon Sep 17 00:00:00 2001 From: arout Date: Tue, 27 Aug 2019 00:00:02 +0530 Subject: [PATCH 6/8] Updated Makefile --- Makefile | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 9e7c9aad6dc..7171cab16ce 100644 --- a/Makefile +++ b/Makefile @@ -79,27 +79,18 @@ goget-tools: test-coverage: ./scripts/generate-coverage.sh -# compile for linux platform -.PHONY: linux-amd64 -linux-amd64: - GOARCH=amd64 GOOS=linux go build $(BUILD_FLAGS) -o dist/bin/linux-amd64/odo ./cmd/odo/ - -# compile for darwin platform -.PHONY: darwin-amd64 -darwin-amd64: - GOARCH=amd64 GOOS=darwin go build $(BUILD_FLAGS) -o dist/bin/darwin-amd64/odo ./cmd/odo/ - -# compile for windows platform -.PHONY: windows-amd64 -windows-amd64: - GOARCH=amd64 GOOS=windows go build $(BUILD_FLAGS) -o dist/bin/windows-amd64/odo.exe ./cmd/odo/ - # compile for multiple platforms .PHONY: cross cross: - make linux-amd64 - make darwin-amd64 - make windows-amd64 + @for platform in linux darwin windows ; do \ + if [ $$platform == "windows" ]; then \ + echo "Cross compiling $$platform-amd64 and placing binary at dist/bin/$$platform-amd64/"; \ + GOARCH=amd64 GOOS=$$platform go build -o dist/bin/$$platform-amd64/odo.exe $(BUILD_FLAGS) ./cmd/odo/; \ + else \ + echo "Cross compiling $$platform-amd64 and placing binary at dist/bin/$$platform-amd64/"; \ + GOARCH=amd64 GOOS=$$platform go build -o dist/bin/$$platform-amd64/odo $(BUILD_FLAGS) ./cmd/odo/; \ + fi \ + done .PHONY: generate-cli-structure generate-cli-structure: From 90d6fc0e363a6bd959a98020ef3b91a1275aed4e Mon Sep 17 00:00:00 2001 From: arout Date: Tue, 27 Aug 2019 11:42:20 +0530 Subject: [PATCH 7/8] Update Makefile --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7171cab16ce..d4c41f03ba6 100644 --- a/Makefile +++ b/Makefile @@ -83,11 +83,10 @@ test-coverage: .PHONY: cross cross: @for platform in linux darwin windows ; do \ + echo "Cross compiling $$platform-amd64 and placing binary at dist/bin/$$platform-amd64/"; \ if [ $$platform == "windows" ]; then \ - echo "Cross compiling $$platform-amd64 and placing binary at dist/bin/$$platform-amd64/"; \ GOARCH=amd64 GOOS=$$platform go build -o dist/bin/$$platform-amd64/odo.exe $(BUILD_FLAGS) ./cmd/odo/; \ else \ - echo "Cross compiling $$platform-amd64 and placing binary at dist/bin/$$platform-amd64/"; \ GOARCH=amd64 GOOS=$$platform go build -o dist/bin/$$platform-amd64/odo $(BUILD_FLAGS) ./cmd/odo/; \ fi \ done From 0792b90e96a74842d5a936eb0580329c1d82ffbd Mon Sep 17 00:00:00 2001 From: arout Date: Tue, 27 Aug 2019 19:05:08 +0530 Subject: [PATCH 8/8] Remove gox reference --- Makefile | 1 - scripts/openshiftci-presubmit-unittests.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/Makefile b/Makefile index d4c41f03ba6..b40346897ae 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,6 @@ clean: goget-tools: go get -u github.com/Masterminds/glide # go get -u golang.org/x/lint/golint - go get -u github.com/mitchellh/gox go get github.com/frapposelli/wwhrd go get -u github.com/onsi/ginkgo/ginkgo go get -u github.com/securego/gosec/cmd/gosec diff --git a/scripts/openshiftci-presubmit-unittests.sh b/scripts/openshiftci-presubmit-unittests.sh index bfb44cc7c02..c983c5bd0c1 100755 --- a/scripts/openshiftci-presubmit-unittests.sh +++ b/scripts/openshiftci-presubmit-unittests.sh @@ -11,6 +11,5 @@ export CUSTOM_HOMEDIR=$ARTIFACTS_DIR make test # crosscompile and publish artifacts -go get -u github.com/mitchellh/gox make cross cp -r dist $ARTIFACTS_DIR \ No newline at end of file