File tree 5 files changed +50
-12
lines changed
5 files changed +50
-12
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ let simulatorVersion: String = {
125
125
///
126
126
/// This value is not part of the public interface of the testing library.
127
127
var testingLibraryVersion: String {
128
- SWT_TESTING_LIBRARY_VERSION
128
+ swt_getTestingLibraryVersion ( ) . flatMap ( String . init ( validatingCString : ) ) ?? " unknown "
129
129
}
130
130
131
131
/// A human-readable string describing the Swift Standard Library's version.
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ set(CMAKE_CXX_SCAN_FOR_MODULES 0)
11
11
include (LibraryVersion)
12
12
add_library (_TestingInternals STATIC
13
13
Discovery.cpp
14
+ Versions.cpp
14
15
WillThrow.cpp)
15
16
target_include_directories (_TestingInternals PUBLIC
16
17
${CMAKE_CURRENT_SOURCE_DIR} /include )
Original file line number Diff line number Diff line change
1
+ //
2
+ // This source file is part of the Swift.org open source project
3
+ //
4
+ // Copyright (c) 2024 Apple Inc. and the Swift project authors
5
+ // Licensed under Apache License v2.0 with Runtime Library Exception
6
+ //
7
+ // See https://swift.org/LICENSE.txt for license information
8
+ // See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9
+ //
10
+
11
+ #include " Versions.h"
12
+
13
+ const char *swt_getTestingLibraryVersion (void ) {
14
+ #if defined(_SWT_TESTING_LIBRARY_VERSION)
15
+ return _SWT_TESTING_LIBRARY_VERSION;
16
+ #else
17
+ #warning _SWT_TESTING_LIBRARY_VERSION not defined: testing library version is unavailable
18
+ return nullptr ;
19
+ #endif
20
+ }
Original file line number Diff line number Diff line change 32
32
/// An attribute that renames a C symbol in Swift.
33
33
#define SWT_SWIFT_NAME (name ) __attribute__((swift_name(#name)))
34
34
35
- /// The testing library version from the package manifest.
36
- ///
37
- /// - Bug: The value provided to the compiler (`_SWT_TESTING_LIBRARY_VERSION`)
38
- /// is not visible in Swift, so this second macro is needed.
39
- /// ((#43521)[https://github.com/swiftlang/swift/issues/43521])
40
- #if defined(_SWT_TESTING_LIBRARY_VERSION )
41
- #define SWT_TESTING_LIBRARY_VERSION _SWT_TESTING_LIBRARY_VERSION
42
- #else
43
- #define SWT_TESTING_LIBRARY_VERSION "unknown"
44
- #endif
45
-
46
35
#endif // SWT_DEFINES_H
Original file line number Diff line number Diff line change
1
+ //
2
+ // This source file is part of the Swift.org open source project
3
+ //
4
+ // Copyright (c) 2024 Apple Inc. and the Swift project authors
5
+ // Licensed under Apache License v2.0 with Runtime Library Exception
6
+ //
7
+ // See https://swift.org/LICENSE.txt for license information
8
+ // See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9
+ //
10
+
11
+ #if !defined(SWT_VERSIONS_H )
12
+ #define SWT_VERSIONS_H
13
+
14
+ #include "Defines.h"
15
+
16
+ SWT_ASSUME_NONNULL_BEGIN
17
+
18
+ /// Get the human-readable version of the testing library.
19
+ ///
20
+ /// - Returns: A human-readable string describing the version of the testing
21
+ /// library, or `nullptr` if no version information is available. This
22
+ /// string's value and format may vary between platforms, releases, or any
23
+ /// other conditions. Do not attempt to parse it.
24
+ SWT_EXTERN const char * _Nullable swt_getTestingLibraryVersion (void );
25
+
26
+ SWT_ASSUME_NONNULL_END
27
+
28
+ #endif
You can’t perform that action at this time.
0 commit comments