Closed vladvlasov256 closed 1 year ago
@vladvlasov256
Thanks, released: https://github.com/mono0926/LicensePlist/releases/tag/3.24.5
This is great and thank you so much! 🥳
I would also suggest to update the Readme.md as this will probably be the future way to go. E.g. there is still
Warning SPM(Swift Package Manager) are not supported.
listed while further down there is a section on how to use it with SPM. If this really works well then I'd suggest to move it to the top and recommend SPM integration.
SPM(Swift Package Manager) are not supported @spipau, as I understood, that means using LicensePlist inside a package is not supported. And this is true.
Even with this PR, GenerateAcknowledgementsCommand
is not implemented for packages. It can be used only in Xcode project build phases.
And LicensePlist is most helpful for iOS/macOS projects, right? Because the guidelines tell us to provide the acknowledgments somehow.
I may be missing a case when acknowledgments are required for a package. Then it'll need a few lines of code to support SPM.
I was just trying to use this new feature in one of our projects and I think the binary that is included with the SPM package isn't built correctly for Intel macs. If I run the "GenerateAcknowledgementsCommand" manually I can see an error in Xcode with: "Bad CPU type in executable". And I get the same error if I try and run the binary manually from terminal.
I tried copying the portable binary from the releases page and replacing the included one with that. This one seems to be working fine.
@r00li Hi.
Could you create a new issue for it? Or I can create one referring to your comment above if you don't mind.
No problem. Issue created.
@vladvlasov256 apologies for the long silence but I am currently working on a release and had no time yet to further investigate. Back then I tried to set it up with the new plugin and failed, maybe because of the same reason as @r00li. I ran out of time and could not yet try it again.
Nevertheless, I guess this was a misunderstanding. I thought that in general LicensePlist doesn't support SPM. Maybe it was is the phrasing or I read all too fast. Of course, this lib only makes sense in applications and not packages.
Thanks for your amazing work! I just dropped the project a donation, enjoy your :beer: , :coffee: or :tea: !
@vladvlasov256 Thanks for the Plugin support. When I applied it to my own project, it seemed that the auto-generated file path and the source file path were specified differently.
Generated path:
/Users/{user_name}/Library/Developer/Xcode/DerivedData/{project_name}-ciujnnzdcobfnfayygxuttwqbkna/SourcePackages/plugins/{project_name}.output/{project_name}/LicensePlistBuildTool/com.mono0926.LicensePlist.Output
Copy from:
/Users/{user_name}/Library/Developer/Xcode/DerivedData/{project_name}-ciujnnzdcobfnfayygxuttwqbkna/Build/Products/Debug-iphonesimulator/{project_name}.app/com.mono0926.LicensePlist.Output
Is the script generated by AddAcknowledgedgementsCopyScriptCommand
a temporary path?
Hi @Econa77
Xcode plugins produce outputs in their sandboxes. In the case of LicensePlist it happens in:
.../SourcePackages/plugins/{project_name}.output/{project_name}/LicensePlistBuildTool/com.mono0926.LicensePlist.Output
Next, in the build log you can see a message:
Copy com.mono0926.LicensePlist.Output 0.1 seconds
Xcode copies the result folder to the app folder. The path is:
.../Build/Products/Debug-iphonesimulator/{project_name}.app/com.mono0926.LicensePlist.Output
.
This happens automatically. So whatever a plugin generates Xcode copies as is to the result app folder. And this is a reason why AddAcknowledgedgementsCopyScriptCommand
exists. The plugin might have generated Settings.bundle
folder. But Xcode doesn't merge folders. It treats having two folders with the same name as a compilation issue.
Thus Settings.bundle
lives in the project directory and the script copies the acknowledgments from the temporary folder.
@vladvlasov256 I understand. Thank you for your explanation.
My mistake seems to have been an error because I deleted Settings.bundle
with the SPM migration and there was no copy destination.
When I made the correct configuration, it was copied and worked without problems.
Description
This PR adds three Swift package plugins for LicensePlist.
Build Tool Plugin
LicensePlistBuildTool
allows using LicensePlist in "Run Build Tool Plug-ins" section in project build phases.Build tool plugins operate with product build directory files. For a common use case with
Settings.bundle
, it's impossible just to specify the output directory. An additional step is running a script in build phases that copy acknowledgments files:To simplify the build tool plug-in setup,
AddAcknowledgementsCopyScriptCommand
has been added.AddAcknowledgementsCopyScriptCommand
AddAcknowledgementsCopyScriptCommand
automatically adds the script to copy files toSettings.bundle
. The command is accessible in the project contextual menu and in theFile
->Packages
menu.GenerateAcknowledgementsCommand
Unlike automatic build phases,
GenerateAcknowledgementsCommand
allows users to manually run LicensePlist from Xcode.Fixes
AddAcknowledgementsCopyScriptCommand.swift
to add a build phase to target build phases,xcodeproj
files,sandboxMode
parameter to check thatpackageSourcesPath
specified,GeneralOptions
to relative URLs,A few notes for @mono0926
The plugins depend on a binary artifact with the new functionality. Thus when PR is ready it will require you to upload a new artifact and update the binary target definition. Hopefully, it should work automatically with the release script.
Also, the previous issue exists with
testInit_sample()
because it depends on a new config example. Should be fixed automatically after the merge.Link to an uploaded artifact from my branch for test purposes: