Skip to content

Commit

Permalink
Add base 'requires_arc' support. Resolves #53 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeykhliustin authored Jul 3, 2023
1 parent 0a8d648 commit 7d9feab
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 8 deletions.
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ macos_command_line_application(
name = "bazelpods",
minimum_os_version = MACOS_VERSION,
deps = [":BazelPodsLib"],
visibility = ["//xcodeproj:__pkg__"]
visibility = ["//visibility:public"]
)

swift_library(
Expand Down Expand Up @@ -56,7 +56,7 @@ macos_command_line_application(
name = "Analyzer",
minimum_os_version = MACOS_VERSION,
deps = [":AnalyzerLib"],
visibility = ["//xcodeproj:__pkg__"]
visibility = ["//visibility:public"]
)

swift_library(
Expand Down
11 changes: 10 additions & 1 deletion Sources/BazelPodsCore/Analyzer/Analyzers/SourcesAnalyzer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public struct SourcesAnalyzer {
let sourceFiles: GlobNodeV2
let publicHeaders: GlobNodeV2
let privateHeaders: GlobNodeV2
let nonArcSourceFiles: GlobNodeV2
let sourcesType: SourcesType
var linkDynamic: Bool
}
Expand Down Expand Up @@ -119,10 +120,18 @@ public struct SourcesAnalyzer {
!spec.staticFramework &&
sourcesType.oneOf(.swiftOnly, .objcOnly, .mixed)

let requiresArc: Bool
if (spec.requiresArc == .left(false) || spec.requiresArc == .right(["false"])) && subspecs.isEmpty {
requiresArc = false
} else {
requiresArc = true
}

return Result(
sourceFiles: sourceFiles ?? .empty,
sourceFiles: requiresArc ? sourceFiles ?? .empty : .empty,
publicHeaders: publicHeaders ?? .empty,
privateHeaders: privateHeaders ?? .empty,
nonArcSourceFiles: !requiresArc ? sourceFiles ?? .empty : .empty,
sourcesType: sourcesType,
linkDynamic: linkDynamic
)
Expand Down
2 changes: 2 additions & 0 deletions Sources/BazelPodsCore/Core/Magmas.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,5 @@ public indirect enum Either<T, U> {
}
}
}

extension Either: Equatable where T: Equatable, U: Equatable { }
1 change: 1 addition & 0 deletions Sources/BazelPodsCore/Targets/AppleFramework.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ struct AppleFramework: BazelTarget {
.named(name: "infoplists", value: infoplists.map({ ":" + $0 }).toStarlark()),
.named(name: "platforms", value: info.platforms.toStarlark()),
.named(name: "srcs", value: sources.sourceFiles.toStarlark()),
.named(name: "non_arc_srcs", value: sources.nonArcSourceFiles.toStarlark()),
.named(name: "public_headers", value: sources.publicHeaders.toStarlark()),
.named(name: "private_headers", value: sources.privateHeaders.toStarlark()),
.named(name: "data", value: packData()),
Expand Down
1 change: 1 addition & 0 deletions TestTools/Pods.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"PhoneNumberKit": "3.6.3",
"PromiseKit": "6.18.1",
"PromisesObjC": "2.1.1",
"Protobuf": "3.22.0",
"PubguardSDK": "",
"QMUIKit": "",
"QY_NIM_iOS_SDK": "8.4.1",
Expand Down
1 change: 1 addition & 0 deletions TestTools/Pods_Integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"ObjectMapper": "4.2.0",
"Onfido": "25.2.0",
"PromiseKit": "6.18.1",
"Protobuf": "3.22.0",
"R.swift": "6.1.0",
"ReSwift": "6.1.0",
"ReachabilitySwift": "5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion Tests/Recorded/MMKV/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tests/Recorded/MTAppenderFile/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 112 additions & 0 deletions Tests/Recorded/Protobuf/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tests/Recorded/Yoga/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tests/Recorded/ZipArchive/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion xcodeconfig/xcodeconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ XCODE_BUILD_NUMBER=$(echo "$XCODE_VERSION_FULL" | tail -n 1 | awk '{ print $3 }'
# If XCODE_VERSION has only 1 dot, append a ".0"
if [[ $XCODE_VERSION == *.* && ! $XCODE_VERSION == *.*.* ]]; then
XCODE_VERSION_EXTENDED="$XCODE_VERSION.0"
XCODE_ALIASES="['${XCODE_VERSION_EXTENDED}.${XCODE_BUILD_NUMBER}', '${XCODE_VERSION}', '${XCODE_VERSION_EXTENDED}', '${XCODE_BUILD_NUMBER}', '${XCODE_VERSION%%.*}'],"
else
XCODE_VERSION_EXTENDED="$XCODE_VERSION"
XCODE_ALIASES="['${XCODE_VERSION_EXTENDED}.${XCODE_BUILD_NUMBER}', '${XCODE_VERSION}', '${XCODE_BUILD_NUMBER}', '${XCODE_VERSION%%.*}'],"
fi

# Get the SDK versions
Expand All @@ -22,7 +24,7 @@ WATCHOS_SDK_VERSION=$(xcodebuild -showsdks | grep -Eo 'watchos[0-9.]+' | grep -E
echo "xcode_version(
name = 'version${XCODE_VERSION//./_}_${XCODE_BUILD_NUMBER//./_}',
version = '${XCODE_VERSION_EXTENDED}.${XCODE_BUILD_NUMBER}',
aliases = ['${XCODE_VERSION_EXTENDED}.${XCODE_BUILD_NUMBER}', '${XCODE_VERSION}', '${XCODE_VERSION_EXTENDED}', '${XCODE_BUILD_NUMBER}', '${XCODE_VERSION%%.*}'],
aliases = ${XCODE_ALIASES}
default_ios_sdk_version = '$IOS_SDK_VERSION',
default_tvos_sdk_version = '$TVOS_SDK_VERSION',
default_macos_sdk_version = '$MACOS_SDK_VERSION',
Expand Down
32 changes: 32 additions & 0 deletions xcodeproj/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,38 @@ fi
args = ["arm64sim --src $SRCROOT/Tests -f --log-level debug"]
),
),
xcode_schemes.scheme(
name = BAZELPODS + " IntegrationTests",
build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]),
launch_action = xcode_schemes.launch_action(
target = "//:%s" % BAZELPODS,
args = ["--src $SRCROOT/IntegrationTests -a --log-level debug --patches bundle_deduplicate arm64_to_sim missing_sdks --diff"]
),
),
xcode_schemes.scheme(
name = BAZELPODS + " IntegrationTests Frameworks",
build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]),
launch_action = xcode_schemes.launch_action(
target = "//:%s" % BAZELPODS,
args = ["--src $SRCROOT/IntegrationTests -a -f --log-level debug --patches bundle_deduplicate arm64_to_sim missing_sdks --diff"]
),
),
xcode_schemes.scheme(
name = BAZELPODS + " arm64sim IntegrationTests",
build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]),
launch_action = xcode_schemes.launch_action(
target = "//:%s" % BAZELPODS,
args = ["arm64sim --src $SRCROOT/IntegrationTests --log-level debug"]
),
),
xcode_schemes.scheme(
name = BAZELPODS + " arm64sim IntegrationTests Frameworks",
build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]),
launch_action = xcode_schemes.launch_action(
target = "//:%s" % BAZELPODS,
args = ["arm64sim --src $SRCROOT/IntegrationTests -f --log-level debug"]
),
),
],
tags = ["manual"],
)

0 comments on commit 7d9feab

Please sign in to comment.