-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Link swift-ide-test
against the new (early)swift-driver and exercise its getSingleFrontendInvocationFromDriverArguments
C API
#75840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
artemcm
wants to merge
4
commits into
swiftlang:main
Choose a base branch
from
artemcm:NewDriverTooling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
dd4876f
Link 'swift-ide-test' against the new (early)swift-driver and exercis…
artemcm 07a255d
Rename 'SwiftOptions' CMake target to 'SwiftOptionDefinitions' to avo…
artemcm a62a0d5
[Tests] Switch `swift-ide-test` to use `swift_getSingleFrontendInvoca…
xedin ff94c64
[Tools] `swift-ide-test` should re-export `libSwiftScan` symbols
xedin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,3 +1,3 @@ | ||
set(LLVM_TARGET_DEFINITIONS Options.td) | ||
swift_tablegen(Options.inc -gen-opt-parser-defs) | ||
swift_add_public_tablegen_target(SwiftOptions) | ||
swift_add_public_tablegen_target(SwiftOptionDefinitions) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,3 +1,26 @@ | ||
# Early swift-driver is built adjacent to the compiler (swift build dir) | ||
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") | ||
set(driver_package_configuration_dir "release") | ||
else() | ||
set(driver_package_configuration_dir "debug") | ||
endif() | ||
|
||
get_target_property(LIB_SCAN_SOURCE_DIR libSwiftScan SOURCE_DIR) | ||
|
||
set(LIB_SCAN_EXPORTED_SYMBOL_FILE | ||
${LIB_SCAN_SOURCE_DIR}/libSwiftScan.exports) | ||
|
||
message(STATUS "libSwiftScan: ${LIB_SCAN_SOURCE_DIR}") | ||
message(STATUS "swift-driver: ${CMAKE_BINARY_DIR}/../earlyswiftdriver-${SWIFT_HOST_VARIANT}-${SWIFT_HOST_VARIANT_ARCH}/${driver_package_configuration_dir}/cmake/modules/") | ||
message(STATUS "swift-tools-support-core: ${CMAKE_BINARY_DIR}/../earlyswiftdriver-${SWIFT_HOST_VARIANT}-${SWIFT_HOST_VARIANT_ARCH}/${driver_package_configuration_dir}/dependencies/swift-tools-support-core/cmake/modules/") | ||
|
||
set(SwiftDriver_DIR | ||
"${CMAKE_BINARY_DIR}/../earlyswiftdriver-${SWIFT_HOST_VARIANT}-${SWIFT_HOST_VARIANT_ARCH}/${driver_package_configuration_dir}/cmake/modules/") | ||
set(TSC_DIR "${CMAKE_BINARY_DIR}/../earlyswiftdriver-${SWIFT_HOST_VARIANT}-${SWIFT_HOST_VARIANT_ARCH}/${driver_package_configuration_dir}/dependencies/swift-tools-support-core/cmake/modules/") | ||
find_package(TSC CONFIG) | ||
find_package(SwiftDriver CONFIG) | ||
|
||
|
||
add_swift_host_tool(swift-ide-test | ||
swift-ide-test.cpp | ||
ModuleAPIDiff.cpp | ||
|
@@ -6,14 +29,33 @@ add_swift_host_tool(swift-ide-test | |
THINLTO_LD64_ADD_FLTO_CODEGEN_ONLY | ||
HAS_SWIFT_MODULES | ||
) | ||
|
||
set_property( | ||
TARGET swift-ide-test | ||
APPEND PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/../earlyswiftdriver-${SWIFT_HOST_VARIANT}-${SWIFT_HOST_VARIANT_ARCH}/${driver_package_configuration_dir}/lib/" | ||
) | ||
set_property( | ||
TARGET swift-ide-test | ||
APPEND PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/../earlyswiftdriver-${SWIFT_HOST_VARIANT}-${SWIFT_HOST_VARIANT_ARCH}/${driver_package_configuration_dir}/dependencies/swift-tools-support-core/lib/" | ||
) | ||
Comment on lines
+33
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely don't want an absolute INSTALL_RPATH. I would have also thought that this isn't needed regardless - the lib to be in the same place as swift-syntax, which is already on the rpath. |
||
|
||
target_link_libraries(swift-ide-test | ||
PRIVATE | ||
swiftAST | ||
swiftDriver | ||
SwiftDriver | ||
swiftFrontend | ||
swiftIDE | ||
swiftIDETool | ||
swiftCompilerModules) | ||
swiftCompilerModules | ||
libSwiftScanDependencies) | ||
target_sources(swift-ide-test | ||
PRIVATE | ||
$<TARGET_OBJECTS:libSwiftScan>) | ||
|
||
# This is required because swift-driver in "integrated" mode depends on libSwiftScan symbols | ||
# that have to be re-exported from the `libSwiftScan` library. | ||
add_llvm_symbol_exports(swift-ide-test ${LIB_SCAN_EXPORTED_SYMBOL_FILE}) | ||
|
||
# If libxml2 is available, make it available for swift-ide-test. | ||
if(LLVM_ENABLE_LIBXML2) | ||
|
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we have
SWIFT_EARLY_SWIFT_DRIVER_BUILD
already so you could use that. But I'd also do a check here for ifSwiftDriver_DIR
andTSC_DIR
are already set.Have we thought much about using FetchContent for the early swift driver (similar to swift-syntax)? CC @compnerd @etcwilde
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah,
FetchContent
orfind_package
should be what we use here instead of hard-coding these paths.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well technically we are doing a
find_package
, just settingSwiftDriver_DIR
beforehand 😅. We currently setSWIFT_EARLY_SWIFT_DRIVER_BUILD
, I'm not entirely clear why we're not just settingSwiftDriver_DIR
though?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @artemcm and @compnerd