-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul how VERSION.TXT is generated
Generate VERSION.TXT at build time rather than configure time. Since configuring only needs to happen infrequently, it was possible that the contents would be significantly out of date if a user configures, then after some time, fetches the latest changes and builds again. By moving generation to build time, we ensure that the time stamp (which includes a time and not just a day) is always maximally correct, and likewise that the git SHA is correct. Additionally, three other changes are made to the VERSION.TXT contents. First, rather than just a time stamp, the default value is now an actual version identifier following the usual pattern of experimental builds (i.e. 0.0.YYYYMMDD.HHMMSS+git<sha8>). Second, if the environment variable DRAKE_VERSION is set, its value overrides the value that would otherwise appears in VERSION.TXT. This mechanism is intended to allow official builds a way to inject release version numbers, as opposed to the current mechanism of replacing VERSION.TXT. Third, the git SHA can also be overridden by the environment variable DRAKE_GIT_SHA. This is needed by wheel builds, because the Docker environment has only the raw source files and not the accompanying git content. Finally, ensure that wheel builds export the wheel version and git SHA to the build environment so that they are picked up when generating VERSION.TXT. (Strictly speaking, the latter is only needed, and only done, for Linux builds.)
- Loading branch information
1 parent
9a8f606
commit 49b3512
Showing
6 changed files
with
57 additions
and
20 deletions.
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
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 +1 @@ | ||
@BUILD_TIMESTAMP@ @GIT_REVISION@ | ||
@DRAKE_VERSION@ @GIT_REVISION@ |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
set(GIT_REVISION HEAD) | ||
set(BUILD_IDENTIFIER unknown) | ||
|
||
if(DEFINED ENV{DRAKE_GIT_SHA}) | ||
set(GIT_REVISION "$ENV{DRAKE_GIT_SHA}") | ||
else() | ||
if(GIT_EXECUTABLE AND EXISTS "${GIT_DIR}") | ||
execute_process(COMMAND | ||
"${GIT_EXECUTABLE}" "--git-dir=${GIT_DIR}" rev-parse HEAD | ||
RESULT_VARIABLE GIT_REV_PARSE_RESULT_VARIABLE | ||
OUTPUT_VARIABLE GIT_REV_PARSE_OUTPUT_VARIABLE | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
if(GIT_REV_PARSE_RESULT_VARIABLE EQUAL 0) | ||
set(GIT_REVISION "${GIT_REV_PARSE_OUTPUT_VARIABLE}") | ||
string(SUBSTRING ${GIT_REVISION} 0 8 GIT_REVISION_SHORT) | ||
set(BUILD_IDENTIFIER git${GIT_REVISION_SHORT}) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
if(DEFINED ENV{DRAKE_VERSION}) | ||
set(DRAKE_VERSION "$ENV{DRAKE_VERSION}") | ||
else() | ||
string(TIMESTAMP BUILD_TIMESTAMP "%Y%m%d.%H%M%S") | ||
set(DRAKE_VERSION "0.0.${BUILD_TIMESTAMP}+${BUILD_IDENTIFIER}") | ||
endif() | ||
|
||
configure_file(${INPUT_FILE} ${OUTPUT_FILE} @ONLY) |
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
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