Skip to content

Commit

Permalink
Merge pull request #16 from sergeykhliustin/xcframework-linkage-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeykhliustin authored Jan 27, 2023
2 parents f7e90e1 + a61404e commit 0542fdf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
9 changes: 7 additions & 2 deletions Sources/PodToBUILD/Convertible/XCFramework.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ struct XCFramework: StarlarkConvertible {
var input = try PropertyListDecoder().decode(InputData.self, from: data)
input.AvailableLibraries = input.AvailableLibraries.map({
var lib = $0
lib.path = xcframework.appendingPath($0.LibraryIdentifier).appendingPath($0.LibraryPath)
lib.linkage = $0.LibraryPath.hasSuffix("framework") ? .dynamic : .static
let path = xcframework.appendingPath($0.LibraryIdentifier).appendingPath($0.LibraryPath)
lib.path = path
if $0.LibraryPath.hasSuffix("framework") {
lib.linkage = isDynamicFramework(path, options: options) ? .dynamic : .static
} else {
lib.linkage = .static
}
if lib.SupportedPlatformVariant == "simulator" && lib.SupportedPlatform == "ios" {
lib.SupportedArchitectures = lib.SupportedArchitectures.map({
$0.replacingOccurrences(of: "arm64", with: "sim_arm64")
Expand Down
12 changes: 6 additions & 6 deletions Tests/Recorded/FirebaseAnalytics/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ apple_framework(
"slices": [
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "macos-arm64_x86_64",
Expand All @@ -101,7 +101,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "tvos-arm64",
Expand All @@ -114,7 +114,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_x86_64-maccatalyst",
Expand All @@ -128,7 +128,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_i386_x86_64-simulator",
Expand All @@ -143,7 +143,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "tvos-arm64_x86_64-simulator",
Expand All @@ -157,7 +157,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_armv7",
Expand Down
24 changes: 12 additions & 12 deletions Tests/Recorded/GoogleAppMeasurement/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ apple_framework(
"slices": [
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "macos-arm64_x86_64",
Expand All @@ -97,7 +97,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_i386_x86_64-simulator",
Expand All @@ -112,7 +112,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "tvos-arm64",
Expand All @@ -125,7 +125,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_armv7",
Expand All @@ -139,7 +139,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_x86_64-maccatalyst",
Expand All @@ -153,7 +153,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "tvos-arm64_x86_64-simulator",
Expand All @@ -172,7 +172,7 @@ apple_framework(
"slices": [
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "tvos-arm64",
Expand All @@ -185,7 +185,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "macos-arm64_x86_64",
Expand All @@ -199,7 +199,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_i386_x86_64-simulator",
Expand All @@ -214,7 +214,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "tvos-arm64_x86_64-simulator",
Expand All @@ -228,7 +228,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_armv7",
Expand All @@ -242,7 +242,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_x86_64-maccatalyst",
Expand Down
12 changes: 6 additions & 6 deletions Tests/Recorded/GoogleMaps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ apple_framework(
"slices": [
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_x86_64-simulator",
Expand All @@ -94,7 +94,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64",
Expand All @@ -112,7 +112,7 @@ apple_framework(
"slices": [
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_x86_64-simulator",
Expand All @@ -126,7 +126,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64",
Expand All @@ -144,7 +144,7 @@ apple_framework(
"slices": [
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64_x86_64-simulator",
Expand All @@ -158,7 +158,7 @@ apple_framework(
},
{
"build_type": {
"linkage": "dynamic",
"linkage": "static",
"packaging": "framework"
},
"identifier": "ios-arm64",
Expand Down

0 comments on commit 0542fdf

Please sign in to comment.