LicensePlist
is a command-line tool that automatically generates a Plist of all your dependencies, including files added manually(specified by YAML config file) or using Carthage
or CocoaPods
. All these licenses then show up in the Settings app.
App Setting Root | License List | License Detail |
---|---|---|
Warning
SPM(Swift Package Manager) are not supported.
pod 'LicensePlist'
# Installation path: `${PODS_ROOT}/LicensePlist/license-plist`
brew install mono0926/license-plist/license-plist
Or
brew tap mono0926/license-plist
brew install license-plist
mint run mono0926/LicensePlist
Download from Releases, then copy to /usr/local/bin/license-plist
etc.
Or you can also download the latest binary and install it with a one-liner.
curl -fsSL https://raw.githubusercontent.com/mono0926/LicensePlist/master/install.sh | sh
Clone the master branch of the repository, then run make install
.
git clone https://github.com/mono0926/LicensePlist.git
make install
Cartfile
or Pods
, simply execute license-plist
.com.mono0926.LicensePlist.Output
directory will be generated.Settings.bundle
.
Settings.bundle
├── Root.plist
├── com.mono0926.LicensePlist
│ ├── APIKit.plist
│ ├── Alamofire.plist
│ └── EditDistance.plist
├── com.mono0926.LicensePlist.plist
├── en.lproj
│ └── Root.strings
└── ja.lproj
└── Root.strings
You can see options by license-plist --help
.
--cartfile-path
Cartfile
--mintfile-path
Mintfile
--pods-path
Pods
--package-path
Package.swift
LicensePlist
tries to find YourProjectName.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
and YourProjectName.xcworkspace/xcshareddata/swiftpm/Package.resolved
, then uses new one.--package-paths
Package.swift
license-plist --package-paths /path/to/package1/Package.swift /path/to/package2/Package.swift
--xcodeproj-path
"*.xcodeproj"
.xcodeproj
LicensePlist
will attempt to load the Package.resolved
from that Xcode project. If you specify somedir/*.xcodeproj
then LicensePlist
will load from the first xcodeproj
it finds in somedir
.--xcworkspace-path
"*.xcworkspace"
.xcworkspace
LicensePlist
will load the Package.resolved
from that Xcode workspace. If you specify somedir/*.xcworkspace
then LicensePlist
will load from the first xcworkspace
it finds in somedir
.--xcworkspace-path
supersedes any provided --xcodeproj-path
.--output-path
com.mono0926.LicensePlist.Output
--output-path YOUR_PRODUCT_DIR/Settings.bundle
--github-token
LicensePlist
uses GitHub API, so sometimes API limit error occures. You can avoid it by using github-token.repo
scope is needed.--config-path
license_plist.yml
--prefix
com.mono0926.LicensePlist
--html-path
--markdown-path
--force
LicensePlist
saves latest result summary, so if there are no changes, the program interrupts.
LicensePlist
at Run Script Phase
every time 🎉--force
flag.--add-version-numbers
SomeLibrary
, by adding --add-version-numbers
flag, the nasrc="https://raw.github.com/umireon/LicensePlist/main/ll be changed to SomeLibrary (X.Y.Z)
.
X.Y.Z
is parsed from CocoaPods and Cartfile information, and GitHub libraries specified at Config YAML also support this flag.--add-sources
--suppress-opening-directory
--suppress-opening-directory
flag, this behavior is suppressed.--single-page
--fail-if-missing-license
--silence-mode
--silence-mode
flag, the output of the logger will not print.Add a Run Script Phase
to Build Phases
:
if [ $CONFIGURATION = "Debug" ]; then
/usr/local/bin/license-plist --output-path $PRODUCT_NAME/Settings.bundle --github-token YOUR_GITHUB_TOKEN
fi
Alternatively, if you've installed LicensePlist via CocoaPods the script should look like this:
if [ $CONFIGURATION = "Debug" ]; then
${PODS_ROOT}/LicensePlist/license-plist --output-path $PRODUCT_NAME/Settings.bundle --github-token YOUR_GITHUB_TOKEN
fi
A GitHub source can be explicitly defined to include the license in the scenario where it can't be inferred from your dependency files.
github:
- owner: mono0926
name: LicensePlist
version: 1.2.0
If you need to include a license that isn't available on GitHub, you can place the license text in the config file to be included in the output. The license text can also be read from a local file, to keep the config file clean.
License body directly in the config file:
manual:
- source: https://webrtc.googlesource.com/src
name: WebRTC
version: M61
body: |-
Copyright (c) 2011, The WebRTC project authors. All rights reserved.
...
...
...
License body in local file:
manual:
- name: "Dummy License File"
file: "dummy_license.txt"
Excludes can be defined to exclude matching libraries from the final output.
An exclude is a dictionary containing any combination of name
, source
, owner
, or licenseType
.
When using the dictionary format:
(name: LicensePlist) AND (owner: mono0926)
Exclude a package by name:
exclude:
- name: LicensePlist
Exclude packages using a specific license:
exclude:
- licenseType: "Apache 2.0"
Exclude packages using any matching licenses:
exclude:
- licenseType: /BSD/
Exclude packages from a specific github owner:
exclude:
- owner: mycompany
Exclude packages from a specific github owner containing matching licenses:
exclude:
- owner: mycompany
licenseType: /^(?!.*MIT).*$/ # this regex excludes packages that do NOT use the MIT license
Exclude a package from a specific github owner and repo:
exclude:
- owner: mycompany
name: private-repo
If a library name is unsuitable for the output bundle, you can explicitly rename it. This can be used when a library name is too vague, or if more human-readable names are needed.
rename:
LicensePlist: License Plist # Rename LicensePlist to "License Plist"
WebRTC: Web RTC # Rename WebRTC to "Web RTC" (which is faulty, but used for test)
Execute swift package generate-xcodeproj
or make xcode
.
Donations are welcome if you like LicensePlist🤗
link |
Stars: 0 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics