-
Notifications
You must be signed in to change notification settings - Fork 14
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
More flexible versions #655
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: | ||
- main | ||
- release-1.x | ||
|
||
jobs: | ||
update_release_draft: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,49 @@ | ||
|
||
function(get_version version_file version_var branch_var commit_var) | ||
macro(do_git out_var err_var) | ||
execute_process( | ||
COMMAND git describe --tags --match=[0-9]* HEAD | ||
COMMAND "git" ${ARGN} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_INFO | ||
OUTPUT_VARIABLE git_out | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
ERROR_VARIABLE git_error | ||
ERROR_VARIABLE git_err | ||
ECHO_ERROR_VARIABLE | ||
) | ||
|
||
if (NOT git_error) | ||
execute_process( | ||
COMMAND git rev-parse --abbrev-ref HEAD | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE branch | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
# Get the latest abbreviated commit hash of the working branch | ||
execute_process( | ||
COMMAND git log -1 --format=%h | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE commit | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
if (git_err) | ||
set(${err_var} ${git_err}) | ||
unset(${out_var}) | ||
else () | ||
set(${out_var} "${git_out}") | ||
unset(${err_var}) | ||
endif () | ||
endmacro(do_git) | ||
|
||
if (git_error) | ||
function(get_version version_file version_var branch_var commit_var) | ||
do_git(GIT_INFO GIT_ERROR describe --always) | ||
if (GIT_ERROR) | ||
unset(GIT_INFO) | ||
message("getting version from ${version_file}") | ||
message(NOTICE "getting version from ${version_file}") | ||
file(STRINGS ${version_file} ver_info) | ||
list(LENGTH ver_info ver_info_len) | ||
list(GET ver_info 0 GIT_INFO) | ||
list(GET ver_info 1 branch) | ||
list(GET ver_info 2 commit) | ||
list(GET ver_info 1 _branch) | ||
list(GET ver_info 2 _commit) | ||
set(${version_var} ${GIT_INFO} PARENT_SCOPE) | ||
set(${branch_var} ${_branch} PARENT_SCOPE) | ||
set(${commit_var} ${_commit} PARENT_SCOPE) | ||
return() | ||
endif () | ||
|
||
if (${GIT_INFO} MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)$") | ||
set(_ver ${CMAKE_MATCH_1}) | ||
elseif (${GIT_INFO} MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-[^-]*") | ||
string(JOIN "." _ver ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) | ||
do_git(_branch GIT_ERROR rev-parse --abbrev-ref HEAD) | ||
do_git(GIT_INFO GIT_ERROR describe --tags --long --first-parent HEAD) | ||
if (${GIT_INFO} MATCHES "^(.*)-([0-9]+)-([^-]*)") # <closest tag>-<distance>-<commit> | ||
set(_commit ${CMAKE_MATCH_3}) | ||
if (${CMAKE_MATCH_2} EQUAL "0") #exact tag | ||
set(_ver ${CMAKE_MATCH_1}) | ||
else () | ||
string(JOIN "." _ver ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) | ||
endif () | ||
endif () | ||
|
||
set(${version_var} ${_ver} PARENT_SCOPE) | ||
set(${branch_var} ${branch} PARENT_SCOPE) | ||
set(${commit_var} ${commit} PARENT_SCOPE) | ||
set(${branch_var} ${_branch} PARENT_SCOPE) | ||
set(${commit_var} ${_commit} PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
project(host-proxy) | ||
|
||
add_executable(host-proxy host-proxy.c) | ||
target_link_libraries(host-proxy PRIVATE ziti) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
project(sample-socket) | ||
|
||
add_executable(ziti-ncat ziti-ncat.c) | ||
target_link_libraries(ziti-ncat PUBLIC ziti) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
project(sample-host) | ||
|
||
add_executable(sample-host sample-host.c) | ||
target_link_libraries(sample-host PUBLIC ziti) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
project(sample_enroll) | ||
|
||
add_executable(sample_enroll sample_enroll.c) | ||
target_link_libraries(sample_enroll PUBLIC ziti) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
project(sample_http_link) | ||
|
||
add_executable(sample_http_link sample_http_link.c) | ||
target_link_libraries(sample_http_link PUBLIC ziti) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
project(sample_wttr) | ||
|
||
add_executable(sample_wttr sample_wttr.c) | ||
target_link_libraries(sample_wttr PUBLIC ziti) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
project(wzcat) | ||
|
||
add_executable(wzcat ziti_ws.c) | ||
target_link_libraries(wzcat PUBLIC ziti) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this work on windows? before it used git commands but this looks like it uses a bash variable and that might change things?
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.
${ARGN}
is CMake variablebuild is successful in CI 👇