File tree Expand file tree Collapse file tree 5 files changed +35
-16
lines changed
Sources/_TestingInternals Expand file tree Collapse file tree 5 files changed +35
-16
lines changed Original file line number Diff line number Diff line change @@ -470,12 +470,6 @@ extension Array where Element == PackageDescription.CXXSetting {
470
470
471
471
// Capture the testing library's commit info as C++ constants.
472
472
if let git {
473
- if let tag = git. currentTag {
474
- result. append ( . define( " SWT_TESTING_LIBRARY_VERSION " , to: #"" \#( tag) ""# ) )
475
- } else {
476
- result. append ( . define( " SWT_TESTING_LIBRARY_VERSION " , to: " 0 " ) )
477
- }
478
-
479
473
result. append ( . define( " SWT_TESTING_LIBRARY_COMMIT_HASH " , to: #"" \#( git. currentCommit) ""# ) )
480
474
if git. hasUncommittedChanges {
481
475
result. append ( . define( " SWT_TESTING_LIBRARY_COMMIT_MODIFIED " , to: " 1 " ) )
Original file line number Diff line number Diff line change 9
9
set (CMAKE_CXX_SCAN_FOR_MODULES 0)
10
10
11
11
include (GitCommit)
12
- include (LibraryVersion)
13
12
include (TargetTriple)
14
13
add_library (_TestingInternals STATIC
15
14
Discovery.cpp
Original file line number Diff line number Diff line change 10
10
11
11
#include " Versions.h"
12
12
13
+ #include < mutex>
14
+
13
15
const char *swt_getTestingLibraryVersion (void ) {
14
16
#if defined(SWT_TESTING_LIBRARY_VERSION)
17
+ // The current environment explicitly specifies a version string to return.
15
18
return SWT_TESTING_LIBRARY_VERSION;
19
+ #elif __has_embed("../../version.txt")
20
+ // Read the version from version.txt at the root of the package's repository.
21
+ static char version[] = {
22
+ #pragma clang diagnostic push
23
+ #pragma clang diagnostic ignored "-Wc23-extensions"
24
+ #embed " ../../version.txt" suffix(, '\0')
25
+ #pragma clang diagnostic pop
26
+ };
27
+
28
+ // Trim any trailing whitespace.
29
+ static std::once_flag once;
30
+ std::call_once (once, [] {
31
+ auto i = std::find_if (std::begin (version), std::end (version), std::isspace);
32
+ if (i != std::end (version)) {
33
+ *i = ' \0 ' ;
34
+ }
35
+ });
36
+
37
+ return version;
16
38
#else
17
- #warning SWT_TESTING_LIBRARY_VERSION not defined: testing library version is unavailable
39
+ #warning SWT_TESTING_LIBRARY_VERSION not defined and version.txt not found : testing library version is unavailable
18
40
return nullptr ;
19
41
#endif
20
42
}
Original file line number Diff line number Diff line change 1
1
# This source file is part of the Swift.org open source project
2
2
#
3
- # Copyright (c) 2024 Apple Inc. and the Swift project authors
3
+ # Copyright (c) 2024–2025 Apple Inc. and the Swift project authors
4
4
# Licensed under Apache License v2.0 with Runtime Library Exception
5
5
#
6
6
# See http://swift.org/LICENSE.txt for license information
7
7
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8
8
9
- # The current version of the Swift Testing release. For release branches,
10
- # remember to remove -dev.
11
- set (SWT_TESTING_LIBRARY_VERSION "6.3-dev" )
12
-
13
- message (STATUS "Swift Testing version: ${SWT_TESTING_LIBRARY_VERSION} " )
14
- add_compile_definitions (
15
- "$<$<COMPILE_LANGUAGE:CXX>:SWT_TESTING_LIBRARY_VERSION=\" ${SWT_TESTING_LIBRARY_VERSION} \" >" )
9
+ # The library version is now tracked in version.txt at the root directory of the
10
+ # repository. This file will be removed in a future commit.
Original file line number Diff line number Diff line change
1
+ 6.3-dev
2
+
3
+ # This source file is part of the Swift.org open source project
4
+ #
5
+ # Copyright (c) 2025 Apple Inc. and the Swift project authors
6
+ # Licensed under Apache License v2.0 with Runtime Library Exception
7
+ #
8
+ # See http://swift.org/LICENSE.txt for license information
9
+ # See http://swift.org/CONTRIBUTORS.txt for Swift project authors
You can’t perform that action at this time.
0 commit comments