dockutil icon indicating copy to clipboard operation
dockutil copied to clipboard

Add Swift Package Manager support

Open Kyle-Ye opened this issue 2 years ago • 3 comments

  • Add Swift Package support
  • Update file structure to standard swift package
  • Fix SPM warning

https://www.swift.org/package-manager/

After the change, we can just use swift build to get the executable, swift run to run it and swift test to run tests.

And other swift package or swift package plugin can depend on this.

This PR does not remove Xcode project support and change the release workflow.

Kyle-Ye avatar Apr 05 '22 17:04 Kyle-Ye

@kcrawford Could you help review this in your spare time? Some downstream needs SPM support. ❤️

Kyle-Ye avatar May 18 '22 13:05 Kyle-Ye

@kcrawford many people would like to use this beautiful utility you created, but they can't without easy installation way (i.e. Homebrew). Please, take a look at this PR, it will help so many users of your dockutil

mathbunnyru avatar Jul 30 '22 18:07 mathbunnyru

@kcrawford any chance you could take a look?

ashtonian avatar Oct 31 '22 18:10 ashtonian

I'd like to bump this? The version of Dockutil in Homebrew is out of date and unusable, and this is blocking https://github.com/Homebrew/homebrew-core/pull/97394 to get this updated.

sroberts avatar Jan 14 '23 19:01 sroberts

dam did this project die?

TheNite avatar Feb 27 '23 21:02 TheNite

Could a community member maybe get access to merge some of these pull requests? I would do it if I was a developer, but you don't want me with those keys. @kcrawford

@Kyle-Ye would you be interested if @kcrawford responds?

Austin1 avatar Mar 19 '23 21:03 Austin1

It may just be time to fork this project and move on, doesn't look like @kcrawford has been active in over a year.

sroberts avatar Mar 20 '23 01:03 sroberts

Could a community member maybe get access to merge some of these pull requests? I would do it if I was a developer, but you don't want me with those keys. @kcrawford

@Kyle-Ye would you be interested if @kcrawford responds?

Yes, I'm fine to keep the project moving on.

Kyle-Ye avatar Mar 20 '23 03:03 Kyle-Ye

I’m sorry for the delays. I don’t want to merge something I don’t understand as I have to maintain this going forward. I haven’t yet made time to understand this and why alternatives weren’t chosen to solve homebrew compatibility. I’ll try to look into it as soon as I have some time. If anyone can point me to more info on why this is the best/standard way to handle open source swift projects and homebrew I’d appreciate it. Can you also briefly explain why a pkg doesn’t work for your use case. I’m not trying to be difficult—I genuinely don’t understand and that’s probably a reason this has been neglected.

kcrawford avatar Mar 20 '23 05:03 kcrawford

I’m sorry for the delays. I don’t want to merge something I don’t understand as I have to maintain this going forward. I haven’t yet made time to understand this and why alternatives weren’t chosen to solve homebrew compatibility. I’ll try to look into it as soon as I have some time. If anyone can point me to more info on why this is the best/standard way to handle open source swift projects and homebrew I’d appreciate it. Can you also briefly explain why a pkg doesn’t work for your use case. I’m not trying to be difficult—I genuinely don’t understand and that’s probably a reason this has been neglected.

@kcrawford If you have your time available, you can spend some time checking the following posts.

https://github.com/orgs/Homebrew/discussions/59

https://github.com/Homebrew/homebrew-core/pull/97394

Kyle-Ye avatar Mar 20 '23 06:03 Kyle-Ye

Thanks @Kyle-Ye. I was able to build from your branch using swift build, but building from Xcode failed for me (Info.plist not found, 'XCTestSwiftSupport', 'XCTest' not found) and top level directories and files like Sources and Package.swift are not visible in Xcode. I don't like the duplicated hard-coded VERSION though I see the reason. Do you think we can make this look and act like a fresh new Swift Package from Xcode Template so Xcode handles it as expected. Maybe starting with that and adding in the classes would be cleaner.

kcrawford avatar Mar 27 '23 00:03 kcrawford

Got it, I'll update the commits and make it ready for review once it's done. @kcrawford

But I have 2 questions:

  1. Should we still preserve .xcodeprojc support / provide support for both Xcode project and Swift Package? IMO, the answer is NO.
  2. Should we still use info.plist to store the version information? Swift Package Manager currently does not have a very support support for custom Info.plist.

A workaround is discussed here https://forums.swift.org/t/swift-package-manager-use-of-info-plist-use-for-apps/6532/13

Kyle-Ye avatar Mar 27 '23 02:03 Kyle-Ye

  1. Should we still preserve .xcodeprojc support / provide support for both Xcode project and Swift Package? IMO, the answer is NO.

Being new to Swift Package development I don't know the implications of this. I'd want full Xcode support.

  1. Should we still use info.plist to store the version information? Swift Package Manager currently does not have a very support support for custom Info.plist.

Again I don't know, but I'd want minimal workarounds. Having info.plist support seems important.

It may make sense for me to attempt the conversion to Swift Package just so I feel comfortable with the changes.

kcrawford avatar Mar 27 '23 05:03 kcrawford

Thanks @Kyle-Ye. I was able to build from your branch using swift build, but building from Xcode failed for me (Info.plist not found, 'XCTestSwiftSupport', 'XCTest' not found) and top level directories and files like Sources and Package.swift are not visible in Xcode. I don't like the duplicated hard-coded VERSION though I see the reason. Do you think we can make this look and act like a fresh new Swift Package from Xcode Template so Xcode handles it as expected. Maybe starting with that and adding in the classes would be cleaner.

  1. Fixed the Info.plist not found and XCTest import issue on xcodeproj.
  2. The version info in Info.plist is $(CURRENT_PROJECT_VERSION) which is defined on .xcodeproj file. So even we force inserting Info.plist to SPM system. We still can't get the info on .xcodeproj file. IMO, there is really no reason to preserve .xcodeprojc support. Once we drop xcodeproj support. There will be no duplicated hard-coded VERSION issue left.

Kyle-Ye avatar Apr 03 '23 13:04 Kyle-Ye

@kcrawford, can you please review/merge this PR?

Is there a CI pipeline for this project somewhere? If there isn't, I can try to create one using GitHub Actions and/or Cirrus CI.

PS: GitHub Actions Workflow PR is now at https://github.com/kcrawford/dockutil/pull/152.

rgl avatar Jun 24 '23 09:06 rgl

@kcrawford - any updates here?

ChrisCarini avatar Jun 29 '23 15:06 ChrisCarini

Homebrew just recently marked dockutil as deprecated. That's going to significantly reduce the number of people able to use dockutil. That's a shame, because it's a great little utility. I use it in my Mac setup scripts. Merging this is probably the only hope to fix that.

booch avatar Sep 26 '23 03:09 booch

@kcrawford is there any chance you could find time to review this patch? Lots of folks want to use dockutil through Homebrew, and this is blocking them from doing so. As @booch said, this is a neat tool and it would be great if more folks could benefit from your work. I'm sure there are volunteers in this thread or in the Homebrew thread that would be happy to help you with anything you need to accomplish this if you respond.

straxhaber avatar Oct 01 '23 23:10 straxhaber

I have created a fork and release 3.0.3 to add SwiftPM build support.

Are there any HomeBrew volunteer who would like to help reopen a HomeBrew PR against my fork? - https://github.com/Kyle-Ye/dockutil/releases/tag/3.0.3.

https://github.com/Homebrew/homebrew-core/pull/97394 cc @sashkab

Kyle-Ye avatar Oct 02 '23 04:10 Kyle-Ye

It is still my intention to implement this. Just want to become familiar with it and haven’t had time. Hopefully will get to it soon. I feel terrible that it is taking so long.

kcrawford avatar Oct 11 '23 17:10 kcrawford

Hi @kcrawford, I just want to make sure you're aware that the HomeBrew project has now marked your project as "deprecated." I just noticed this. I'm not involved with Homebrew, but I really hope you can fix this before they remove Dockutil entirely. I bet a lot of your users find and install this via Homebrew. Is there any chance you could either make this a priority or add someone else as a maintainer to get this resolved? I'd be happy to volunteer, and I'm sure others would be as well.

straxhaber avatar Oct 17 '23 15:10 straxhaber

Sorry for all the delays. Wanted to be sure I could support this going forward.

kcrawford avatar Oct 29 '23 20:10 kcrawford

@kcrawford can you cut a new release as well? Thanks! 🙏

chenrui333 avatar Oct 29 '23 23:10 chenrui333

Approving this to more forward with Swift Package Manager. I expect some issues but we'll work through them.

If there are items I could help, feel free to assign it to me.

Kyle-Ye avatar Oct 30 '23 04:10 Kyle-Ye

@kcrawford First of all, thank you for merging this. So that all of us home-brew users can use your fantastic tool through that, would you mind cutting a new release? Homebrew usually indexes off of releases rather than HEAD. It looks like @chenrui333 created a separate issue for this. https://github.com/kcrawford/dockutil/issues/158

straxhaber avatar Nov 02 '23 14:11 straxhaber

I have to figure out how I want to build, sign, notarize the .pkg with the change. I think if I do a release without a pkg it may break autopkg recipes or other automation scripts looking for a pkg associated with the release.

kcrawford avatar Nov 02 '23 16:11 kcrawford

I have to figure out how I want to build, sign, notarize the .pkg with the change. I think if I do a release without a pkg it may break autopkg recipes or other automation scripts looking for a pkg associated with the release.

@kcrawford Thank you for explaining. Do you have an ETA on when this will be done?

@Kyle-Ye @chenrui333 @rgl do any of you have advice on how to do this? Perhaps you can help @kcrawford if you know.

straxhaber avatar Nov 03 '23 22:11 straxhaber

Working on a new release but noticed my Apple Developer subscription expired. Wanted to let folks know that you or your company can contribute to this project using the sponsor button.

Regardless I hope to have a release out soon.

kcrawford avatar Dec 16 '23 22:12 kcrawford

@kcrawford Thank you so much for getting this done!

straxhaber avatar Jan 01 '24 02:01 straxhaber