Skip to content
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

[SwiftBindings] Improve testing framework #2871

Merged
merged 20 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
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 $@
3 changes: 2 additions & 1 deletion src/Swift.Bindings/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,12 @@ public static void GenerateBindings(Queue<string> paths, string outputDirectory,
}

kotlarmilos marked this conversation as resolved.
Show resolved Hide resolved
// Copy the Swift.Runtime library to the output directory
Directory.CreateDirectory(Path.Combine(Directory.GetParent(outputDirectory)!.FullName, "Library"));
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);
string destFilePath = Path.Combine(Directory.GetParent(outputDirectory)!.FullName, "Library", fileName);
File.Copy(filePath, destFilePath, true);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/Swift.Bindings/src/Swift.Bindings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
</Project>

139 changes: 0 additions & 139 deletions src/Swift.Bindings/tests/FrozenStructs/FrozenStructsTests.Source.cs

This file was deleted.

Loading