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

Update Podspec to the new project structure #465

Merged
merged 14 commits into from
May 4, 2024
52 changes: 52 additions & 0 deletions .github/workflows/cocoapods-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CocoaPods Lint

on:
bamx23 marked this conversation as resolved.
Show resolved Hide resolved
pull_request:

jobs:
lint:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- platform: iOS
config: ''
- platform: iOS
config: '--use-libraries'
- platform: iOS
config: '--use-libraries --use-modular-headers'
- platform: iOS
config: '--use-static-frameworks'
- platform: macOS
config: ''
- platform: tvOS
config: ''
- platform: watchOS
config: ''
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0

- name: Install CocoaPods
run: sudo gem install cocoapods

- name: Lint Podspec
id: lint
run: |
validation_dir=$(mktemp -d)
echo "validation_dir=${validation_dir}" >> $GITHUB_OUTPUT
pod lib lint --verbose --platforms=${{ matrix.platform }} ${{ matrix.config }} --no-clean --validation-dir="${validation_dir}"
shell: bash

- name: Upload Workspace Artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: workspace-${{ matrix.platform }}${{ matrix.config }}
path: ${{ steps.lint.outputs.validation_dir }}
155 changes: 45 additions & 110 deletions KSCrash.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,135 +4,70 @@ Pod::Spec.new do |s|
s.version = "1.17.1"
s.summary = "The Ultimate iOS Crash Reporter"
s.homepage = "https://github.com/kstenerud/KSCrash"
s.license = { :type => 'KSCrash license agreement', :file => 'LICENSE' }
s.license = { :type => 'KSCrash license agreement', :file => 'LICENSE' }
s.author = { "Karl Stenerud" => "kstenerud@gmail.com" }
s.ios.deployment_target = IOS_DEPLOYMENT_TARGET
s.osx.deployment_target = '10.13'
s.tvos.deployment_target = '11.0'
s.watchos.deployment_target = '4.0'
s.ios.deployment_target = IOS_DEPLOYMENT_TARGET
s.osx.deployment_target = '10.13'
s.tvos.deployment_target = '11.0'
s.watchos.deployment_target = '4.0'
s.source = { :git => "https://github.com/kstenerud/KSCrash.git", :tag=>s.version.to_s }
s.frameworks = 'Foundation'
s.libraries = 'c++', 'z'
s.xcconfig = { 'GCC_ENABLE_CPP_EXCEPTIONS' => 'YES' }
s.frameworks = 'Foundation'
s.libraries = 'c++', 'z'
s.xcconfig = { 'GCC_ENABLE_CPP_EXCEPTIONS' => 'YES' }
s.default_subspecs = 'Installations'

s.subspec 'Recording' do |recording|
recording.compiler_flags = '-fno-optimize-sibling-calls'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this -fno-optimize-sibling-calls flag removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess we can set it in CocoaPods, but in SPM it can only be set with .unsafeFlags, which is not allowed in "release" (specified by version), but is allowed in development (local package or specified by commit or branch).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's also unclear which functions this flag is for, so we can't know if it's needed in Recording or in RecordingCore.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, you've added it here #379 :)
Looks like it's actually needed. But maybe we can take a solution from rollbar/rollbar-apple#335 (if I understand that fix correctly).

recording.source_files = 'Source/KSCrash/Recording/**/*.{h,m,mm,c,cpp}',
'Source/KSCrash/llvm/**/*.{h,m,mm,c,cpp}',
'Source/KSCrash/swift/**/*.{h,m,mm,c,cpp,def}',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilter.h'
recording.public_header_files = 'Source/KSCrash/Recording/KSCrash.h',
'Source/KSCrash/Recording/KSCrashC.h',
'Source/KSCrash/Recording/KSCrashReportWriter.h',
'Source/KSCrash/Recording/KSCrashReportFields.h',
'Source/KSCrash/Recording/Monitors/KSCrashMonitorType.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilter.h'

recording.subspec 'Tools' do |tools|
tools.source_files = 'Source/KSCrash/Recording/Tools/*.h'
tools.compiler_flags = '-fno-optimize-sibling-calls'
end

recording.resource_bundles = { 'KSCrashPrivacy' => 'Source/KSCrash/Recording/PrivacyInfo.xcprivacy' }
configure_subspec = lambda do |subs|
module_name = subs.name.gsub('/', '')
subs.source_files = "Sources/#{module_name}/**/*.{h,m,mm,c,cpp,def}"
subs.public_header_files = "Sources/#{module_name}/include/*.h"
end

s.subspec 'Reporting' do |reporting|
reporting.dependency 'KSCrash/Recording'

reporting.subspec 'Filters' do |filters|
filters.subspec 'Base' do |base|
base.source_files = 'Source/KSCrash/Reporting/Filters/Tools/**/*.{h,m,mm,c,cpp}',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilter.h'
base.public_header_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilter.h'
end

filters.subspec 'Alert' do |alert|
alert.dependency 'KSCrash/Reporting/Filters/Base'
alert.source_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilterAlert.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilterAlert.m'
end

filters.subspec 'AppleFmt' do |applefmt|
applefmt.dependency 'KSCrash/Reporting/Filters/Base'
applefmt.source_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilterAppleFmt.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilterAppleFmt.m'
end

filters.subspec 'Basic' do |basic|
basic.dependency 'KSCrash/Reporting/Filters/Base'
basic.source_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilterBasic.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilterBasic.m'
end

filters.subspec 'Stringify' do |stringify|
stringify.dependency 'KSCrash/Reporting/Filters/Base'
stringify.source_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilterStringify.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilterStringify.m'
end

filters.subspec 'GZip' do |gzip|
gzip.dependency 'KSCrash/Reporting/Filters/Base'
gzip.source_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilterGZip.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilterGZip.m'
end
s.subspec 'Recording' do |recording|
recording.dependency 'KSCrash/RecordingCore'

filters.subspec 'JSON' do |json|
json.dependency 'KSCrash/Reporting/Filters/Base'
json.source_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilterJSON.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilterJSON.m'
end
configure_subspec.call(recording)
end

filters.subspec 'Sets' do |sets|
sets.dependency 'KSCrash/Reporting/Filters/Base'
sets.dependency 'KSCrash/Reporting/Filters/AppleFmt'
sets.dependency 'KSCrash/Reporting/Filters/Basic'
sets.dependency 'KSCrash/Reporting/Filters/Stringify'
sets.dependency 'KSCrash/Reporting/Filters/GZip'
sets.dependency 'KSCrash/Reporting/Filters/JSON'
s.subspec 'Filters' do |filters|
filters.dependency 'KSCrash/Recording'
filters.dependency 'KSCrash/RecordingCore'
filters.dependency 'KSCrash/ReportingCore'

sets.source_files = 'Source/KSCrash/Reporting/Filters/KSCrashReportFilterSets.h',
'Source/KSCrash/Reporting/Filters/KSCrashReportFilterSets.m'
end
configure_subspec.call(filters)
end

filters.subspec 'Tools' do |tools|
tools.source_files = 'Source/KSCrash/Reporting/Filters/Tools/**/*.{h,m,mm,c,cpp}'
end
s.subspec 'Sinks' do |sinks|
sinks.dependency 'KSCrash/Recording'
sinks.dependency 'KSCrash/Filters'
sinks.ios.frameworks = 'MessageUI'

end
configure_subspec.call(sinks)
end

reporting.subspec 'Tools' do |tools|
tools.ios.frameworks = 'SystemConfiguration'
tools.tvos.frameworks = 'SystemConfiguration'
tools.osx.frameworks = 'SystemConfiguration'
GLinnik21 marked this conversation as resolved.
Show resolved Hide resolved
tools.source_files = 'Source/KSCrash/Reporting/Tools/**/*.{h,m,mm,c,cpp}',
'Source/KSCrash/Recording/KSSystemCapabilities.h'
end
s.subspec 'Installations' do |installations|
installations.dependency 'KSCrash/Filters'
installations.dependency 'KSCrash/Sinks'
installations.dependency 'KSCrash/Recording'

reporting.subspec 'MessageUI' do |messageui|
end
configure_subspec.call(installations)
end

reporting.subspec 'Sinks' do |sinks|
sinks.ios.frameworks = 'MessageUI'
GLinnik21 marked this conversation as resolved.
Show resolved Hide resolved
sinks.dependency 'KSCrash/Reporting/Filters'
sinks.dependency 'KSCrash/Reporting/Tools'
sinks.source_files = 'Source/KSCrash/Reporting/Sinks/**/*.{h,m,mm,c,cpp}'
end
s.subspec 'RecordingCore' do |recording_core|
recording_core.dependency 'KSCrash/Core'

configure_subspec.call(recording_core)
end

s.subspec 'Installations' do |installations|
installations.dependency 'KSCrash/Recording'
installations.dependency 'KSCrash/Reporting'
installations.source_files = 'Source/KSCrash/Installations/**/*.{h,m,mm,c,cpp}'
s.subspec 'ReportingCore' do |reporting_core|
reporting_core.dependency 'KSCrash/Core'
reporting_core.ios.frameworks = 'SystemConfiguration'
reporting_core.tvos.frameworks = 'SystemConfiguration'
reporting_core.osx.frameworks = 'SystemConfiguration'

configure_subspec.call(reporting_core)
end

s.subspec 'Core' do |core|
core.dependency 'KSCrash/Reporting/Filters/Basic'
core.source_files = 'Source/KSCrash/Installations/KSCrashInstallation.h',
'Source/KSCrash/Installations/KSCrashInstallation.m',
'Source/KSCrash/Installations/KSCrashInstallation+Private.h',
'Source/KSCrash/Reporting/Tools/KSCString.{h,m}'
configure_subspec.call(core)
end

end
22 changes: 8 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ let package = Package(

.target(
name: "KSCrashRecordingCore",
dependencies: [
"KSCrashCore",
"KSCrashSwift",
"KSCrashLLVM",
dependencies: ["KSCrashCore"],
cSettings: [
.headerSearchPath("swift"),
.headerSearchPath("swift/Basic"),
.headerSearchPath("llvm"),
.headerSearchPath("llvm/ADT"),
.headerSearchPath("llvm/Config"),
.headerSearchPath("llvm/Support"),
]
),
.testTarget(
Expand All @@ -115,8 +119,6 @@ let package = Package(
"KSCrashTestTools",
"KSCrashRecordingCore",
"KSCrashCore",
"KSCrashSwift",
"KSCrashLLVM",
]
),

Expand Down Expand Up @@ -144,14 +146,6 @@ let package = Package(
name: "KSCrashTestTools",
dependencies: ["KSCrashRecordingCore"]
),
//MARK: - Forks
.target(
name: "KSCrashSwift",
dependencies: ["KSCrashLLVM"]
),
.target(
name: "KSCrashLLVM"
),
],
cxxLanguageStandard: .gnucxx11
)
1 change: 0 additions & 1 deletion Sources/KSCrashLLVM/dummy.c

This file was deleted.