Skip to content

Commit d57d9fd

Browse files
committed
Add features file describing new available flags
The only available method to check for features at the moment is through version checks. This is errorprone and doesn't work well for OSS toolchains or locally built compilers. features.json is intended to communicate to build systems that a new flag is available, in order to assist with a transitional period where not all supported toolchains may have a particular flag. It is *not* intended to be a comprehensive report of all flags available. Note that the names are intended to be features, so while they may match up to the corresponding flag name, this isn't necessarily the case.
1 parent 67cc4d0 commit d57d9fd

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

lib/Option/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,28 @@ add_dependencies(swiftOption
66
target_link_libraries(swiftOption PRIVATE
77
swiftBasic)
88

9+
set(features_file_src "${CMAKE_CURRENT_SOURCE_DIR}/features.json")
10+
set(features_file_dest "${CMAKE_BINARY_DIR}/share/swift/features.json")
11+
12+
add_custom_command(
13+
OUTPUT
14+
${features_file_dest}
15+
COMMAND
16+
${CMAKE_COMMAND} -E copy ${features_file_src} ${features_file_dest}
17+
DEPENDS
18+
${features_file_src}
19+
)
20+
21+
add_custom_target(swift-features-file DEPENDS ${features_file_dest})
22+
23+
add_dependencies(swiftOption swift-features-file)
24+
25+
swift_install_in_component(
26+
FILES
27+
${features_file_dest}
28+
DESTINATION
29+
"share/swift"
30+
COMPONENT
31+
compiler
32+
)
33+

lib/Option/features.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"features": [
3+
{
4+
"name": "experimental-skip-all-function-bodies"
5+
},
6+
{
7+
"name": "experimental-allow-module-with-compiler-errors"
8+
}
9+
]
10+
}

0 commit comments

Comments
 (0)