Skip to content

Commit

Permalink
Merge pull request #2871 from dotnet/swift-bindings/testing-framework
Browse files Browse the repository at this point in the history
[SwiftBindings] Improve testing framework
  • Loading branch information
kotlarmilos authored Dec 17, 2024
2 parents 24dc902 + dcf3fdb commit d51a97f
Show file tree
Hide file tree
Showing 40 changed files with 1,907 additions and 5,662 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,4 @@ launchSettings.json
testing/
src/samples/**/Unsafe*.cs
src/samples/**/Swift.*.cs
src/samples/**/Library/*.cs
36 changes: 32 additions & 4 deletions SwiftBindings.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftBindings", "src\Swift.Bindings\src\Swift.Bindings.csproj", "{B7977360-6671-4707-9A1C-1C29D5BE2674}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swift.Bindings", "src\Swift.Bindings\src\Swift.Bindings.csproj", "{B7977360-6671-4707-9A1C-1C29D5BE2674}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftBindings.Tests", "src\Swift.Bindings\tests\Swift.Bindings.Tests.csproj", "{CE81B6BD-CCCC-4223-9069-B28435A4A5C1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swift.Bindings.Unit.Tests", "src\Swift.Bindings\tests\UnitTests\Swift.Bindings.Unit.Tests.csproj", "{CE81B6BD-CCCC-4223-9069-B28435A4A5C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftRuntime", "src\Swift.Runtime\src\Swift.Runtime.csproj", "{8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swift.Runtime", "src\Swift.Runtime\src\Swift.Runtime.csproj", "{8E9013BE-01BD-4F4C-8BF7-E8C71FA6608E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwiftRuntime.Tests", "src\Swift.Runtime\tests\Swift.Runtime.Tests.csproj", "{61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swift.Runtime.Tests", "src\Swift.Runtime\tests\Swift.Runtime.Tests.csproj", "{61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swift.Bindings.Integration.Tests", "src\Swift.Bindings\tests\IntegrationTests\Swift.Bindings.Integration.Tests.csproj", "{CF9035B8-57F0-49A2-B985-94B1F6389339}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swift.Bindings.Framework.Tests", "src\Swift.Bindings\tests\FrameworkTests\Swift.Bindings.Framework.Tests.csproj", "{BCC05AA9-F43C-478F-B417-D7E4EFD29362}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -72,5 +76,29 @@ Global
{61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|x64.Build.0 = Release|Any CPU
{61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|x86.ActiveCfg = Release|Any CPU
{61F74BC6-1CCA-49FA-B5B8-6C9EABC1D0AB}.Release|x86.Build.0 = Release|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Debug|x64.ActiveCfg = Debug|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Debug|x64.Build.0 = Debug|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Debug|x86.ActiveCfg = Debug|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Debug|x86.Build.0 = Debug|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Release|Any CPU.Build.0 = Release|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Release|x64.ActiveCfg = Release|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Release|x64.Build.0 = Release|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Release|x86.ActiveCfg = Release|Any CPU
{CF9035B8-57F0-49A2-B985-94B1F6389339}.Release|x86.Build.0 = Release|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Debug|x64.ActiveCfg = Debug|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Debug|x64.Build.0 = Debug|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Debug|x86.ActiveCfg = Debug|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Debug|x86.Build.0 = Debug|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Release|Any CPU.Build.0 = Release|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Release|x64.ActiveCfg = Release|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Release|x64.Build.0 = Release|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Release|x86.ActiveCfg = Release|Any CPU
{BCC05AA9-F43C-478F-B417-D7E4EFD29362}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build -projects %cd%\src\Swift.Bindings\src\Swift.Bindings.csproj %*"
exit /b %ErrorLevel%
11 changes: 10 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,13 @@ while [[ -h $source ]]; do
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
"$scriptroot/eng/common/build.sh" --build --restore $@

os_name=$(uname -s)
projects=""

if [[ "$os_name" != "Darwin" ]]; then
echo "Not running on macOS. Excluding test projects."
projects="--projects $(pwd)/src/Swift.Bindings/src/Swift.Bindings.csproj"
fi

"$scriptroot/eng/common/build.sh" --build --restore $projects $@
8 changes: 4 additions & 4 deletions eng/pipelines/runtimelab-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ extends:
jobs:
- template: /eng/pipelines/common/templates/build-job.yml
parameters:
osGroup: Windows_NT
osGroup: OSX
archType: x64
isOfficialBuild: true
runTests: false
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows
name: Azure Pipelines
image: macos-latest
os: macOS

- ${{ if eq(variables.isOfficialBuild, true) }}:
- template: /eng/pipelines/common/templates/publish.yml
Expand Down
12 changes: 5 additions & 7 deletions src/Swift.Bindings/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,11 @@ public static void GenerateBindings(Queue<string> paths, string outputDirectory,
}

// Copy the Swift.Runtime library to the output directory
string[] fileEntries = Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Library"));
foreach (string filePath in fileEntries)
{
string fileName = Path.GetFileName(filePath);
string destFilePath = Path.Combine(outputDirectory, fileName);
File.Copy(filePath, destFilePath, true);
}
var libraryDirectory = Path.Combine(Directory.GetParent(outputDirectory)!.FullName, "Library");
Directory.CreateDirectory(libraryDirectory);
var dirInfo = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Library"));
foreach (var fileInfo in dirInfo.GetFiles())
fileInfo.CopyTo(Path.Combine(libraryDirectory, fileInfo.Name), true);
}

/// <summary>
Expand Down
9 changes: 7 additions & 2 deletions src/Swift.Bindings/src/Swift.Bindings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
<Nullable>enable</Nullable>
<PackageReadmeFile>README.md</PackageReadmeFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ToolCommandName>swiftbindings</ToolCommandName>
<PackAsTool>true</PackAsTool>
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../Swift.Runtime/src/Swift.Runtime.csproj" />
<ProjectReference Include="../../Swift.Runtime/src/Swift.Runtime.csproj">
<ReferenceSourceTarget></ReferenceSourceTarget>
</ProjectReference>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.0" />
<None Include="../../../README.md" Pack="true" PackagePath="\"/>
<None Include="../../../README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
41 changes: 0 additions & 41 deletions src/Swift.Bindings/tests/CryptoKit/CryptoKitTests.cs

This file was deleted.

Loading

0 comments on commit d51a97f

Please sign in to comment.