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

Add new InfoPlist.extendingDefault case #448

Merged
merged 9 commits into from Sep 3, 2019
Merged

Conversation

pepicrft
Copy link
Contributor

@pepicrft pepicrft commented Jul 18, 2019

Since Tuist seeks to remove duplications and hide intricacies from developers' projects and workflows, the content of the Info.plist is a good candidate to be managed by Tuist.

Solution 📦

Tuist already supports passing the content of the target's Info.plist to the manifest. However, the whole content needs to be included in the dictionary, providing no benefit to the user compared to having the content in an Info.plist file.

This PR extends the InfoPlist model to add a new case, InfoPlist.extendingDefault(with: ["CFBundleShortVersionString": "3.2.1"]). Tuist provides the base values based on the product type and the platform and extends them using the values provided by the user.

Implementation 👩‍💻👨‍💻

  • Implement InfoPlistContentProvider
  • Configure the DerivedFileGenerator generation logic to get the content using the InfoPlistContentProvider.
  • Add unit tests
  • Add acceptance tests.
  • Add documentation.
  • Update CHANGELOG.

@pepicrft pepicrft changed the title ### Short description 📝 Info.plist files are required by some products like apps. If we look at the content of those Info.plist files, we realize that all of them have the same set of base attributes. The ones that are modified the most are the ones associated to the build and version numbers. Add new InfoPlist.extendingDefault case Jul 18, 2019
@pepicrft pepicrft requested review from ollieatkinson and a team July 18, 2019 14:48
@pepicrft pepicrft changed the title Add new InfoPlist.extendingDefault case [WIP] Add new InfoPlist.extendingDefault case Jul 18, 2019
@codecov
Copy link

codecov bot commented Jul 18, 2019

Codecov Report

Merging #448 into master will increase coverage by 0.09%.
The diff coverage is 95.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #448      +/-   ##
==========================================
+ Coverage    92.6%   92.69%   +0.09%     
==========================================
  Files         347      350       +3     
  Lines       17815    18077     +262     
==========================================
+ Hits        16497    16756     +259     
- Misses       1318     1321       +3
Impacted Files Coverage Δ
...torTests/Generator/DerivedFileGeneratorTests.swift 100% <100%> (ø) ⬆️
...uistGenerator/Generator/DerivedFileGenerator.swift 100% <100%> (ø) ⬆️
...Generator/Mocks/MockInfoPlistContentProvider.swift 100% <100%> (ø)
...rces/TuistKit/Generator/GeneratorModelLoader.swift 89.12% <33.33%> (-0.4%) ⬇️
Sources/ProjectDescription/InfoPlist.swift 88.57% <33.33%> (-5.18%) ⬇️
Sources/TuistGenerator/Models/InfoPlist.swift 71.42% <75%> (+17.58%) ⬆️
...Generator/Generator/InfoPlistContentProvider.swift 97.61% <97.61%> (ø)
...ests/Generator/InfoPlistContentProviderTests.swift 99.2% <99.2%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c778fed...47dbbd1. Read the comment docs.

Copy link
Collaborator

@ollieatkinson ollieatkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥋

Great idea!

👍 Looking good so far

@tuistbot
Copy link
Contributor

tuistbot commented Aug 2, 2019

1 Warning
⚠️ Have you introduced any user-facing changes? If so, please take some time to update the documentation. Keeping the documentation up to date makes it easier for users to learn how to use Tuist.

Generated by 🚫 Danger

@pepicrft
Copy link
Contributor Author

pepicrft commented Aug 3, 2019

This PR is ready for review @tuist/core

@pepicrft pepicrft changed the title [WIP] Add new InfoPlist.extendingDefault case Add new InfoPlist.extendingDefault case Aug 3, 2019
Copy link
Collaborator

@kwridan kwridan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API looks great overall - left some minor comments

@pepicrft
Copy link
Contributor Author

pepicrft commented Sep 2, 2019

@ollieatkinson / @kwridan this is ready for another look.

Copy link
Collaborator

@ollieatkinson ollieatkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -0,0 +1 @@
Derived/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want .gitignore at this level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say so. That way we can run the test assuming there are no files in that directory.

let project = Project(name: "MainApp",
settings: settings,
targets: [
Target(name: "App",
platform: .iOS,
product: .app,
bundleId: "io.tuist.App",
infoPlist: "Config/App-Info.plist",
infoPlist: .extendingDefault(with: [:]),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth adding a custom value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's already being tested with unit tests, so I don't think it adds much value.

@pepicrft pepicrft merged commit 083defa into master Sep 3, 2019
@pepicrft pepicrft deleted the infoplist-default-extended branch September 3, 2019 15:50
@kwridan kwridan mentioned this pull request Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants