generated from AArnott/Library.Template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #388 from nerdcash/lib_apple_fixes
Get Nerdbank.Zcash working for store submissions of iOS apps
- Loading branch information
Showing
17 changed files
with
3,585 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>nerdbank_zcash_rust</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleIdentifier</key> | ||
<string>net.nerdbank.zcash</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>$version$</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$version$</string> | ||
<key>CSResourcesFileMapped</key> | ||
<true/> | ||
<key>MinimumOSVersion</key> | ||
<string>17.5</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") | ||
$BuildConfiguration = $env:BUILDCONFIGURATION | ||
if (!$BuildConfiguration) { | ||
$BuildConfiguration = 'Debug' | ||
} | ||
|
||
$BuildConfiguration = $BuildConfiguration.ToLower() | ||
$FrameworkRoot = "$RepoRoot/bin/$BuildConfiguration/nerdbank_zcash_rust.xcframework" | ||
|
||
if (!(Test-Path $FrameworkRoot)) { return } | ||
|
||
@{ | ||
"$FrameworkRoot" = (Get-ChildItem $FrameworkRoot -Recurse) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[parameter()] | ||
[string]$Configuration = 'release' | ||
) | ||
|
||
$repoRoot = Resolve-Path "$PSScriptRoot/.." | ||
$version = dotnet nbgv get-version -p $repoRoot/src/nerdbank-zcash-rust -v SimpleVersion | ||
$plist = Get-Content $PSScriptRoot/Info.plist | ||
$plist = $plist.Replace('$version$', $version) | ||
$IntermediatePlistPath = "$repoRoot/obj/Info.plist" | ||
Set-Content -Path $IntermediatePlistPath -Value $plist -Encoding utf8NoBOM | ||
if ($IsMacOS) { | ||
plutil -convert binary1 $IntermediatePlistPath | ||
chmod +x $IntermediatePlistPath | ||
} | ||
else { | ||
Write-Warning "Skipped plutil invocation because this is not macOS." | ||
} | ||
|
||
# copy Info.plist and the binary into the appropriate .framework directory structure | ||
# so that when NativeBindings.targets references it with ResolvedFileToPublish, it will be treated appropriately. | ||
$RustTargetBaseDir = "$repoRoot/src/nerdbank-zcash-rust/target" | ||
$RustDylibFileName = "libnerdbank_zcash_rust.dylib" | ||
$DeviceRustOutput = "$RustTargetBaseDir/aarch64-apple-ios/$Configuration/$RustDylibFileName" | ||
$SimulatorX64RustOutput = "$RustTargetBaseDir/x86_64-apple-ios/$Configuration/$RustDylibFileName" | ||
$SimulatorArm64RustOutput = "$RustTargetBaseDir/aarch64-apple-ios-sim/$Configuration/$RustDylibFileName" | ||
|
||
$DeviceFrameworkDir = "$repoRoot/bin/$Configuration/device/nerdbank_zcash_rust.framework" | ||
$SimulatorFrameworkDir = "$repoRoot/bin/$Configuration/simulator/nerdbank_zcash_rust.framework" | ||
New-Item -Path $DeviceFrameworkDir,$SimulatorFrameworkDir -ItemType Directory -Force | Out-Null | ||
|
||
Write-Host "Preparing Apple iOS and iOS-simulator frameworks" | ||
|
||
Copy-Item $IntermediatePlistPath "$DeviceFrameworkDir/Info.plist" | ||
Copy-Item $IntermediatePlistPath "$SimulatorFrameworkDir/Info.plist" | ||
Write-Host "Created Info.plist with version $version" | ||
|
||
if ($IsMacOS) { | ||
# Rename the binary that contains the arm64 architecture for device. | ||
lipo -create -output $DeviceFrameworkDir/nerdbank_zcash_rust $DeviceRustOutput | ||
install_name_tool -id "@rpath/nerdbank_zcash_rust.framework/nerdbank_zcash_rust" "$DeviceFrameworkDir/nerdbank_zcash_rust" | ||
chmod +x "$DeviceFrameworkDir/nerdbank_zcash_rust" | ||
|
||
# Create a universal binary that contains both arm64 and x64 architectures for simulator. | ||
lipo -create -output $SimulatorFrameworkDir/nerdbank_zcash_rust $SimulatorX64RustOutput $SimulatorArm64RustOutput | ||
install_name_tool -id "@rpath/nerdbank_zcash_rust.framework/nerdbank_zcash_rust" "$SimulatorFrameworkDir/nerdbank_zcash_rust" | ||
chmod +x "$SimulatorFrameworkDir/nerdbank_zcash_rust" | ||
} | ||
else { | ||
Copy-Item $SimulatorArm64RustOutput "$SimulatorArm64RustOutput/nerdbank_zcash_rust" | ||
Copy-Item $DeviceRustOutput "$DeviceFrameworkDir/nerdbank_zcash_rust" | ||
Write-Warning "Skipped critical steps because this is not macOS." | ||
} | ||
Write-Host "Copied nerdbank_zcash_rust to framework" | ||
|
||
# Build the xcframework | ||
$xcframeworkOutputDir = "$repoRoot/bin/$Configuration/nerdbank_zcash_rust.xcframework" | ||
xcodebuild -create-xcframework -framework $SimulatorFrameworkDir -framework $DeviceFrameworkDir -output $xcframeworkOutputDir | ||
Write-Host "Created nerdbank_zcash_rust.xcframework at $xcframeworkOutputDir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<BindingAssembly> | ||
<NativeReference Name="nerdbank_zcash_rust.xcframework"> | ||
<ForceLoad></ForceLoad> | ||
<Frameworks></Frameworks> | ||
<IsCxx></IsCxx> | ||
<Kind>Framework</Kind> | ||
<LinkerFlags></LinkerFlags> | ||
<NeedsGccExceptionHandling></NeedsGccExceptionHandling> | ||
<SmartLink></SmartLink> | ||
<WeakFrameworks></WeakFrameworks> | ||
</NativeReference> | ||
</BindingAssembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.