diff --git a/.bazelrc b/.bazelrc index 5288881ad..f47b186a6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,17 +1,16 @@ common --enable_bzlmod build --enable_platform_specific_config -build --incompatible_use_platforms_repo_for_constraints build --incompatible_enable_cc_toolchain_resolution build --enable_runfiles build --incompatible_strict_action_env -# required for googletest +# required for googletest build:linux --cxxopt=-std=c++17 build:macos --cxxopt=-std=c++17 -common:ci --announce_rc -common:ci --verbose_failures +common:ci --announce_rc +common:ci --verbose_failures common:ci --keep_going -test:ci --test_output=errors - -try-import %workspace%/user.bazelrc \ No newline at end of file +test:ci --test_output=errors + +try-import %workspace%/user.bazelrc diff --git a/.github/workflows/bazel-release-archive.yml b/.github/workflows/bazel-release-archive.yml index af72efd28..72c4effb3 100644 --- a/.github/workflows/bazel-release-archive.yml +++ b/.github/workflows/bazel-release-archive.yml @@ -13,7 +13,10 @@ jobs: permissions: contents: write steps: + - uses: actions/setup-go@v5 + - run: go install github.com/bazelbuild/buildtools/buildozer@latest - uses: actions/checkout@v4 + - run: ./scripts/sync_bzlmod_version.sh - run: git archive $GITHUB_REF -o "entt-${GITHUB_REF:10}.tar.gz" - run: gh release upload ${GITHUB_REF:10} "entt-${GITHUB_REF:10}.tar.gz" env: diff --git a/.gitignore b/.gitignore index 0a0da5f26..ddcbd9898 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ cpp.hint /bazel-* /test/bazel-* /user.bazelrc +*.bazel.lock diff --git a/MODULE.bazel b/MODULE.bazel index e31290b83..445754c48 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,8 +1,4 @@ -module( - name = "entt", - version = "3.12.2", - compatibility_level = 3012, -) +module(name = "entt") bazel_dep(name = "rules_cc", version = "0.0.8") bazel_dep(name = "bazel_skylib", version = "1.4.2") diff --git a/scripts/sync_bzlmod_version.sh b/scripts/sync_bzlmod_version.sh new file mode 100644 index 000000000..65bc2521d --- /dev/null +++ b/scripts/sync_bzlmod_version.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -e + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +VERSION_HEADER=$(realpath "$SCRIPT_DIR/../src/entt/config/version.h" --relative-to=$(pwd)) +BAZEL_MODULE=$(realpath "$SCRIPT_DIR/../MODULE.bazel" --relative-to=$(pwd)) + +if [[ -z "${VERSION_HEADER}" ]]; then + echo "Cannot find version header" + exit 1 +fi + +echo "Getting version from $VERSION_HEADER ..." + +ENTT_MAJOR_VERSION=$(sed -nr 's/#define ENTT_VERSION_MAJOR ([0-9]+)/\1/p' $VERSION_HEADER) +ENTT_MINOR_VERSION=$(sed -nr 's/#define ENTT_VERSION_MINOR ([0-9]+)/\1/p' $VERSION_HEADER) +ENTT_PATCH_VERSION=$(sed -nr 's/#define ENTT_VERSION_PATCH ([0-9]+)/\1/p' $VERSION_HEADER) + +VERSION="$ENTT_MAJOR_VERSION.$ENTT_MINOR_VERSION.$ENTT_PATCH_VERSION" + +echo "Found $VERSION" + +buildozer "set version $VERSION" //MODULE.bazel:%module + +# a commit is needed for 'git archive' +git add $BAZEL_MODULE +git commit -m "chore: update MODULE.bazel version to $VERSION" diff --git a/test/.bazelrc b/test/.bazelrc index 8175ae7c2..bc61281d4 100644 --- a/test/.bazelrc +++ b/test/.bazelrc @@ -1 +1 @@ -import "%workspace%/../.bazelrc" \ No newline at end of file +import "%workspace%/../.bazelrc"