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

Support SPM installation #1379

Closed

Conversation

allenhumphreys
Copy link
Contributor

Fixes #1372 #1370

To test:

You can add .package(url: "https://github.com/allenhumphreys/AztecEditor-iOS", branch: "ah/spm") to the dependencies in a sample application. If needed I can create a repo with a sample application that consumes the package.


  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

@@ -967,8 +967,7 @@
F1DC21B22199D58B007C189E /* ElementToAttributedString */,
F1E75630215B0C9E004BC254 /* StringAttributesToAttributes */,
);
name = Converters;
path = "New Group";
path = Converters;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that this group was not properly renamed on disk and renamed it so it shows up correctly in SPM.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is not part of the Xcode project, but SPM was picking it up and failing to compile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is not part of the Xcode project, but SPM was picking it up and failing to compile.

@allenhumphreys
Copy link
Contributor Author

I just want to say thanks for the awesome library. I know I didn't ask about adding this support before opening the PR, it's ok if this doesn't align with your goal, though. I had trouble finding your project when looking to solve what this solves, and I'd love to get it listed in the swift package index if this goes through.

@erolando
Copy link

good job @allenhumphreys

@jkmassel
Copy link
Contributor

Thanks for the work here @allenhumphreys – I'm in the midst of reviewing this, but it may take a few more days. Just wanted to provide an update.

@mokagio
Copy link
Contributor

mokagio commented Jan 17, 2025

You'll notice that the checks have failed. I pushed #1403 to trigger CI but unfortunately we let this PR sit here for so long that the Xcode tooling its branch uses is out of date. I'll be working on upgrading the tooling first, then update my test branch, then go from there...

Also worth noting that when I try to run the tests from Xcode locally from the workspace, they fail to build because they cannot find Bundle.aztecTestsBundle.

image

When I try to open .swiftpm/xcode/package.xcworkspace, Xcode 16.2 crashes

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process:   Xcode [83802]

Application Specific Information:
abort() called


Application Specific Signatures:
IDESwiftPackage.swift:1220@@packageStructureDidChange(at:)

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x1964855d0 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1964bdc20 pthread_kill + 288
2   libsystem_c.dylib             	       0x1963caa30 abort + 180
3   IDEKit                        	       0x106d31554 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 964
4   IDEKit                        	       0x106d31e8c -[IDEAssertionHandler handleFailureInFunction:fileName:lineNumber:assertionSignature:messageFormat:arguments:] + 780
5   DVTFoundation                 	       0x102ebd388 _DVTAssertionHandler + 472
6   DVTFoundation                 	       0x102ebd7f4 _DVTAssertFromSwift + 260
7   DVTFoundation                 	       0x1030da514 specialized withVaList<A>(_:_:) + 252
8   DVTFoundation                 	       0x1030d8e44 DVTAssertError(_:file:line:function:) + 464
9   DVTFoundation                 	       0x1031e3844 Optional.unwrap(orAssert:file:line:function:) + 264
10  IDESwiftPackageCore           	       0x1338e3888 IDESwiftPackage.packageStructureDidChange(at:) + 1420
11  IDESwiftPackageCore           	       0x1338e40b0 protocol witness for SPMPackageDirectoryStructureFileSystemWatcherDelegate.packageStructureDidChange(at:) in conformance IDESwiftPackage + 20
12  SwiftPM                       	       0x14f8c98d0 specialized closure #1 in variable initialization expression of SPMPackageDirectoryStructureFileSystemWatcher.fileSystemEventHandler + 2692
13  FSEvents                      	       0x19ee2eee4 implementation_callback_rpc + 3660
14  FSEvents                      	       0x19ee2e010 _Xcallback_rpc + 220
15  FSEvents                      	       0x19ee2df08 FSEventsD2F_server + 68
16  FSEvents                      	       0x19ee3113c FSEventsClientProcessMessageCallback + 72
17  CoreFoundation                	       0x1965ccf94 __CFMachPortPerform + 248
18  CoreFoundation                	       0x19659da6c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
19  CoreFoundation                	       0x19659d98c __CFRunLoopDoSource1 + 524
20  CoreFoundation                	       0x19659c350 __CFRunLoopRun + 2244
21  CoreFoundation                	       0x19659b434 CFRunLoopRunSpecific + 608
22  HIToolbox                     	       0x1a0d4619c RunCurrentEventLoopInMode + 292
23  HIToolbox                     	       0x1a0d45fd8 ReceiveNextEventCommon + 648
24  HIToolbox                     	       0x1a0d45d30 _BlockUntilNextEventMatchingListInModeWithFilter + 76
25  AppKit                        	       0x199dfacc8 _DPSNextEvent + 660
26  AppKit                        	       0x19a5f14d0 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
27  AppKit                        	       0x199dedffc -[NSApplication run] + 476
28  IDEKit                        	       0x106d00f14 -[IDEApplication run] + 192
29  AppKit                        	       0x199dc5240 NSApplicationMain + 880
30  dyld                          	       0x196133154 0x19612d000 + 24916

@allenhumphreys
Copy link
Contributor Author

@mokagio i can probably update this branch next week. Running tests from Xcode did originally work, but it’s been quite some time!

This was referenced Jan 17, 2025
@mokagio
Copy link
Contributor

mokagio commented Jan 22, 2025

Thanks @allenhumphreys !

I opened #1406 to bring this up to speed. I'd say we're very close to have this officially released. Thanks again for your great contribution!

@allenhumphreys
Copy link
Contributor Author

@mokagio Thanks a bunch! Between my day job and family life, I probably wasn’t actually gonna get to it 😅. Very happy to see this landing.

@mokagio
Copy link
Contributor

mokagio commented Jan 22, 2025

@allenhumphreys ahah, I know the feeling. Thanks again for this contribution!

mokagio added a commit that referenced this pull request Jan 28, 2025
This is a copy of @allenhumphreys'
#1379 but with
`develop` already merged into it, including conflicts resolution and a
necessary commit to add a file to the project so that the tests (which
at the moment run via the Xcode project setup, not SwiftPM) could build
in CI.

I'd love for @allenhumphreys' work to be acknowledged in the GitHub
paper-trail. Given this PR is based off #1379, I would expect #1379 to
result as merged once this is merged. Alternatively, we could update the
base for this to #1379, merge it into it, then merge #1379 into
`develop`.
mokagio added a commit to wordpress-mobile/WordPress-iOS that referenced this pull request Feb 5, 2025
github-merge-queue bot pushed a commit to wordpress-mobile/WordPress-iOS that referenced this pull request Feb 11, 2025
* Run `pod deintegrate` and remove CocoaPods automation

* Add `Makefile` automation to download Gutenberg framework

* Remove dead reference to `Pods.framework` in project

* Remove dead reference to pods from workspace

* Remove SwiftLint-via-CocoaPods from `Rakefile`

* Remove unnecessary `$(inherited)` flag from a couple of targets

That's for the value `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER`,
but it's useless to set `$(inherited)` for a Yes or No value because
removing the value from the target will automatically make Xcode read it
from the project, achieving the same result.

* Remove CocoaPods instruction from the README

* Remove SwiftLint instructions from the `README`

* Add a version of Aztec fetched via SwiftPM

* Add Gutenberg XCFrameworks via drag-n-drop from local paths

* Disable `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER`

Was giving errors in Yoga:

> Double-quoted include "YGEnums.h" in framework header, expected angle-bracketed instead

* Disable `CLANG_WARN_STRICT_PROTOTYPES`

It resulted in a build failure:

> React.framework/Headers/RCTAppearance.h:16:60:
> A function declaration without a prototype is deprecated in all versions of C

* Update search path for Gutenberg React Native bundle in script

* Remove some leftover bits of CocoaPods set up for automation

* Remove leftover `COCOAPODS` precompiler flag

Strange that `pod deintegrate` did not remove it. Maybe it was some
custom piece of setup...

* Remove a couple of CocoaPods-specific code branches

* Temporarily switch to CI toolkit branch compatible with no CocoaPods

* Fetch XCFrameworks in CI

* Update Gutenberg checkout logic in localization lint for CP-less setup

* Update source map upload for CP-less Gutenberg setup

* Ensure `Frameworks` folder exist, otherwise tar will fail

* Remove "Log Outdated Pods" step from code freeze

We don't have pods anymore

* Remove Pods from lists in `.gitignore` and RuboCop

We don't use Pods anymore

* Remove imports of Pods xcconfigs

* No longer look in Pods folder to extract localizations

* Link Gutenberg XCFramework in Jetpack target too!

* Add instruction in README to run `make dependencies`

* Use CI toolkit 3.8.0

* Point Aztec to branch in wordpress-mobile org from SPM support PR

See wordpress-mobile/AztecEditor-iOS#1379

* Point Aztec to latest SwiftPM-support commit

* Point to latest Aztec, 1.20.0

* Reimplement logic to download XCFrameworks from `make` to `rake`

* Remove a debug `set +x`

* Rewrite `gutenberg_xcframeworks` using Ruby APIs

More idiomatic and safer than shelling out. See
#23958 (comment)

* Also delete `tar.gz` when cleaning up after setting up Gutenberg

* Ignore `Pods/` for retro-compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please support SPM~~~
4 participants