Skip to content

Commit

Permalink
Merge branch 'main' into kabir/swift-sdks
Browse files Browse the repository at this point in the history
# Conflicts:
#	test/unit-tests/sourcekit-lsp/LanguageClientManager.test.ts
  • Loading branch information
kabiroberai committed Dec 10, 2024
2 parents a769ec2 + b229e9c commit ee81bed
Show file tree
Hide file tree
Showing 85 changed files with 2,935 additions and 1,229 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"no-throw-literal": "warn",
// TODO "@typescript-eslint/semi" rule moved to https://eslint.style
"semi": "error",
"no-console": "warn",
// Mostly fails tests, ex. expect(...).to.be.true returns a Chai.Assertion
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-non-null-assertion": "off",
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
name: Test
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
# Linux
linux_exclude_swift_versions: '[{"swift_version": "nightly-main"}]'
linux_env_vars: |
NODE_VERSION=v18.19.0
Expand All @@ -23,7 +24,15 @@ jobs:
/bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION"
echo "$NODE_PATH" >> $GITHUB_PATH
linux_build_command: ./docker/test.sh
enable_windows_checks: false
# Windows
windows_exclude_swift_versions: '[{"swift_version": "nightly"}]'
windows_env_vars: |
CI=1
VSCODE_TEST=1
FAST_TEST_RUN=1
windows_pre_build_command: .github\workflows\scripts\windows\install-nodejs.ps1
windows_build_command: docker\test-windows.ps1
enable_windows_docker: false

soundness:
name: Soundness
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/scripts/windows/install-nodejs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$NODEJS='https://nodejs.org/dist/v18.20.4/node-v18.20.4-x64.msi'
$NODEJS_SHA256='c2654d3557abd59de08474c6dd009b1d358f420b8e4010e4debbf130b1dfb90a'
Set-Variable ErrorActionPreference Stop
Set-Variable ProgressPreference SilentlyContinue
Write-Host -NoNewLine ('Downloading {0} ... ' -f ${NODEJS})
Invoke-WebRequest -Uri ${NODEJS} -OutFile $env:TEMP\node.msi
Write-Host 'SUCCESS'
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f ${NODEJS_SHA256})
$Hash = Get-FileHash $env:TEMP\node.msi -Algorithm sha256
if ($Hash.Hash -eq ${NODEJS_SHA256}) {
Write-Host 'SUCCESS'
} else {
Write-Host ('FAILED ({0})' -f $Hash.Hash)
exit 1
}
Write-Host -NoNewLine 'Installing node.js for Windows ... '
$Process = Start-Process msiexec "/i $env:TEMP\node.msi /norestart /qn" -Wait -PassThru
if ($Process.ExitCode -eq 0) {
Write-Host 'SUCCESS'
} else {
Write-Host ('FAILED ({0})' -f $Process.ExitCode)
exit 1
}
Remove-Item -Force $env:TEMP\node.msi
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
!*.json
!*.ts

# Directories ignored by default that actually should be formatted
!.vscode/

# NodeJS
node_modules/

Expand Down
1 change: 1 addition & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = defineConfig({
},
},
reuseMachineInstall: !isCIBuild,
installExtensions: ["vadimcn.vscode-lldb"],
},
{
label: "unitTests",
Expand Down
9 changes: 3 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
83 changes: 37 additions & 46 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,41 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"env": {
"VSCODE_DEBUG": "1"
},
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "build"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"testConfiguration": "${workspaceFolder}/.vscode-test.js",
"testConfigurationLabel": "integrationTests",
"args": [
"--profile=testing-debug"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"env": {
"VSCODE_DEBUG": "1"
},
"preLaunchTask": "compile-tests"
},
{
"name": "Unit Tests",
"type": "extensionHost",
"request": "launch",
"testConfiguration": "${workspaceFolder}/.vscode-test.js",
"testConfigurationLabel": "unitTests",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "compile-tests"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"env": {
"VSCODE_DEBUG": "1"
},
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "build"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"testConfiguration": "${workspaceFolder}/.vscode-test.js",
"testConfigurationLabel": "integrationTests",
"args": ["--profile=testing-debug"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"env": {
"VSCODE_DEBUG": "1",
"VSCODE_TEST": "1"
},
"preLaunchTask": "compile-tests"
},
{
"name": "Unit Tests",
"type": "extensionHost",
"request": "launch",
"testConfiguration": "${workspaceFolder}/.vscode-test.js",
"testConfigurationLabel": "unitTests",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "compile-tests"
}
]
}
22 changes: 11 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"files.exclude": {
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",

// Configure Prettier
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
// Configure Prettier
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
52 changes: 26 additions & 26 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"presentation": {
"reveal": "never"
},
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "compile-tests",
"type": "npm",
"script": "compile-tests",
"problemMatcher": "$tsc",
"presentation": {
"reveal": "never"
}
}
]
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"presentation": {
"reveal": "never"
},
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "compile-tests",
"type": "npm",
"script": "compile-tests",
"problemMatcher": "$tsc",
"presentation": {
"reveal": "never"
}
}
]
}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 1.11.4 - 2024-12-06

### Added

- Activate extension when `compile_flags.txt` or `buildServer.json` is present ([#1240](https://github.com/swiftlang/vscode-swift/pull/1240))
- Add `"auto"` mode to sourcekit-lsp `backgroundIndexing` setting ([#1232](https://github.com/swiftlang/vscode-swift/pull/1232))

### Fixed

- Fix location for diagnostics generated from macros via `swiftc` ([#1234](https://github.com/swiftlang/vscode-swift/pull/1234))
- Fixed inability to `Debug Test` on test targets in Test Explorer ([#1209](https://github.com/swiftlang/vscode-swift/pull/1209))
- Fixed bug that could cause all tests to run when only some tests were requested ([#1186](https://github.com/swiftlang/vscode-swift/pull/1186))
- Fix test runs not being able to be cancelled in some situations ([#1153](https://github.com/swiftlang/vscode-swift/pull/1153))

## 1.11.3 - 2024-09-23

### Fixed
Expand Down
6 changes: 0 additions & 6 deletions assets/test/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
{
"type": "swift-lldb",
"request": "launch",
"sourceLanguages": [
"swift"
],
"name": "Debug PackageExe (defaultPackage)",
"program": "${workspaceFolder:test}/defaultPackage/.build/debug/PackageExe",
"args": [],
Expand All @@ -15,9 +12,6 @@
{
"type": "swift-lldb",
"request": "launch",
"sourceLanguages": [
"swift"
],
"name": "Release PackageExe (defaultPackage)",
"program": "${workspaceFolder:test}/defaultPackage/.build/release/PackageExe",
"args": [],
Expand Down
4 changes: 2 additions & 2 deletions assets/test/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"-Xswiftc",
"-DTEST_ARGUMENT_SET_VIA_TEST_BUILD_ARGUMENTS_SETTING"
],
"lldb.verboseLogging": true

"lldb.verboseLogging": true,
"swift.backgroundCompilation": false
}
5 changes: 5 additions & 0 deletions assets/test/cmake-compile-flags/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 2.4)

project(hello_world)

add_executable(app main.cpp)
8 changes: 8 additions & 0 deletions assets/test/cmake-compile-flags/compile_flags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk
-mmacosx-version-min=13.0
-o
CMakeFiles/app.dir/main.o
-c
main.cpp
7 changes: 7 additions & 0 deletions assets/test/cmake-compile-flags/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <iostream>

int main()
{
std::cout << "Hello World!\n";
return 0;
}
5 changes: 5 additions & 0 deletions assets/test/diagnostics/Sources/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ repeat {
line = readLine()
print(line ?? "nil")
} while line != nil;

#if canImport(Testing)
import Testing
#expect(try myFunc() != 0)
#endif
42 changes: 42 additions & 0 deletions assets/test/swift-macro/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
import CompilerPluginSupport

let package = Package(
name: "swift-macro",
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .macCatalyst(.v13)],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "swift-macro",
targets: ["swift-macro"]
),
.executable(
name: "swift-macroClient",
targets: ["swift-macroClient"]
),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.0-latest"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
// Macro implementation that performs the source transformation of a macro.
.macro(
name: "swift-macroMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax")
]
),

// Library that exposes a macro as part of its API, which is used in client programs.
.target(name: "swift-macro", dependencies: ["swift-macroMacros"]),

// A client of the library, which is able to use the macro in its own code.
.executableTarget(name: "swift-macroClient", dependencies: ["swift-macro"]),
]
)
Loading

0 comments on commit ee81bed

Please sign in to comment.