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

[Swift bindings] Add bindings experimental NuGet to the dotnet-experimental feed #2878

Open
wants to merge 16 commits into
base: feature/swift-bindings
Choose a base branch
from

Conversation

kotlarmilos
Copy link
Member

@kotlarmilos kotlarmilos commented Dec 13, 2024

Description

This PR adds binding generation step to the distribution pipeline. To enable testing of the StoreKit framework, we want to provide an experimental NuGet that can be used in real-world applications such as HikingApp. This approach will also allow us to track binding coverage and identify areas for improvement.

Changes

This change introduces a script for generating bindings that runs after the build in the distribution pipeline. The script extracts the ABI for selected frameworks, runs the tooling, and generates NuGet package from source code. The package is then distributed using darc in the dotnet-experimental feed.

Verification

The pipeline was invoked manually. The NuGet package will become available once this change is merged into the feature/swift-bindings branch, which is configured for feed publishing.

Follow-up

Once the package becomes available, we will start introducing framework tests as MacCatalyst apps and track coverage of supported Swift language features from included frameworks.

@kotlarmilos kotlarmilos added the area-SwiftBindings Swift bindings for .NET label Dec 13, 2024
@kotlarmilos kotlarmilos self-assigned this Dec 13, 2024
@kotlarmilos kotlarmilos removed the request for review from Copilot December 13, 2024 13:42
</ItemGroup>

<!-- Reference Swift.Bindings.MacOSX.Experimental from dotnet-experimental feed -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For tests, I think you want to reference local copy of the package that was just built.

Base automatically changed from swift-bindings/testing-framework to feature/swift-bindings December 17, 2024 15:53
@kotlarmilos
Copy link
Member Author

@EgorBot -codesafety

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use xcode-select -p to figure out path to Xcode rather than hardcoding /Applications

function InvokeProjectionTooling {
local framework=$1

$scriptroot/.dotnet/dotnet $scriptroot/artifacts/bin/Swift.Bindings/Release/net9.0/Swift.Bindings.dll -a "$framework" -o "./"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$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 "./"

</Project>
EOL

$scriptroot/.dotnet/dotnet pack "$project_file"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$scriptroot/.dotnet/dotnet pack "$project_file"
$scriptroot/dotnet.sh pack "$project_file"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-SwiftBindings Swift bindings for .NET
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants