-
Notifications
You must be signed in to change notification settings - Fork 47
Bundle H3 source in release tarballs #209
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ h3/test/results | |
| /h3/test/sql/ci-*.sql | ||
| /libh3-*/ | ||
| /h3-*.zip | ||
| /h3-*.tar.gz | ||
| *.BAK | ||
|
|
||
| # IDEs | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| foreach(required_var ARCHIVE_OUTPUT ARCHIVE_PREFIX H3_SOURCE_DIR META_JSON PROJECT_BINARY_DIR PROJECT_SOURCE_DIR) | ||
| if(NOT DEFINED ${required_var} OR "${${required_var}}" STREQUAL "") | ||
| message(FATAL_ERROR "${required_var} is required") | ||
| endif() | ||
| endforeach() | ||
|
|
||
| set(bundle_root "${PROJECT_BINARY_DIR}/source-bundle") | ||
| set(staging_dir "${bundle_root}/${ARCHIVE_PREFIX}") | ||
| set(archive_tar "${PROJECT_BINARY_DIR}/${ARCHIVE_PREFIX}.git.tar") | ||
|
|
||
| file(REMOVE_RECURSE "${bundle_root}" "${archive_tar}" "${ARCHIVE_OUTPUT}") | ||
| file(MAKE_DIRECTORY "${bundle_root}") | ||
|
|
||
| execute_process( | ||
| COMMAND git archive --format tar --prefix=${ARCHIVE_PREFIX}/ -o "${archive_tar}" HEAD | ||
| WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" | ||
| COMMAND_ERROR_IS_FATAL ANY | ||
| ) | ||
| execute_process( | ||
| COMMAND "${CMAKE_COMMAND}" -E tar xf "${archive_tar}" | ||
| WORKING_DIRECTORY "${bundle_root}" | ||
| COMMAND_ERROR_IS_FATAL ANY | ||
| ) | ||
|
|
||
| file(COPY "${META_JSON}" DESTINATION "${staging_dir}") | ||
| file(REMOVE_RECURSE "${staging_dir}/cmake/h3/upstream") | ||
| file(MAKE_DIRECTORY "${staging_dir}/cmake/h3/upstream") | ||
| file(COPY "${H3_SOURCE_DIR}/" DESTINATION "${staging_dir}/cmake/h3/upstream") | ||
|
|
||
| execute_process( | ||
| COMMAND "${CMAKE_COMMAND}" -E tar czf "${ARCHIVE_OUTPUT}" --format=gnutar "${ARCHIVE_PREFIX}" | ||
| WORKING_DIRECTORY "${bundle_root}" | ||
| COMMAND_ERROR_IS_FATAL ANY | ||
| ) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,18 @@ | ||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| die() { | ||||||||||||||||||||||||||||||
| echo "bundle: $*" >&2 | ||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| require_clean_tracked_tree() { | ||||||||||||||||||||||||||||||
| git diff --quiet || die "tracked worktree changes are present" | ||||||||||||||||||||||||||||||
| git diff --cached --quiet || die "staged changes are present" | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| require_clean_tracked_tree | ||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Also guard against untracked files before cleaning. This only checks tracked/staged edits, but the next Suggested change require_clean_tracked_tree() {
git diff --quiet || die "tracked worktree changes are present"
git diff --cached --quiet || die "staged changes are present"
+ git status --porcelain --untracked-files=all | grep -q '^\?\?' &&
+ die "untracked files are present"
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| git clean -xdf | ||||||||||||||||||||||||||||||
| cmake -B build -DCMAKE_BUILD_TYPE=Release | ||||||||||||||||||||||||||||||
| cmake --build build --target=pgxn | ||||||||||||||||||||||||||||||
| cmake --build build --target=source_bundle | ||||||||||||||||||||||||||||||
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.
When running
scripts/bundle, this expands to-DH3_SOURCE_DIR=becauseh3_SOURCE_DIRis populated byFetchContent_MakeAvailable(h3)insidecmake/h3/CMakeLists.txt; CMake variables set in a subdirectory do not propagate back to the parent.BundleSource.cmaketreats an emptyH3_SOURCE_DIRas fatal, so the newsource_bundletarget fails before producing the release tarball. Export the path from the subdirectory scope before passing it here.Useful? React with 👍 / 👎.