Skip to content

stdlib: remove VS injection for Swift development #63880

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

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ else()
set(SWIFT_BUILD_TEST_SUPPORT_MODULES_default FALSE)
endif()

# TODO(compnerd) use a target to avoid re-creating this file all the time
function(generate_windows_vfs_overlay)
file(TO_CMAKE_PATH ${VCToolsInstallDir} VCToolsInstallDir)
file(TO_CMAKE_PATH ${UniversalCRTSdkDir} UniversalCRTSdkDir)
configure_file("${PROJECT_SOURCE_DIR}/cmake/WindowsVFS.yaml.in"
"${CMAKE_CURRENT_BINARY_DIR}/windows-vfs-overlay.yaml"
@ONLY)
endfunction()
if(WINDOWS IN_LIST SWIFT_SDKS)
generate_windows_vfs_overlay()
file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/windows-vfs-overlay.yaml"
SWIFT_WINDOWS_VFS_OVERLAY)
endif()

#
# User-configurable options for the standard library.
#
Expand Down
27 changes: 27 additions & 0 deletions stdlib/cmake/WindowsVFS.yaml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
version: 0
case-sensitive: false
use-external-names: false
roots:
- name: "@UniversalCRTSdkDir@\\Include\\@UCRTVersion@\\um"
type: directory
contents:
- name: module.modulemap
type: file
external-contents: "@PROJECT_SOURCE_DIR@\\public\\Platform\\winsdk.modulemap"
- name: "@UniversalCRTSdkDir@\\Include\\@UCRTVersion@\\ucrt"
type: directory
contents:
- name: module.modulemap
type: file
external-contents: "@PROJECT_SOURCE_DIR@\\public\\Platform\\ucrt.modulemap"
- name: "@VCToolsInstallDir@\\include"
type: directory
contents:
- name: module.modulemap
type: file
external-contents: "@PROJECT_SOURCE_DIR@\\public\\Platform\\vcruntime.modulemap"
- name: vcruntime.apinotes
type: file
external-contents: "@PROJECT_SOURCE_DIR@\\public\\Platform\\vcruntime.apinotes"

2 changes: 2 additions & 0 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ function(add_swift_target_library_single target name)
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS
-Xcc;-Xclang;-Xcc;-ivfsoverlay;-Xcc;-Xclang;-Xcc;${SWIFTLIB_SINGLE_VFS_OVERLAY})
endif()
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS
-vfsoverlay;"${SWIFT_WINDOWS_VFS_OVERLAY}")
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
foreach(directory ${SWIFTLIB_INCLUDE})
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;-isystem;-Xcc;${directory})
Expand Down
4 changes: 2 additions & 2 deletions test/Driver/batch_mode_dependencies_make_wrong_order.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
// RUN: echo 'public func main() {}' >%t/main.swift
//
// First prime the incremental state, but note that we're building in the d c b a (reverse-alphabetical) order.
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift
//
// Now perturb the interface of a.swift and delete its output
// RUN: echo 'class a { var x : Int = 10 }' >%t/a.swift
// RUN: rm %t/a.o
//
// Now rebuild, which will rebuild a.swift then do a cascading dep-graph invalidation
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift -driver-show-incremental -driver-show-job-lifecycle >%t/out.txt 2>&1
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift -driver-show-incremental -driver-show-job-lifecycle >%t/out.txt 2>&1
// RUN: %FileCheck %s <%t/out.txt
//
// Check that we saw invalidation happen in command-line argument order
Expand Down
4 changes: 2 additions & 2 deletions test/Incremental/Fingerprints/class-fingerprint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Seeing weird failure on CI, so set the mod times
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps

Expand All @@ -24,7 +24,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesAB.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps

Expand Down
4 changes: 2 additions & 2 deletions test/Incremental/Fingerprints/enum-fingerprint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Seeing weird failure on CI, so set the mod times
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps

Expand All @@ -24,7 +24,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesAB.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps

Expand Down
4 changes: 2 additions & 2 deletions test/Incremental/Fingerprints/extension-adds-member.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Seeing weird failure on CI, so set the mod times
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output3
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output3

// Change one type, only uses of that type get recompiled

Expand All @@ -21,7 +21,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesAB.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output4
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output4

// RUN: %FileCheck -check-prefix=CHECK-RECOMPILED-W %s < %t/output4
// RUN: %FileCheck -check-prefix=CHECK-NOT-RECOMPILED-W %s < %t/output4
Expand Down
4 changes: 2 additions & 2 deletions test/Incremental/Fingerprints/nested-enum-fingerprint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Seeing weird failure on CI, so set the mod times
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps

Expand All @@ -24,7 +24,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesAB.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps

Expand Down
4 changes: 2 additions & 2 deletions test/Incremental/Fingerprints/protocol-fingerprint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Seeing weird failure on CI, so set the mod times
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps

Expand All @@ -24,7 +24,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesAB.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps

Expand Down
4 changes: 2 additions & 2 deletions test/Incremental/Fingerprints/struct-fingerprint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Seeing weird failure on CI, so set the mod times
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps

Expand All @@ -24,7 +24,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesAB.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4

// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps

Expand Down
6 changes: 3 additions & 3 deletions test/Incremental/cross-file-failure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: cd %t

// RUN: %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json >&output-baseline
// RUN: %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json >&output-baseline

// Change one type and cause a syntax error. This should cause _both_ files to
// rebuild.
Expand All @@ -16,12 +16,12 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesA.swift

// RUN: not %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json
// RUN: not %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json

// RUN: cp %t/definesA{-three,}.swift
// RUN: touch -t 200401010101 %t/definesA.swift

// RUN: not %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json >&output-incremental
// RUN: not %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json >&output-incremental

// RUN: %FileCheck -check-prefix=CHECK-RECOMPILED %s --dump-input=always < %t/output-incremental

Expand Down
4 changes: 2 additions & 2 deletions test/Incremental/superfluous-cascade.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// RUN: cp %t/definesPoint{-before,}.swift
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output3
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output3

// Change one type - now only the user of that type rebuilds

Expand All @@ -14,7 +14,7 @@
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesPoint.swift

// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output4
// RUN: cd %t && %swiftc_driver-stdlib-target -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output4

// RUN: %FileCheck -check-prefix=CHECK-RECOMPILED %s --dump-input=always < %t/output4

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys

for input_path in sys.argv[1:]:
with open(input_path, 'r') as yaml_file:
with open(input_path, 'rb') as yaml_file:
# Forwarding files are YAML files that start with '---'
if yaml_file.read(3) != '---':
if yaml_file.read(3) != b'---':
print("swiftmodule '%s' is not a forwarding module!" % input_path)
sys.exit(1)
Loading