Skip to content

feat: add prepare-dev in Makefile#1426

Merged
kmesh-bot merged 2 commits intokmesh-net:mainfrom
brushax:update-makefile
May 27, 2025
Merged

feat: add prepare-dev in Makefile#1426
kmesh-bot merged 2 commits intokmesh-net:mainfrom
brushax:update-makefile

Conversation

@brushax
Copy link
Copy Markdown
Contributor

@brushax brushax commented May 26, 2025

What type of PR is this?

/kind enhancement

What this PR does / why we need it:

Local development environment is confusing because of cgo-related code and local environment setting-up documents should be added.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Tom <yusencao@outlook.com>
Copilot AI review requested due to automatic review settings May 26, 2025 12:27
@kmesh-bot kmesh-bot added the kind/enhancement New feature or request label May 26, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new prepare-dev Makefile target to automate local environment setup for development, addressing cgo-related package config and lint preparation.

  • Introduces prepare-dev phony target
  • Adjusts pkg-config prefixes under mk/
  • Hooks in lint setup and environment bootstrap scripts
Comments suppressed due to low confidence (1)

Makefile:142

  • [nitpick] Consider renaming prepare-dev to something like dev-setup or adding a brief comment above the target to clarify its intent in the Makefile help section.
prepare-dev:


.PHONY: prepare-dev
prepare-dev:
$(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs sed -i "s#^prefix=.*#prefix=${ROOT_DIR}#g"
Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sed -i without a backup suffix is not portable on macOS/BSD. Consider using sed -i.bak or detecting the OS to pass the appropriate -i '' flag for compatibility.

Suggested change
$(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs sed -i "s#^prefix=.*#prefix=${ROOT_DIR}#g"
$(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs $(SED_INPLACE) "s#^prefix=.*#prefix=${ROOT_DIR}#g"

Copilot uses AI. Check for mistakes.
.PHONY: prepare-dev
prepare-dev:
$(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs sed -i "s#^prefix=.*#prefix=${ROOT_DIR}#g"
hack/golangci-lint-prepare.sh
Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may help to prefix this invocation with set -e or use || exit 1 so that failures in the lint prep script cause the Make target to fail fast.

Suggested change
hack/golangci-lint-prepare.sh
hack/golangci-lint-prepare.sh || exit 1

Copilot uses AI. Check for mistakes.
prepare-dev:
$(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs sed -i "s#^prefix=.*#prefix=${ROOT_DIR}#g"
hack/golangci-lint-prepare.sh
bash -c "source ./kmesh_compile_env_pre.sh && dependency_pkg_install"
Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcing via bash -c spawns a subshell, so environment changes won't persist. Consider sourcing directly (. ./kmesh_compile_env_pre.sh) in the current shell or wrapping both steps in a script.

Suggested change
bash -c "source ./kmesh_compile_env_pre.sh && dependency_pkg_install"
. ./kmesh_compile_env_pre.sh && dependency_pkg_install

Copilot uses AI. Check for mistakes.
gen-kmeshctl-doc:
hack/gen-kmeshctl-doc.sh

.PHONY: prepare-dev
Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This new target should be added to the Makefile's help output or documented in the README so contributors know when and how to run it.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented May 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.33%. Comparing base (10e8eb3) to head (2ac88da).
Report is 25 commits behind head on main.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fd6d19...2ac88da. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Tom <yusencao@outlook.com>
@hzxuzhonghu
Copy link
Copy Markdown
Member

/lgtm
/approve

@kmesh-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot merged commit 333c42e into kmesh-net:main May 27, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants