File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ # This source file is part of the Swift.org open source project
2
+ #
3
+ # Copyright (c) 2024–2025 Apple Inc. and the Swift project authors
4
+ # Licensed under Apache License v2.0 with Runtime Library Exception
5
+ #
6
+ # See http://swift.org/LICENSE.txt for license information
7
+ # See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8
+
9
+ find_package (Git QUIET )
10
+ if (Git_FOUND)
11
+ # Get the commit hash corresponding to the current build.
12
+ execute_process (
13
+ COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
14
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
15
+ OUTPUT_VARIABLE SWT_TESTING_LIBRARY_COMMIT_HASH
16
+ OUTPUT_STRIP_TRAILING_WHITESPACE
17
+ ERROR_QUIET)
18
+
19
+ # Check if there are local changes.
20
+ execute_process (
21
+ COMMAND ${GIT_EXECUTABLE} status -s
22
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
23
+ OUTPUT_VARIABLE SWT_TESTING_LIBRARY_COMMIT_MODIFIED
24
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
25
+ endif ()
26
+
27
+ if (SWT_TESTING_LIBRARY_COMMIT_HASH)
28
+ message (STATUS "Swift Testing commit hash: ${SWT_TESTING_LIBRARY_COMMIT_HASH} " )
29
+ add_compile_definitions (
30
+ "$<$<COMPILE_LANGUAGE:CXX>:SWT_TESTING_LIBRARY_COMMIT_HASH=\" ${SWT_TESTING_LIBRARY_COMMIT_HASH} \" >" )
31
+ if (SWT_TESTING_LIBRARY_COMMIT_MODIFIED)
32
+ add_compile_definitions (
33
+ "$<$<COMPILE_LANGUAGE:CXX>:SWT_TESTING_LIBRARY_COMMIT_MODIFIED=1>" )
34
+ endif ()
35
+ endif ()
You can’t perform that action at this time.
0 commit comments