Swiftpack.co - Package - mono0926/LicensePlist

LicensePlist Logo LicensePlist

Say Thanks!

platforms GitHub license Language: Swift 4.1 Language: Swift 4.2 Language: Swift 5.0 Swift Package Manager compatible

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.

Flow

Demo

| App Setting Root | License List | License Detail | | ------------------------- | ------------------------- | --------------------------- | | | | |

Installation

CocoaPods (Recommended)

pod 'LicensePlist'
# Installation path: `${PODS_ROOT}/LicensePlist/license-plist`

Homebrew (Also Recommended)

$ brew install mono0926/license-plist/license-plist

Or

$ brew tap mono0926/license-plist
$ brew install license-plist

Mint (Also Recommended)

$ mint run mono0926/LicensePlist

Download the executable binary from Releases

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

From Source

Clone the master branch of the repository, then run make install.

$ git clone https://github.com/mono0926/LicensePlist.git
$ make install

Usage

  1. When you are in the directory that contains your Cartfile or Pods, simply execute license-plist.
  2. com.mono0926.LicensePlist.Output directory will be generated.
  3. Move the files in the output directory into your app's 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

Options

You can see options by license-plist --help.

--cartfile-path

  • Default: Cartfile

--mintfile-path

  • Default: Mintfile

--pods-path

  • Default: Pods

--package-path

  • Default: Package.swift
  • If you are using Swift Package Manager inside Xcode, you can use --package-path $PROJECT_FILE_PATH/project.xcworkspace/xcshareddata/swiftpm/Package.swift inside your Run script.

--output-path

  • Default: com.mono0926.LicensePlist.Output
  • Recommended: --output-path YOUR_PRODUCT_DIR/Settings.bundle

--github-token

  • Default: None.
  • LicensePlist uses GitHub API, so sometimes API limit error occures. You can avoid it by using github-token.
  • You can generate token here
    • repo scope is needed.

--config-path

  • Default: license_plist.yml
  • You can specify GitHub libraries(introduced by hand) and excluded libraries

--prefix

  • Default: com.mono0926.LicensePlist
  • You can specify output file names instead of default one.

--html-path

  • Default: None.
  • If this path is specified, a html acknowledgements file will be generated.

--markdown-path

  • Default: None.
  • If this path is specified, a markdown acknowledgements file will be generated.

--force

  • Default: false
  • LicensePlist saves latest result summary, so if there are no changes, the program interrupts.
    • In this case, execution time is less than 100ms for the most case, so you can run LicensePlist at Run Script Phase every time 🎉
  • You can run all the way anyway, by using --force flag.

--add-version-numbers

  • Default: false
  • When the library name is SomeLibrary, by adding --add-version-numbers flag, the name will 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.
License list with versions

--suppress-opening-directory

  • Default: false
  • Only when the files are created or updated, the terminal or the finder opens. By adding --suppress-opening-directory flag, this behavior is suppressed.

--single-page

  • Default: false
  • All licenses are listed on a single page, not separated pages.

--fail-if-missing-license

  • Default: false
  • If there is even one package for which a license cannot be found, LicensePlist returns exit code 1.

Integrate into build

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

Run Script Phase

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

Q&A

How to generate Xcode project?

Execute swift package generate-xcodeproj or make xcode.


Related Articles


Stargazers over time

Stargazers over time


寄付(Donation)

Donations are welcome if you like LicensePlist🤗

Send Money by ウォレットアプリ Kyash

Kyash

Github

link
Stars: 1755

Used By

Total: 0

Releases

3.0.5: Split licences into multiple sections to avoid rendering issues - 2020-10-19 06:09:03

  • Split licences into multiple sections to avoid rendering issues(#138, #144 thanks @Cyberbeni )

3.0.4 - 2020-10-12 03:23:53

3.0.4

3.0.3: Drop Xcode 10 support - 2020-10-12 03:16:55

  • Drop Xcode 10 support
  • Use the official swift-argument-parser( #141, #142 thanks to @Cyberbeni )

3.0.2 - 2020-10-12 03:13:46

3.0.2

3.0.1 - 2020-10-12 03:03:03

3.0.1

3.0.0 - 2020-10-12 03:00:16

3.0.0

2.16.0: Change name of SwiftPackage to `package` from url last path - 2020-07-05 07:03:46

  • Change name of SwiftPackage to package from url last path
    • Fixed #136

2.15.1: Support Mintfile 🌱 - 2020-04-06 02:38:08

  • Support Mintfile 🌱(#133, thanks to @funzin )

2.15.0 - 2020-04-06 02:30:50

2.15.0

2.14.0: Add new parameter. --fail-if-missing-license - 2020-03-20 06:49:00

  • Add new parameter. --fail-if-missing-license (#130, thanks to @watanavex )

2.13.0: Add support for SSH GitHub url for Swift Package Manager - 2020-02-06 02:24:28

  • Add support for SSH GitHub url for Swift Package Manager (#128, thanks to @wrutkowski )

2.12.0: Collect Package.resolved located under xcworkspace - 2020-01-21 02:16:04

  • Collect Package.resolved located under xcworkspace (#127, thanks to @griffin-stewie )

2.11.4: Fix version number - 2020-01-14 10:01:11

  • Fix version number (#126, thanks to @sohichiro )

2.11.3 - 2020-01-14 09:13:11

2.11.3

2.11.2: Supports cocoapods-binary - 2019-12-29 00:19:12

  • Supports cocoapods-binary (#124, #125, thanks to @konomae )

2.10.0: Add `--single-page` option - 2019-12-03 06:42:13

Add --single-page option (#120, Thanks to @NewFieldForMe )

  • Default: false
  • All licenses are listed on a single page, not separated pages.

2.9.0: Enhance SwiftPM Support - 2019-10-27 12:03:33

  • Parse Xcode 11 projects with integrated SwiftPM (#114, thanks to @JulianKahnert )
  • Fix issues with SwiftPM (#115, thanks to @andlang )

2.8.1: Support `LICENSE_PLIST_GITHUB_TOKEN` environment variable - 2019-10-09 09:36:04

  • Support LICENSE_PLIST_GITHUB_TOKEN environment variable (#113, thanks to @417-72KI )

2.8.0 - 2019-10-09 09:21:35

2.8.0

2.7.3: Fixed optional Swift Package versions - 2019-10-03 09:00:58

  • Fixed optional Swift Package versions (#112, thanks to @mbuchetics )

2.7.2 - 2019-10-03 08:54:44

2.7.2

2.7.1: iOS 13 support - 2019-10-01 00:48:20

  • iOS 13 support (#109, thanks to @roana0229 )

2.7.0 - 2019-10-01 00:42:00

2.7.0

2.6.0: SwiftPM (Swift Package Manager) Support - 2019-09-24 03:32:05

  • SwiftPM (Swift Package Manager) support (#108, thanks to @mbuchetics )

2.5.8 - 2019-08-10 10:51:17

  • Escape HTML entities in HTML output support (#106, thanks to @iseebi )

2.5.7 - 2019-08-10 09:50:42

2.5.7

2.5.6 - 2019-08-10 09:48:01

2.5.6

2.5.0: Fix Xcode 10.1/10.2 Problems(Build and CocoaPods installation) - 2019-04-05 07:14:51

  • #102

2.4.0 - 2019-04-03 06:41:45

Fix the installation issues: #102, #103

2.3.2 - 2019-04-03 05:17:20

2.3.2