felixherrmann / swift-package-list Goto Github PK
View Code? Open in Web Editor NEWA command-line tool to get all used SPM-dependencies of an Xcode project or workspace.
License: MIT License
A command-line tool to get all used SPM-dependencies of an Xcode project or workspace.
License: MIT License
The project is already building on visionOS, just need to add it as a supported platform.
I want to start with saying: I love this software! Thanks for creating it!
I was wondering if there is an easy way to add the license name as a field to the output? The output files right now have a license
file with the raw text of the license, but I was wondering if you would be open to add the licenseName
, in the form of an SPDX license identifier to the output as well?
Background: In our software attributions list, we list all the included components, their name, version and license identifier. Then, when one clicks on a license, the full text appears, but we first want to start by showing just the license identifier.
In our use case we are using the json output of the package list.
Currently there is no support for SPM projects. We have everything we need to accomplish that (underlying Xcode workspace, derived-data directory etc.).
Currently there is one top-level function that handles the entire package-list reading from a bundle; this is not very flexible, especially in the UI target.
Hi,
I'd like to be able to specify the output file name.
Can't see that in the options, just the path?
Thanks,
Jules.
For example, integrating SQLite with https://github.com/stephencelis/SQLite.swift
results in a runtime error: The file "SQLite" couldn't be opened because there is no such file; adding the optional git extension like https://github.com/stephencelis/SQLite.swift.git
works.
The Swift Package Manager
can show you a Dependency-Tree. But that works only on packages directly, not on projects. So you can never see a Dependency-Tree for your project.
If this tool could build a Depdency-Tree for your project, that would be fantastic.
I build a script for that, but having it in your tool would be better, especially since I don't have your experience and am not 100% sure if that's 100% resistent against edge-cases:
if [[ $1 == "" ]]; then
echo "Missing build dir as 1st parameter"
exit 1
fi
if [[ $2 == "" ]]; then
echo "Missing project dir as 2nd parameter"
exit 1
fi
BUILD_DIR=$1
PROJECT_DIR=$2
echo "Build dependencies tree"
cd "$BUILD_DIR/../../SourcePackages/checkouts"
exportFile="$PROJECT_DIR/dependencies-tree.md"
echo "# Dependencies trees for each Swift-Package" > "$exportFile"
echo "" >> "$exportFile"
echo "Build date: $(date '+%Y-%d-%m %a %H:%M:%S %Z')" >> "$exportFile"
echo "" >> "$exportFile"
for directory in */; do
echo "Tree for $directory"
echo "" >> "$exportFile"
echo "## Tree for $directory" >> "$exportFile"
pushd $directory
swift package show-dependencies >> "$exportFile"
echo "" >> "$exportFile"
echo "" >> "$exportFile"
popd
done
Currently there is a plugin for each output-type; this causes multiple problems:
Package.resolved
data.Apple requires a privacy manifest from spring 2024; non of the targets collect user data or access any of the listed APIs, therefore the manifest will be empty.
I keep getting the following error message: No checkouts-path found in your DerivedData-folder
Xcode 13.2.1, macOS Monterey 12.2
Currently there is only the basic documentation and a big README describing everything. This can be improved by configuring a proper and interactive DocC documentation.
I have updated SwiftPackageList to 1.4.0. This caused a package called swift-argument-parser
v1.0.3 to get added to the SPM. Is this OK?
Following the new instructions, I downloaded project and ran make update
and received the following error:
sh uninstall.sh
sh: uninstall.sh: No such file or directory
make: *** [update] Error 127
Thought I would try uninstall and install:
make uninstall
returns rm -f "/usr/local/bin/swift-package-list"
make install
returns the following:
swift build --configuration release
Fetching https://github.com/apple/swift-argument-parser from cache
Fetched https://github.com/apple/swift-argument-parser (0.57s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 1.0.3 (0.62s)
Creating working copy for https://github.com/apple/swift-argument-parser
Working copy of https://github.com/apple/swift-argument-parser resolved at 1.0.3
[13/13] Build complete!
cp -f ".build/release/SwiftPackageListCommand" "/usr/local/bin/swift-package-list"
cp: .build/release/SwiftPackageListCommand: No such file or directory
make: *** [install] Error 1
Am I doing something wrong?
I have some packages with license files that are not being included in the output. What strategy is used to discover license content?
Once Tuist 4 is released CI will fail because the test examples have the old project format and tuist dump
can no longer compile it.
Would love to try out your tool, but regardless of the installation method I get the same error (see below). You got any idea? I double checked the $PATH
already but this seems fine.
Version: 4.0.1
mint run swift-package-list Test.xcodeproj
Error: The file “swift-package-list” couldn’t be opened because there is no such file.
swift-package-list Test.xcodeproj
Error: The file “swift-package-list” couldn’t be opened because there is no such file
Run script build phase 'SwiftPackageListPlugin' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked.
PhaseScriptExecution SwiftPackageListPlugin <HIDDEN>
Error: The file “swift-package-list” couldn’t be opened because there is no such file.
LLVM Profile Error: Failed to write file "default.profraw": Operation not permitted
Command PhaseScriptExecution failed with a nonzero exit code
Error: The file “swift-package-list” couldn’t be opened because there is no such file.
LLVM Profile Error: Failed to write file "default.profraw": Operation not permitted
Command PhaseScriptExecution failed with a nonzero exit code
It's not worth the effort to maintain that.
New Tuist version no longer uses Tuist/Dependencies.swift
but rather Tuist/Package.swift
. In the current state running the command produces:
No build directory found in /Users/anurag.ajwani/Library/Developer/Xcode/DerivedData for ...
Command:
swift-package-list Tuist/Package.swift \
--output-type settings-bundle \
--output-path App/Resources
Hi,
Thanks a lot for this Swift package first of all!
I just integreated in my iOS app, and unfortunately I'm unable to make it work, as I'm getting an error in PDFGenerator
complaining with No such module AppKit
.
I following the steps in the README installing it via Homebrew, then generating the package-list.json
, adding it to the Xcode project and adding the build phase.
Have I done something incorrectly? I've currently imported all three packages (the binary too) when adding your package dependency to my project.
Thanks!
Hi,
I added the SPM, added the executable and the ui...
I assumed I didn't have to install (Aka using mint) as I used the SPM ?
Added the build phase and I'm getting this error...
error: Build input files cannot be found: '/Users/jm/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/ArgumentParser.o', '/Users/jm/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/ArgumentParserToolInfo.o' (in target 'swift-package-list' from project 'SwiftPackageList')
Any ideas ?
Thanks,
Jules.
First of all, love this software :)
If I run xcodebuild -resolvePackageDependencies
with an additional argument of -clonedSourcePackagesDirPath ~/Packages
swift-package-list cannot find the workspace-state.json
.
Enhancement
In addition to --derived-data-path
can you also provide an alternative --source-packages-data-path
to override this?
Rationale
Is this a feature you could add, please?
Currently we print the error message and then return in the run method. This can easily be replaced with throwing an error with description.
Xcode 13.3 introduced a new Package.resolved version (2). The entire object structure has changed (as shown in #19) and we need a system to support version 1, 2 and any upcoming versions. Version 2 gets also rid of the package name... we have to switch to the last path component of the repository URL (which is not ideal but better than the new identity parameter).
The Apple silicon powered runners are now available for open-source. This will result in much faster build times.
Hello. Thanks for your great tool.
I have a suggestion to add some improvements to your tool.
For now, we can define the path to xcodeproj/xcworkspace because we need the Package.resolved
file.
But for now, in iOS community, teams are using Tuist to configure their project. With using Tuist you don't have Package.resolved
file like other standard projects. Instead, you have a .package.resolved
file that creates by Tuist when you setup the project.
What do you think about it?
Hi @FelixHerrmann,
First off, thanks for developing such an incredible package. It's been a game-changer for my projects. Currently, I'm working on integrating it into a new project, structured as follows, with dependencies managed via Package.swift
that is consumed by Tuist 4.
.
├── App
│ ├── App.xcodeproj
│ ├── Project.swift
│ ├── Tests
│ └── iOS
├── Frameworks
│ ├── AppFeature
│ ├── Core
│ ├── DesignSystem
│ └── HomeFeature
├── Package.resolved
├── Package.swift
├── Qualifly-PPL-H.xcworkspace
├── Tuist
│ ├── Config.swift
│ └── ProjectDescriptionHelpers
└── Workspace.swift
However, I've encountered an issue when executing swift-package-list
with the error message:
> swift-package-list Package.swift
Error: No build directory found in /Developer/Xcode/DerivedData for project Developer/ProjectName/Package.swift
Could anyone provide insights or suggestions on how to resolve this error?
The Core target has some limitations. The following things would be helpful for future development:
scan
subcommand can be represented by a new output type of the generate
subcommandFirst of all, thank you for making this! It works beautifully when I run it from the terminal!
Unfortunately, I have not been able to get it to work as a build script phase. I installed swift-package-list on my machine beforehand, but it still doesn't work. I also tried adding it as a package dependency to my project, but that also didn't work. Either way it gives the warning "swift-package-list not installed". I am just using an xcodeproj, not xcworkspace. I'm happy to give any additional details that might be helpful. Thank you!
4.0 has a lot of API, it's a good opportunity to start writing migration guides.
Hi, thank you for maintaining this great tool!
Looking at the output it seems like that the dependency name from Package.resolved is always the repository name but not the Package name as in the name as defined in the Package.swift file.
As an example see the following output:
{
"license" : "Copyright 2015 Catamorphic, Co.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"name" : "ios-client-sdk",
"repositoryURL" : "https:\/\/github.com\/launchdarkly\/ios-client-sdk",
"revision" : "89d87b2b492624dab41dc407fd11b18ebb3e90cf",
"version" : "8.3.1"
},
name
is defined as ios-client-sdk here.
When looking at the Package.swift file in the dependencies repo however we see that the Package name is in fact LaunchDarkly.
I think it would be beneficial if this script could fetch the 'user facing' dependency name resolved from the Package file.
The validation checks on the Serialization classes are wrong, they only check in the opposite direction, we can simply get rid of them.
Thanks for the very useful tool!
I would like to suggest that outputting into stdout
might be a very useful addition to using this tool in various pipelines :-)
Currently I was able to capture the output by using mkfifo
and juggling around with it, but if something goes wrong (e.g. Package.resolved
is not in a current state so the tool crashes with a "file not found" error), the other end of the pipeline reading from the fifo gets stuck and has to time out...
Provide a type-safe Bundle extension to retrieve the Acknowledgements.pdf
file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.