Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate the parameters inside license_plist.yml #207

Merged
merged 6 commits into from
Feb 20, 2023

Conversation

vladvlasov256
Copy link
Contributor

Motivation

I believe one day this helpful tool can be used as a Build Tool Plugin in Xcode. Nowadays Xcode doesn't support command line arguments for build tool plugins. But such tools easily can use configuration files.

Solution

We can store an options dictionary in the YAML config with all the main attributes. Also, let's override them if user specifies command-line arguments.

# General options
options:
  outputPath: "./com.mono0926.LicensePlist.Output"
  cartfilePath: Cartfile
  mintfilePath: Mintfile
  podsPath: Pods
  packagePaths:
    - Package.swift
  xcodeprojPath: "*.xcodeproj"
  xcworkspacePath: "*.xcworkspace"
  prefix: com.mono0926.LicensePlist
  gitHubToken: YOUR_GITHUB_TOKEN
  htmlPath: acknowledgements.html
  markdownPath: acknowledgements.md
  force: false
  addVersionNumbers: false
  suppressOpeningDirectory: false
  singlePage: false
  failIfMissingLicense: false
  addSources: false

Some options could be skipped:

  • config path,
  • color,
  • log level.

The config parsing should be logged with a proper log level thus we can't get it from the config file.

Fixes:

  • added GeneralOptions structure to parse options from the config,
  • run() prepares and injects final values into Options,
  • moved default values for the parameters into run() method,
  • updated Readme and sample license_plist.yml,
  • updated testInit_sample() test.

@vladvlasov256
Copy link
Contributor Author

A little note about testInit_sample(). It fails by design because it's fetching the original config and should be ok after merging.

I can hardcode a link to my repo but before merging it should be changed to the original one. So I left it as is after testing locally.

…suppressOpeningDirectory', 'singlePage', 'failIfMissingLicense', and 'addSources' as it implemented for other options
@mono0926 mono0926 merged commit 31d3efc into mono0926:main Feb 20, 2023
@mono0926
Copy link
Owner

@vladvlasov256

Sorry for the delay in response, but merged and released: https://github.com/mono0926/LicensePlist/releases/tag/3.24.1

Thank you for your pull request 🙏

@vladvlasov256 vladvlasov256 deleted the feature/general_options branch February 24, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants