-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kie-issues#1566: Remove pkg
dependency from image-env-to-json
on kie-tools, as it's deprecated
#2901
Conversation
packages/image-env-to-json/Makefile
Outdated
build-all: build-darwin-amd64 build-darwin-arm64 build-linux-amd64 build-linux-arm64 build-win-amd64 build-win-arm64 | ||
|
||
build-darwin: | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=$(GOARCH) go build -ldflags $(LDFLAGS) -o $(BIN_PATH)/$(BIN_BUILD_DARWIN) $(MAIN_PATH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's not ideal, but in other packages, we use cross-env
here to avoid OS-specific errors when cross-building.
"build": "run-script-os", | ||
"build:darwin": "pnpm setup:env make build-darwin", | ||
"build:darwin:amd": "pnpm setup:env make build-darwin-amd64", | ||
"build:darwin:arm": "pnpm setup:env make build-darwin-arm64", | ||
"build:dev": "rimraf -rf dist && pnpm build", | ||
"build:linux": "pnpm setup:env make build-linux", | ||
"build:linux:amd": "pnpm setup:env make build-linux-amd64", | ||
"build:linux:arm": "pnpm setup:env make build-linux-arm64", | ||
"build:prod": "rimraf -rf dist && run-script-os && pnpm test", | ||
"build:prod:darwin": "rimraf dist && pnpm setup:env make build-all", | ||
"build:prod:linux": "rimraf dist && pnpm setup:env make build-all", | ||
"build:prod:win32": "rimraf dist && pnpm setup:env:win32 make build-all", | ||
"build:win32": "pnpm setup:env:win32 make build-win", | ||
"build:win32:amd": "pnpm setup:env:win32 make build-win-amd64", | ||
"build:win32:arm": "pnpm setup:env:win32 make build-win-arm64", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should build all binaries every time (on build:dev and build:prod). It should be quick, and we can avoid issues where, for example, we test the binary in a macOS ARM environment but then run it inside a Linux x64 container.
It would also simplify this list of scripts in the package.json.
"install": "go mod tidy", | ||
"powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", | ||
"setup:env": "cross-env PLUGIN_VERSION=$(build-env imageEnvToJson.version)", | ||
"setup:env:win32": "pnpm powershell \"cross-env PLUGIN_VERSION=$(build-env imageEnvToJson.version)\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is powershell needed even with cross-env
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we need to set the environment variables before the make
.
b349758
to
d4cfcdb
Compare
d4cfcdb
to
4255190
Compare
Please add tests for when env vars contain JSON strings too. Thank you! |
Closes: apache/incubator-kie-issues#1566
Closes: #2578
Description
Fully rewrite using Golang to simplify generate native binaries.
Obs: Some usages weren't updated to use the new Darwin and Windows binaries, since they are placed inside a Linux container.