From 076f3c31b7389123c3ff4c145fd1ae6a2876d1bb Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 11:08:01 +0100 Subject: [PATCH 01/15] Test bindings build --- .gitignore | 5 +- eng/pipelines/common/templates/build-job.yml | 9 ++ eng/pipelines/runtimelab-official.yml | 5 + generate.sh | 93 +++++++++++++++++++ src/Swift.Bindings/src/Program.cs | 17 +++- .../Swift.Bindings.Integration.Tests.csproj | 2 +- .../SwiftHandle.cs | 0 .../UnsafeBufferPointer.cs | 0 .../UnsafePointer.cs | 0 .../src/{Library => Metadata}/Arc.cs | 0 src/Swift.Runtime/src/Swift.Runtime.csproj | 4 +- 11 files changed, 124 insertions(+), 11 deletions(-) create mode 100755 generate.sh rename src/Swift.Runtime/src/{Library => ManualBindings}/SwiftHandle.cs (100%) rename src/Swift.Runtime/src/{Library => ManualBindings}/UnsafeBufferPointer.cs (100%) rename src/Swift.Runtime/src/{Library => ManualBindings}/UnsafePointer.cs (100%) rename src/Swift.Runtime/src/{Library => Metadata}/Arc.cs (100%) diff --git a/.gitignore b/.gitignore index e973ccc28494..331e79707a4f 100644 --- a/.gitignore +++ b/.gitignore @@ -201,6 +201,5 @@ launchSettings.json # Testing artifacts testing/ -src/samples/**/Unsafe*.cs -src/samples/**/Swift.*.cs -src/samples/**/Library/*.cs +src/samples/ +GeneratedBindings/ \ No newline at end of file diff --git a/eng/pipelines/common/templates/build-job.yml b/eng/pipelines/common/templates/build-job.yml index 6cd00fb677f1..a11f73ec6ba2 100644 --- a/eng/pipelines/common/templates/build-job.yml +++ b/eng/pipelines/common/templates/build-job.yml @@ -6,6 +6,11 @@ parameters: pool: {} isOfficialBuild: false runTests: true + bindings: + target: '' + arch: '' + IsMetadataOnlyBuild: false + frameworks: [] jobs: @@ -51,6 +56,10 @@ jobs: /p:TargetPlatform=${{ parameters.archType }} displayName: Build and Test + - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: + - script: ./generate.sh ${{ parameters.bindings.target }} ${{ parameters.bindings.arch }} ${{ parameters.bindings.IsMetadataOnlyBuild }} ${{ parameters.bindings.frameworks }} + displayName: Generate Bindings + - ${{ if eq(parameters.isOfficialBuild, true) }}: - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml parameters: diff --git a/eng/pipelines/runtimelab-official.yml b/eng/pipelines/runtimelab-official.yml index 6a7131a6fb13..733fa88cf8c1 100644 --- a/eng/pipelines/runtimelab-official.yml +++ b/eng/pipelines/runtimelab-official.yml @@ -47,6 +47,11 @@ extends: name: Azure Pipelines image: macos-latest os: macOS + bindings: + target: MacOSX + arch: arm64e-apple-macos + frameworks: ["StoreKit", "SwiftUI"] + IsMetadataOnlyBuild: true - ${{ if eq(variables.isOfficialBuild, true) }}: - template: /eng/pipelines/common/templates/publish.yml diff --git a/generate.sh b/generate.sh new file mode 100755 index 000000000000..a7a7621c33ca --- /dev/null +++ b/generate.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +if [ "$#" -lt 4 ]; then + echo "Usage: $0 [ ...]" + exit 1 +fi + +# Parse arguments +PLATFORM=$1 +ARCHITECTURE=$2 + +shift 2 +# Remove framework bindings if --metadata-only flag is passed +REMOVE_BINDINGS=false +FRAMEWORKS=() + +for arg in "$@"; do + if [ "$arg" == "--metadata-only" ]; then + REMOVE_BINDINGS=true + else + FRAMEWORKS+=("$arg") + fi +done + +# Output directory for generated bindings +OUTPUT_DIR="./GeneratedBindings" +rm -rf "$OUTPUT_DIR" +mkdir -p "$OUTPUT_DIR" + +cd $OUTPUT_DIR + +# Function to extract ABI file +extract_abi_json() { + local framework=$1 + + local sdk_path=$(xcrun -sdk $(echo "$PLATFORM" | tr '[:upper:]' '[:lower:]') --show-sdk-path) + local swift_interface_path="/Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}.sdk/System/Library/Frameworks/${framework}.framework/Versions/Current/Modules/${framework}.swiftmodule/${ARCHITECTURE}.swiftinterface" + + if [ ! -f "$swift_interface_path" ]; then + echo "Error: Swift interface file not found for framework '$framework'." + return 1 + fi + + xcrun swift-frontend -compile-module-from-interface "$swift_interface_path" \ + -module-name "$framework" \ + -sdk "$sdk_path" \ + -emit-abi-descriptor-path "./${framework}.abi.json" +} + +# Function to generate bindings +generate_dotnet_bindings() { + local framework=$1 + + dotnet ../artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "$OUTPUT_DIR" + + if $REMOVE_BINDINGS; then + rm -rf "./Swift.$framework.cs" + fi +} + +# Function to generate NuGet package +generate_nuget_package() { + local project_file="./Swift.Bindings.${PLATFORM}.Experimental.csproj" + + cat < "$project_file" + + + net9.0 + enable + enable + true + true + + +EOL + + dotnet pack "$project_file" +} + +# Process each framework +for framework in "${FRAMEWORKS[@]}"; do + echo "Processing framework: $framework" + + if extract_abi_json "$framework"; then + generate_dotnet_bindings "$framework" + else + echo "Skipping framework '$framework' due to errors." + fi +done + +generate_nuget_package + +echo "Process completed." diff --git a/src/Swift.Bindings/src/Program.cs b/src/Swift.Bindings/src/Program.cs index d4660e045594..986e4a6fff78 100644 --- a/src/Swift.Bindings/src/Program.cs +++ b/src/Swift.Bindings/src/Program.cs @@ -182,11 +182,18 @@ public static void GenerateBindings(Queue paths, string outputDirectory, } // Copy the Swift.Runtime library to the output directory - 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); + string[] sourceDirectories = { "Metadata", "ManualBindings" }; + foreach (var sourceDir in sourceDirectories) + { + var destinationDirectory = Path.Combine(Directory.GetParent(outputDirectory)!.FullName, sourceDir); + Directory.CreateDirectory(destinationDirectory); + + var sourceDirInfo = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, sourceDir)); + foreach (var fileInfo in sourceDirInfo.GetFiles()) + { + fileInfo.CopyTo(Path.Combine(destinationDirectory, fileInfo.Name), true); + } + } } /// diff --git a/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj b/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj index 2a9ea01e2770..fba456d613ff 100644 --- a/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj +++ b/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj @@ -21,7 +21,7 @@ - + diff --git a/src/Swift.Runtime/src/Library/SwiftHandle.cs b/src/Swift.Runtime/src/ManualBindings/SwiftHandle.cs similarity index 100% rename from src/Swift.Runtime/src/Library/SwiftHandle.cs rename to src/Swift.Runtime/src/ManualBindings/SwiftHandle.cs diff --git a/src/Swift.Runtime/src/Library/UnsafeBufferPointer.cs b/src/Swift.Runtime/src/ManualBindings/UnsafeBufferPointer.cs similarity index 100% rename from src/Swift.Runtime/src/Library/UnsafeBufferPointer.cs rename to src/Swift.Runtime/src/ManualBindings/UnsafeBufferPointer.cs diff --git a/src/Swift.Runtime/src/Library/UnsafePointer.cs b/src/Swift.Runtime/src/ManualBindings/UnsafePointer.cs similarity index 100% rename from src/Swift.Runtime/src/Library/UnsafePointer.cs rename to src/Swift.Runtime/src/ManualBindings/UnsafePointer.cs diff --git a/src/Swift.Runtime/src/Library/Arc.cs b/src/Swift.Runtime/src/Metadata/Arc.cs similarity index 100% rename from src/Swift.Runtime/src/Library/Arc.cs rename to src/Swift.Runtime/src/Metadata/Arc.cs diff --git a/src/Swift.Runtime/src/Swift.Runtime.csproj b/src/Swift.Runtime/src/Swift.Runtime.csproj index a3c2294f4af1..09dd3eb3462c 100644 --- a/src/Swift.Runtime/src/Swift.Runtime.csproj +++ b/src/Swift.Runtime/src/Swift.Runtime.csproj @@ -15,10 +15,10 @@ PreserveNewest - + PreserveNewest - + PreserveNewest From 67e3206414e4f2e8ba0a0df5224da455c2da81c1 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 11:09:37 +0100 Subject: [PATCH 02/15] Test bindings build --- eng/pipelines/common/templates/build-job.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/templates/build-job.yml b/eng/pipelines/common/templates/build-job.yml index a11f73ec6ba2..a3e714389977 100644 --- a/eng/pipelines/common/templates/build-job.yml +++ b/eng/pipelines/common/templates/build-job.yml @@ -56,8 +56,8 @@ jobs: /p:TargetPlatform=${{ parameters.archType }} displayName: Build and Test - - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - - script: ./generate.sh ${{ parameters.bindings.target }} ${{ parameters.bindings.arch }} ${{ parameters.bindings.IsMetadataOnlyBuild }} ${{ parameters.bindings.frameworks }} + - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: + - script: ./generate.sh ${{ parameters.bindings.target }} ${{ parameters.bindings.arch }} ${{ parameters.bindings.IsMetadataOnlyBuild }} ${{ parameters.bindings.frameworks }} displayName: Generate Bindings - ${{ if eq(parameters.isOfficialBuild, true) }}: From c8b97c32d657b2fcb9f073c4a375bbb403959818 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 11:10:29 +0100 Subject: [PATCH 03/15] Test bindings build --- eng/pipelines/common/templates/build-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/templates/build-job.yml b/eng/pipelines/common/templates/build-job.yml index a3e714389977..614c9c49df3a 100644 --- a/eng/pipelines/common/templates/build-job.yml +++ b/eng/pipelines/common/templates/build-job.yml @@ -57,7 +57,7 @@ jobs: displayName: Build and Test - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - - script: ./generate.sh ${{ parameters.bindings.target }} ${{ parameters.bindings.arch }} ${{ parameters.bindings.IsMetadataOnlyBuild }} ${{ parameters.bindings.frameworks }} + - script: ./generate.sh ${{ parameters.bindings.target }} ${{ parameters.bindings.arch }} ${{ parameters.bindings.IsMetadataOnlyBuild }} ${{ join(parameters.bindings.frameworks, ' ') }} displayName: Generate Bindings - ${{ if eq(parameters.isOfficialBuild, true) }}: From a38d7ef0df80f38fe0bcd20969e19858bf972d6b Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 11:13:55 +0100 Subject: [PATCH 04/15] Test bindings build --- eng/pipelines/common/templates/build-job.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/pipelines/common/templates/build-job.yml b/eng/pipelines/common/templates/build-job.yml index 614c9c49df3a..c38561779744 100644 --- a/eng/pipelines/common/templates/build-job.yml +++ b/eng/pipelines/common/templates/build-job.yml @@ -56,7 +56,6 @@ jobs: /p:TargetPlatform=${{ parameters.archType }} displayName: Build and Test - - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - script: ./generate.sh ${{ parameters.bindings.target }} ${{ parameters.bindings.arch }} ${{ parameters.bindings.IsMetadataOnlyBuild }} ${{ join(parameters.bindings.frameworks, ' ') }} displayName: Generate Bindings From d1f5ad2468150af5fbb937e48fe7827186b2b466 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 11:27:08 +0100 Subject: [PATCH 05/15] Test bindings build --- eng/pipelines/common/templates/build-job.yml | 11 +++++------ eng/pipelines/runtimelab-official.yml | 6 ++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/eng/pipelines/common/templates/build-job.yml b/eng/pipelines/common/templates/build-job.yml index c38561779744..1ae4b1faeef2 100644 --- a/eng/pipelines/common/templates/build-job.yml +++ b/eng/pipelines/common/templates/build-job.yml @@ -7,10 +7,8 @@ parameters: isOfficialBuild: false runTests: true bindings: - target: '' - arch: '' - IsMetadataOnlyBuild: false - frameworks: [] + isBindingsBuild: false + scriptArgs: '' jobs: @@ -56,8 +54,9 @@ jobs: /p:TargetPlatform=${{ parameters.archType }} displayName: Build and Test - - script: ./generate.sh ${{ parameters.bindings.target }} ${{ parameters.bindings.arch }} ${{ parameters.bindings.IsMetadataOnlyBuild }} ${{ join(parameters.bindings.frameworks, ' ') }} - displayName: Generate Bindings + - ${{ if and(eq(parameters.bindings.isBindingsBuild, true), ne(parameters.osGroup, 'Windows_NT')) }}: + - script: ./generate.sh ${{ parameters.bindings.scriptArgs }} + displayName: Generate Bindings - ${{ if eq(parameters.isOfficialBuild, true) }}: - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml diff --git a/eng/pipelines/runtimelab-official.yml b/eng/pipelines/runtimelab-official.yml index 733fa88cf8c1..cfacb057963e 100644 --- a/eng/pipelines/runtimelab-official.yml +++ b/eng/pipelines/runtimelab-official.yml @@ -48,10 +48,8 @@ extends: image: macos-latest os: macOS bindings: - target: MacOSX - arch: arm64e-apple-macos - frameworks: ["StoreKit", "SwiftUI"] - IsMetadataOnlyBuild: true + isBindingsBuild: true + scriptArgs: 'MacOSX arm64e-apple-macos --metadata-only StoreKit SwiftUI' - ${{ if eq(variables.isOfficialBuild, true) }}: - template: /eng/pipelines/common/templates/publish.yml From a49ab38e588a23204b8f6a39ca8198f03343756d Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 11:48:36 +0100 Subject: [PATCH 06/15] Test bindings build --- generate.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/generate.sh b/generate.sh index a7a7621c33ca..404c0984091c 100755 --- a/generate.sh +++ b/generate.sh @@ -1,5 +1,21 @@ #!/bin/bash +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +source ./eng/common/tools.sh + if [ "$#" -lt 4 ]; then echo "Usage: $0 [ ...]" exit 1 @@ -77,6 +93,8 @@ EOL dotnet pack "$project_file" } +InitializeToolset + # Process each framework for framework in "${FRAMEWORKS[@]}"; do echo "Processing framework: $framework" From 70002ab51cc332166e698e2bcdd75c883aaca07f Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 11:59:33 +0100 Subject: [PATCH 07/15] Test bindings build --- generate.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/generate.sh b/generate.sh index 404c0984091c..2b1ba7818155 100755 --- a/generate.sh +++ b/generate.sh @@ -1,20 +1,6 @@ #!/bin/bash -source="${BASH_SOURCE[0]}" - -# resolve $SOURCE until the file is no longer a symlink -while [[ -h $source ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done - -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -source ./eng/common/tools.sh +./build.sh if [ "$#" -lt 4 ]; then echo "Usage: $0 [ ...]" @@ -93,8 +79,6 @@ EOL dotnet pack "$project_file" } -InitializeToolset - # Process each framework for framework in "${FRAMEWORKS[@]}"; do echo "Processing framework: $framework" From 40781e83c66c95594562323f72395cf262e12dd8 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 12:24:15 +0100 Subject: [PATCH 08/15] Test bindings build --- generate.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/generate.sh b/generate.sh index 2b1ba7818155..4d886da4312b 100755 --- a/generate.sh +++ b/generate.sh @@ -1,7 +1,5 @@ #!/bin/bash -./build.sh - if [ "$#" -lt 4 ]; then echo "Usage: $0 [ ...]" exit 1 @@ -53,7 +51,7 @@ extract_abi_json() { generate_dotnet_bindings() { local framework=$1 - dotnet ../artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "$OUTPUT_DIR" + ../.dotnet/dotnet ../artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "$OUTPUT_DIR" if $REMOVE_BINDINGS; then rm -rf "./Swift.$framework.cs" @@ -76,7 +74,7 @@ generate_nuget_package() { EOL - dotnet pack "$project_file" + ../.dotnet/dotnet pack "$project_file" } # Process each framework From 2260301be63eb1cdc976b102860487ef7b42ef15 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 13:24:48 +0100 Subject: [PATCH 09/15] Test bindings build --- eng/pipelines/runtimelab-official.yml | 2 +- generate.sh | 135 +++++++++++++++++--------- 2 files changed, 90 insertions(+), 47 deletions(-) diff --git a/eng/pipelines/runtimelab-official.yml b/eng/pipelines/runtimelab-official.yml index cfacb057963e..950bfad57479 100644 --- a/eng/pipelines/runtimelab-official.yml +++ b/eng/pipelines/runtimelab-official.yml @@ -49,7 +49,7 @@ extends: os: macOS bindings: isBindingsBuild: true - scriptArgs: 'MacOSX arm64e-apple-macos --metadata-only StoreKit SwiftUI' + scriptArgs: '--platform MacOSX --arch arm64e-apple-macos --framework StoreKit --framework SwiftUI --experimental' - ${{ if eq(variables.isOfficialBuild, true) }}: - template: /eng/pipelines/common/templates/publish.yml diff --git a/generate.sh b/generate.sh index 4d886da4312b..db438cd76ce1 100755 --- a/generate.sh +++ b/generate.sh @@ -1,40 +1,80 @@ -#!/bin/bash - -if [ "$#" -lt 4 ]; then - echo "Usage: $0 [ ...]" - exit 1 -fi - -# Parse arguments -PLATFORM=$1 -ARCHITECTURE=$2 - -shift 2 -# Remove framework bindings if --metadata-only flag is passed -REMOVE_BINDINGS=false -FRAMEWORKS=() - -for arg in "$@"; do - if [ "$arg" == "--metadata-only" ]; then - REMOVE_BINDINGS=true - else - FRAMEWORKS+=("$arg") - fi +#!/usr/bin/env bash + +usage() +{ + echo "Common settings:" + echo " --platform Platform: MacOSX, iPhoneOS, iPhoneSimulator, AppleTVOS, AppleTVSimulator" + echo " --arch Architecture: arm64e-apple-macos, x86_64-apple-macos" + echo " --framework Framework to generate bindings for" + echo " --help Print help and exit (short: -h)" + echo "" + + echo "Actions:" + echo " --experimental Generates only Runtime.Swift namespace when bindings for frameworks are not complete" +} + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +platform='' +arch='' +frameworks=() +experimental=false + +output_dir="./GeneratedBindings" + +while [[ $# > 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -help|-h) + usage + exit 0 + ;; + -experimental) + experimental=true + ;; + -platform) + platform=$2 + shift + ;; + -arch) + arch=$2 + shift + ;; + -framework) + frameworks+=("$2") + shift + ;; + esac + + shift done # Output directory for generated bindings -OUTPUT_DIR="./GeneratedBindings" -rm -rf "$OUTPUT_DIR" -mkdir -p "$OUTPUT_DIR" +rm -rf "$output_dir" +mkdir -p "$output_dir" -cd $OUTPUT_DIR +cd "$output_dir" # Function to extract ABI file -extract_abi_json() { +function ExtractABI { local framework=$1 - local sdk_path=$(xcrun -sdk $(echo "$PLATFORM" | tr '[:upper:]' '[:lower:]') --show-sdk-path) - local swift_interface_path="/Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}.sdk/System/Library/Frameworks/${framework}.framework/Versions/Current/Modules/${framework}.swiftmodule/${ARCHITECTURE}.swiftinterface" + echo "Generating ABI for framework '$framework', platform '$platform', architecture '$arch'" + + local sdk_path=$(xcrun -sdk $(echo "$platform" | tr '[:upper:]' '[:lower:]') --show-sdk-path) + local swift_interface_path="/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}.sdk/System/Library/Frameworks/${framework}.framework/Versions/Current/Modules/${framework}.swiftmodule/${arch}.swiftinterface" if [ ! -f "$swift_interface_path" ]; then echo "Error: Swift interface file not found for framework '$framework'." @@ -48,19 +88,19 @@ extract_abi_json() { } # Function to generate bindings -generate_dotnet_bindings() { +function InvokeProjectionTooling { local framework=$1 - ../.dotnet/dotnet ../artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "$OUTPUT_DIR" + $scriptroot/.dotnet/dotnet $scriptroot/artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "./" - if $REMOVE_BINDINGS; then + if $experimental; then rm -rf "./Swift.$framework.cs" fi } # Function to generate NuGet package -generate_nuget_package() { - local project_file="./Swift.Bindings.${PLATFORM}.Experimental.csproj" +function PackNuGet { + local project_file="./Swift.Bindings.${platform}.Experimental.csproj" cat < "$project_file" @@ -74,20 +114,23 @@ generate_nuget_package() { EOL - ../.dotnet/dotnet pack "$project_file" + $scriptroot/.dotnet/dotnet pack "$project_file" } -# Process each framework -for framework in "${FRAMEWORKS[@]}"; do - echo "Processing framework: $framework" +function Generate { + for framework in "${frameworks[@]}"; do + echo "Processing framework: $framework" - if extract_abi_json "$framework"; then - generate_dotnet_bindings "$framework" - else - echo "Skipping framework '$framework' due to errors." - fi -done + if ExtractABI "$framework"; then + InvokeProjectionTooling "$framework" + else + echo "Skipping framework '$framework' due to errors." + fi + done -generate_nuget_package + PackNuGet + + echo "Process completed." +} -echo "Process completed." +Generate From af128f2568649c8d0c512084d2a3d908cd3fdc04 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 14:09:08 +0100 Subject: [PATCH 10/15] Move HikingApp to FrameworkTests --- .../HikingApp/HikingApp.MacCatalyst/.gitignore | 0 .../HikingApp/HikingApp.MacCatalyst/AppDelegate.cs | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/AppIcon.appiconset/Icon1024.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon128.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon16.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon256.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon32.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon512.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon64.png | Bin .../TrailImage.imageset/Contents.json | 0 .../TrailImage.imageset/TrailImage.svg | 0 .../HikingApp.MacCatalyst/Directory.Build.props | 0 .../HikingApp.MacCatalyst/Entitlements.plist | 0 .../HikingApp.MacCatalyst.csproj | 7 ++++++- .../HikingApp.MacCatalyst/HikingApp.MacCatalyst.sln | 0 .../HikingApp/HikingApp.MacCatalyst/Info.plist | 0 .../HikingApp/HikingApp.MacCatalyst/Main.cs | 0 .../HikingApp/HikingApp.MacCatalyst/Models/Trail.cs | 0 .../HikingApp/HikingApp.MacCatalyst/README.md | 0 .../Resources/LaunchScreen.xib | 0 .../HikingApp.MacCatalyst/SceneDelegate.cs | 0 .../ViewControllers/ExploreViewController.cs | 0 .../ViewControllers/LoginViewController.cs | 0 .../ViewControllers/MainViewController.cs | 0 .../ViewControllers/MyTrailsViewController.cs | 0 .../ViewControllers/TrailViewController.cs | 0 .../Swift.Bindings.Framework.Tests.csproj | 11 ----------- 28 files changed, 6 insertions(+), 12 deletions(-) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/.gitignore (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/AppDelegate.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon1024.png (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon128.png (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon16.png (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon256.png (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon32.png (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon512.png (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon64.png (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/Contents.json (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/TrailImage.svg (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Directory.Build.props (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Entitlements.plist (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.csproj (94%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.sln (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Info.plist (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Main.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Models/Trail.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/README.md (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/Resources/LaunchScreen.xib (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/SceneDelegate.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/ViewControllers/ExploreViewController.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/ViewControllers/LoginViewController.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/ViewControllers/MainViewController.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/ViewControllers/MyTrailsViewController.cs (100%) rename src/{samples => Swift.Bindings/tests/FrameworkTests}/HikingApp/HikingApp.MacCatalyst/ViewControllers/TrailViewController.cs (100%) delete mode 100644 src/Swift.Bindings/tests/FrameworkTests/Swift.Bindings.Framework.Tests.csproj diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/.gitignore b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/.gitignore similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/.gitignore rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/.gitignore diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/AppDelegate.cs b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/AppDelegate.cs similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/AppDelegate.cs rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/AppDelegate.cs diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Contents.json rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon1024.png b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon1024.png similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon1024.png rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon1024.png diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon128.png b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon128.png similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon128.png rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon128.png diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon16.png b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon16.png similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon16.png rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon16.png diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon256.png b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon256.png similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon256.png rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon256.png diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon32.png b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon32.png similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon32.png rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon32.png diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon512.png b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon512.png similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon512.png rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon512.png diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon64.png b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon64.png similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon64.png rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/AppIcon.appiconset/Icon64.png diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/Contents.json b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/Contents.json similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/Contents.json rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/Contents.json diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/TrailImage.svg b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/TrailImage.svg similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/TrailImage.svg rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Assets.xcassets/TrailImage.imageset/TrailImage.svg diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Directory.Build.props b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Directory.Build.props similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Directory.Build.props rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Directory.Build.props diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/Entitlements.plist b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Entitlements.plist similarity index 100% rename from src/samples/HikingApp/HikingApp.MacCatalyst/Entitlements.plist rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/Entitlements.plist diff --git a/src/samples/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.csproj b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.csproj similarity index 94% rename from src/samples/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.csproj rename to src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.csproj index cd4c7496fec0..82bc2f591731 100644 --- a/src/samples/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.csproj +++ b/src/Swift.Bindings/tests/FrameworkTests/HikingApp/HikingApp.MacCatalyst/HikingApp.MacCatalyst.csproj @@ -24,9 +24,14 @@ false - + + + + + From ae322434816a84a4121071603c0ced47d47e9604 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 13 Dec 2024 16:32:12 +0100 Subject: [PATCH 13/15] Ensure generated bindings are AOT compatible --- generate.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generate.sh b/generate.sh index db438cd76ce1..2f8dd9d1399b 100755 --- a/generate.sh +++ b/generate.sh @@ -110,6 +110,8 @@ function PackNuGet { enable true true + true + true EOL From f6b333e90e184e6244cd7eb011a216db2fb89edc Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 18 Dec 2024 17:21:35 +0100 Subject: [PATCH 14/15] Remove unused test helper --- src/Swift.Bindings/tests/TestsHelper.cs | 93 ------------------------- 1 file changed, 93 deletions(-) delete mode 100644 src/Swift.Bindings/tests/TestsHelper.cs diff --git a/src/Swift.Bindings/tests/TestsHelper.cs b/src/Swift.Bindings/tests/TestsHelper.cs deleted file mode 100644 index 4cc4b23d3917..000000000000 --- a/src/Swift.Bindings/tests/TestsHelper.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System.Reflection; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.Emit; -using Swift.Runtime; - -namespace BindingsGeneration.Tests -{ - public static class TestsHelper - { - private static int uniqueId = 0; - - public static string Compile(string[] filePaths, string[] sourceCodes, string[] dependencies) - { - var expandedFilePaths = ExpandFilePaths(filePaths); - Console.WriteLine($"Expanded file paths: {string.Join(", ", expandedFilePaths)}"); - var fileSourceCodes = expandedFilePaths.Select(File.ReadAllText).ToArray(); - var allSourceCodes = fileSourceCodes.Concat(sourceCodes).ToArray(); - - var options = new CSharpCompilationOptions(OutputKind.ConsoleApplication, allowUnsafe: true); - var syntaxTrees = allSourceCodes.Select(code => CSharpSyntaxTree.ParseText(code)).ToArray(); - - var references = new List - { - MetadataReference.CreateFromFile(typeof(object).Assembly.Location), - MetadataReference.CreateFromFile(typeof(Console).Assembly.Location), - MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location), - MetadataReference.CreateFromFile(typeof(TypeMetadata).Assembly.Location), - MetadataReference.CreateFromFile(Assembly.Load("System.Runtime").Location), - MetadataReference.CreateFromFile(Assembly.Load("System.Runtime.InteropServices").Location), - }; - - foreach (string dependency in dependencies) - { - references.Add(MetadataReference.CreateFromFile(Assembly.Load(dependency).Location)); - } - - var compilation = CSharpCompilation.Create($"CompiledAssembly{uniqueId}", - syntaxTrees: syntaxTrees, - references: references, - options: options); - - string assemblyPath = Path.Combine(Path.GetTempPath(), $"CompiledAssembly{uniqueId++}.dll"); - using (var stream = new FileStream(assemblyPath, FileMode.Create)) - { - EmitResult emitResult = compilation.Emit(stream); - - if (!emitResult.Success) - { - string errorMessage = "Compilation failed:"; - foreach (var diagnostic in emitResult.Diagnostics) - { - errorMessage += $"\n{diagnostic}"; - } - throw new InvalidOperationException(errorMessage); - } - - return assemblyPath; - } - } - - public static object Execute(string assemblyPath, string typeName, string methodName, object[] args) - { - Assembly compiledAssembly = Assembly.LoadFile(assemblyPath); - Type targetType = compiledAssembly.GetType(typeName); - MethodInfo customMethod = targetType.GetMethod(methodName); - return customMethod.Invoke(null, args); - } - - private static IEnumerable ExpandFilePaths(IEnumerable filePaths) - { - foreach (var path in filePaths) - { - if (path.Contains("*")) - { - var dirPath = Path.GetDirectoryName(path); - var searchPattern = Path.GetFileName(path); - foreach (var expandedPath in Directory.GetFiles(dirPath, searchPattern)) - { - yield return expandedPath; - } - } - else - { - yield return path; - } - } - } - } -} From ebcfc99dc24a9b81f0b5517b710291f6f9e912a3 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 19 Dec 2024 11:26:24 +0100 Subject: [PATCH 15/15] Add dotnet.sh --- dotnet.sh | 27 +++++++++++++++++++ generate.sh | 6 ++--- .../tests/IntegrationTests/CMakeLists.txt | 2 +- .../Swift.Bindings.Integration.Tests.csproj | 2 +- 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100755 dotnet.sh diff --git a/dotnet.sh b/dotnet.sh new file mode 100755 index 000000000000..a612ebac1ce1 --- /dev/null +++ b/dotnet.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +# Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism +export DOTNET_MULTILEVEL_LOOKUP=0 + +# Disable first run since we want to control all package sources +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + +source $scriptroot/eng/common/tools.sh + +InitializeDotNetCli true # Install +__dotnetDir=${_InitializeDotNetCli} + +dotnetPath=${__dotnetDir}/dotnet +${dotnetPath} "$@" diff --git a/generate.sh b/generate.sh index 2f8dd9d1399b..bd3276450203 100755 --- a/generate.sh +++ b/generate.sh @@ -74,7 +74,7 @@ function ExtractABI { echo "Generating ABI for framework '$framework', platform '$platform', architecture '$arch'" local sdk_path=$(xcrun -sdk $(echo "$platform" | tr '[:upper:]' '[:lower:]') --show-sdk-path) - local swift_interface_path="/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}.sdk/System/Library/Frameworks/${framework}.framework/Versions/Current/Modules/${framework}.swiftmodule/${arch}.swiftinterface" + local swift_interface_path="$(xcode-select -p)/Platforms/${platform}.platform/Developer/SDKs/${platform}.sdk/System/Library/Frameworks/${framework}.framework/Versions/Current/Modules/${framework}.swiftmodule/${arch}.swiftinterface" if [ ! -f "$swift_interface_path" ]; then echo "Error: Swift interface file not found for framework '$framework'." @@ -91,7 +91,7 @@ function ExtractABI { function InvokeProjectionTooling { local framework=$1 - $scriptroot/.dotnet/dotnet $scriptroot/artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "./" + $scriptroot/dotnet.sh $scriptroot/artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "./" if $experimental; then rm -rf "./Swift.$framework.cs" @@ -116,7 +116,7 @@ function PackNuGet { EOL - $scriptroot/.dotnet/dotnet pack "$project_file" + $scriptroot/dotnet.sh pack "$project_file" } function Generate { diff --git a/src/Swift.Bindings/tests/IntegrationTests/CMakeLists.txt b/src/Swift.Bindings/tests/IntegrationTests/CMakeLists.txt index 9bc9e45621fd..4e78488f027e 100644 --- a/src/Swift.Bindings/tests/IntegrationTests/CMakeLists.txt +++ b/src/Swift.Bindings/tests/IntegrationTests/CMakeLists.txt @@ -39,7 +39,7 @@ foreach(SOURCE_FILE ${SOURCES}) get_filename_component(DOTNET_CONFIGURATION ${DOTNET_CONFIGURATION} NAME) add_custom_command(TARGET ${SOURCE_BASE_NAME} POST_BUILD - COMMAND dotnet ${CMAKE_BINARY_DIR}/../../../Swift.Bindings/${DOTNET_CONFIGURATION}/${DOTNET_VERSION}/Swift.Bindings.dll -a ${OUTPUT_DIR}/${SOURCE_BASE_NAME}.abi.json -o ${OUTPUT_DIR} + COMMAND ${CMAKE_SOURCE_DIR}/../../../../dotnet.sh ${CMAKE_BINARY_DIR}/../../../Swift.Bindings/${DOTNET_CONFIGURATION}/${DOTNET_VERSION}/Swift.Bindings.dll -a ${OUTPUT_DIR}/${SOURCE_BASE_NAME}.abi.json -o ${OUTPUT_DIR} COMMENT "Generating ${SOURCE_BASE_NAME} bindings" ) endforeach() diff --git a/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj b/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj index bbd4deea8b1e..624c2ab983da 100644 --- a/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj +++ b/src/Swift.Bindings/tests/IntegrationTests/Swift.Bindings.Integration.Tests.csproj @@ -17,7 +17,7 @@ - +