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
Allow setting deployment target devices #541
Allow setting deployment target devices #541
Conversation
Generated by π« Danger |
Hey @pepibumur π Just started a draft PR. I added a Now I am trying to apply these changes into a target generation (
so I believe this is a folder I should take a look at. Still figuring out the core concepts of I believe we should do the changes in Could you please confirm I am heading a good direction? π Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #541 +/- ##
==========================================
- Coverage 91.6% 91.27% -0.34%
==========================================
Files 370 369 -1
Lines 20165 19681 -484
==========================================
- Hits 18472 17963 -509
- Misses 1693 1718 +25
Continue to review full report at Codecov.
|
You are right. On one side we have the models in the
The If you look at the
In your case, I'd add another type of settings:
That way we make the manifest settings overridable through base & variant settings. Does it make sense? |
public enum DeploymentTarget: Codable { | ||
case iOS(String, [DeploymentDevice]) | ||
case macOS(String) | ||
// TODO: π Add `watchOS` and `tvOS` support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soon :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, what platforms should we support in this PR? π€
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I leave this TODO or is it possible to support watchOS
and tvOS
right now?
The PR is looking good so far @mollyIV |
Yes, it does @pepibumur thank you! π As the next step, we need to update
Any tip where to look for it in the codebase? π |
Nice work @mollyIV! π
I don't believe they are currently set anywhere, perhaps set them in |
π I think this PR is ready for a round of manual testing π Could you please briefly describe the best way to test my changes manually? I can imagine the following testing steps:
tuist init --name demoProject --platform ios
let project = Project(name: "App",
targets: [
Target(name: "App",
platform: .iOS,
deploymentTarget: .iOS("13.0", [.iphone])
tuist generate
Unfortunately I am not sure how to execute Thoughts? π |
I left some minor comments. Besides them, I'd also:
After addressing this things I think we are in a good state to merge the PR. So happy to seeing this feature making it into Tuist and also your first contribution to the project π |
I forgot to add one thing. What about extending the init command to include that attribute in the generated manifest? |
I had a look at $ tuist init --name Demo --platform ios --deployment-target-version ios --deployment-target-devices iphone ipad Thoughts? π€ |
I noticed all of the |
I'd not add more parameters. Instead, I'd default the platform most common's destination device and latest OS device.
You can ignore those. I have to fix it π¬ |
This PR contains quite a few changes already. Maybe we could create a separate task for this one and tackle it when this PR is merged? |
You can make the call here :). My only concern is that task might end up forgotten in the backlog. |
@@ -191,5 +191,24 @@ final class ConfigGenerator: ConfigGenerating { | |||
} | |||
} | |||
} | |||
|
|||
if let deploymentTarget = target.deploymentTarget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any help how we could test it? Shall we add checking the settings build to an existing method in ConfigGeneratorTest
or maybe create a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, here's an example of one of the test cases that could be written in ConfigGeneratorTests
func test_generateTargetWithDeploymentTarget() throws {
// Given
let target = Target.test(deploymentTarget: .iOS("12.0", [.iphone, .ipad]))
// When
try subject.generateTargetConfig(target,
pbxTarget: pbxTarget,
pbxproj: pbxproj,
projectSettings: .default,
fileElements: ProjectFileElements(),
graph: Graph.test(),
sourceRootPath: AbsolutePath("/project"))
// Then
let configurationList = pbxTarget.buildConfigurationList
let debugConfig = configurationList?.configuration(name: "Debug")
let releaseConfig = configurationList?.configuration(name: "Release")
let expectedSettings = [
"TARGETED_DEVICE_FAMILY": "1,2",
"IPHONEOS_DEPLOYMENT_TARGET": "12.0"
]
assert(config: debugConfig, contains: expectedSettings)
assert(config: releaseConfig, contains: expectedSettings)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added deployment target tests to ConfigGenerator
, thanks for your help π
Hello @pepibumur and @kwridan π Thank you so much for your feedback and help with this PR, I really appreciate it π I did a bit of manual testing (mostly base positive scenarios) and looks it is working as expected π―I will be testing it more tomorrow. Cheers π |
settings["TARGETED_DEVICE_FAMILY"] = .string(deviceFamilyValues.map { "\($0)" }.joined(separator: ",")) | ||
settings["IPHONEOS_DEPLOYMENT_TARGET"] = .string(version) | ||
|
||
if devices.contains(.ipad), devices.contains(.mac) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah didn't realise this ... is the iPad checkbox a pre-requisite to the Mac checkbox ? i.e. is [.iphone, .mac]
an invalid option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more conflict to solve and I think we are good to merge this PR π |
Congrats @mollyIV on your first contribution π π |
Resolves #526
Short description π
This PR is introducing a possibility to declare deployment target in project manifest.
Solution π¦
Added
deploymentTarget
parameter to project manifest.Implementation π©βπ»π¨βπ»
DeploymentTarget
descriptorDeploymentTarget
toTuistGenerator.Target
TARGETED_DEVICE_FAMILY
and*_DEPLOYMENT_TARGET
in Build Settings