Skip to content

Fix CI & a bunch of cross-platform issues #999

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 19 commits into from
Aug 5, 2022
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
34 changes: 24 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,40 @@ jobs:
os: windows-latest
- rid: win-x86
os: windows-latest

# given there appear to be significant differences
# we test all available ubuntu versions here
# if this causes significant slow downs, remove
- rid: linux-x64
os: ubuntu-22.04
- rid: linux-x64

# no clangsharp support https://github.com/dotnet/ClangSharp/issues/364
# - rid: linux-x64
# os: ubuntu-22.04

- rid: ubuntu.20.04-x64
os: ubuntu-20.04
- rid: linux-x64
os: ubuntu-18.04

# Ubuntu raises an SEH exception, see https://discord.com/channels/521092042781229087/1004867182787838043/1004887853500739684
# - rid: ubuntu.18.04-x64
# os: ubuntu-18.04

# macos 10.15 is not tested as the runner image is deprecated.
- rid: osx.12-x64
os: macos-12
- rid: osx.11.0-x64
os: macos-11

# OSX is currently broken as standard headers (stdint.h) can't be found
# - rid: osx.12-x64
# os: macos-12
# - rid: osx.11.0-x64
# os: macos-11
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: "true"
- name: Setup .NET
uses: actions/setup-dotnet@v2
- name: Restore
run: dotnet restore --runtime ${{ matrix.rid }}
# Build can't be done in a separate step as building for a specific runtime & configuration is unsupported for some reason...
# https://github.com/dotnet/sdk/issues/14281
# doing the same (building for a specific configuration and runtime is supported via dotnet test)
- name: Test
run: dotnet test -c Release --no-build --runtime ${{ matrix.rid }}
run: dotnet test -c Release --no-restore --runtime ${{ matrix.rid }}
10 changes: 6 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
This file tracks all package versions used in Silk.NET, including tests.
For more information what this is see https://github.com/NuGet/Home/wiki/Centrally-managing-NuGet-package-versions
-->
<PropertyGroup>
<RoslynPackageVersion>4.2.0</RoslynPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.0-2.final"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynPackageVersion)"/>
<PackageVersion Include="System.Text.Json" Version="6.0.5"/>
<PackageVersion Include="ClangSharp.PInvokeGenerator" Version="14.0.0-beta2"/>
<PackageVersion Include="Microsoft.Build.Locator" Version="1.4.1"/>
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="6.0.0-preview.6.21352.12"/>
<PackageVersion Include="Microsoft.Build.Framework" Version="16.10.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.0.0-2.final"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynPackageVersion)"/>
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="$(RoslynPackageVersion)"/>
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta1.21308.1"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0"/>
Expand All @@ -38,7 +41,6 @@
<PackageVersion Include="Statiq.Razor" Version="1.0.0-beta.48"/>
<PackageVersion Include="Statiq.Yaml" Version="1.0.0-beta.48"/>
<PackageVersion Include="Humanizer.Core" Version="2.14.1"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0"/>
<PackageVersion Include="Moq" Version="4.17.2"/>
<PackageVersion Include="System.Collections.Immutable" Version="6.0.0"/>
<PackageVersion Include="libclang" Version="14.0.0"/>
Expand Down
15 changes: 7 additions & 8 deletions src/generators/Silk.NET.SilkTouch.Scraper/ClangScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,19 @@ Stream OutputStreamFactory(string fileName)
return files[fileName] = new MemoryStream();
}


var commandLineArgs = new string[3 + definedMacros.Length + includeDirectories.Length];
commandLineArgs[0] = "--language=c++";
commandLineArgs[1] = "--std=c++17";
commandLineArgs[2] = "-Wno-pragma-once-outside-header";
var commandLineArgs = new List<string>();
commandLineArgs.Add("--language=c++");
commandLineArgs.Add("--std=c++17");
commandLineArgs.Add("-Wno-pragma-once-outside-header");

for (int i = 0; i < definedMacros.Length; i++)
{
commandLineArgs[3 + i] = "--define-macro=" + definedMacros[i];
commandLineArgs.Add("--define-macro=" + definedMacros[i]);
}

for (int i = 0; i < includeDirectories.Length; i++)
{
commandLineArgs[3 + definedMacros.Length] = "--include-directory=" + definedMacros[i];
commandLineArgs.Add("--include-directory=" + includeDirectories[i]);
}

var translationFlags = CXTranslationUnit_Flags.CXTranslationUnit_None;
Expand All @@ -106,7 +105,7 @@ Stream OutputStreamFactory(string fileName)
try
{
using (var pinvokeGenerator = new PInvokeGenerator(config, OutputStreamFactory))
GenerateBindings(pinvokeGenerator, headerFile, commandLineArgs, translationFlags);
GenerateBindings(pinvokeGenerator, headerFile, commandLineArgs.ToArray(), translationFlags);

foreach (var (name, stream) in files)
{
Expand Down