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

Support custom scheme with pre/post action #200

Closed
wants to merge 2 commits into from

Conversation

dangthaison91
Copy link
Contributor

@dangthaison91 dangthaison91 commented Jan 17, 2019

This will resolve #195 and #199

Solution πŸ“¦

This PR allow user:

  • Custom their Scheme and Tuist can generate more than 1 scheme for each target
  • If there is no Scheme manifest for a target, auto-generate scheme for each target (keep current behavior)
  • Add pre/post action for Build/Test/Archive Action

Usage:

let TuistTarget = "Tuist-Demo"
let TuistTest = "Tuist-DemoTest"

let AppTarget = Target(name: TuistTarget,
                    platform: .iOS,
                    product: .app,
                    bundleId: "io.tuist.Tuist-Demo",
                    infoPlist: "Tuist-Demo/Info.plist",
                    sources: "",
                    resources: ["Tuist-Demo/**/*.{xib}", "Tuist-Demo/**/*.{xcassets}"],
                    dependencies: [])

let TestTarget = Target(name: TuistTest,
                  platform: .iOS,
                  product: .unitTests,
                  bundleId: "io.tuist.Tests",
                  infoPlist: "Tuist-DemoTests/Info.plist",
                  sources: "",
                  dependencies: [.target(name: TuistTarget)],
                  settings: Settings(base: ["TEST_HOST": "$(BUNDLE_LOADER)"]))

let DevScheme = Scheme(name: TuistTarget,
                       shared: true,
                       buildAction: BuildAction(targets: [TuistTarget, TuistTest],
                                                preActions: [SchemeAction(title: "Dev", scriptText: "$ Dev script", target: TuistTarget)]),
                       testAction: TestAction(targets: [TuistTest]),
                       runAction: RunAction(executable: TuistTarget))

let ProductionScheme = Scheme(name: TuistTarget,
                              shared: true,
                              buildAction: BuildAction(targets: [TuistTarget, TuistTest],
                                                       preActions: [SchemeAction(title: "Production", scriptText: "$ Production script", target: TuistTarget)]),
                              runAction: RunAction(executable: TuistTarget))

let project = Project(name: "Tuist-Demo",
                      up: [],
                      targets: [AppTarget, TestTarget],
                      schemes: [DevScheme, ProductionTarget])

Implementation πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

  • Update SchemeGenerator
  • Update Tests
  • Update Changelog

@pepicrft
Copy link
Contributor

This PR is looking good @dangthaison91. I'd only add an extra bullet point to your list, write some documentation on this repository to explain how to define schemes and why you might need them.
Thanks for bringing up this great contribution.

@pepicrft
Copy link
Contributor

By the way, I invited you as a contributor so you no longer need to work from a fork. It'll make things easier for you.

@tuistbot
Copy link
Contributor

Danger has errored

[!] Invalid Dangerfile file: Please include a CHANGELOG entry.
You can find it at CHANGELOG.md.

 #  from Dangerfile:11
 #  -------------------------------------------
 #    MESSAGE
 >    raise(message)
 #  end
 #  -------------------------------------------

Generated by 🚫 Danger

@kwridan kwridan mentioned this pull request Feb 23, 2019
@kwridan
Copy link
Collaborator

kwridan commented Feb 23, 2019

Hi @dangthaison91 - I have made a few updates to master (#237) which sadly introduced some conflicts to your change. I've just pushed an update to #241 that should hopefully make resolving the conflicts a bit easier.

On master the conversions between ProjectDescription (manifests) to TuistKit models now takes place in GeneratorModelLoader. This decoupling will allow us to move generator related code to the generator library (#205).

Let me know if you need help resolving those conflicts.

@dangthaison91
Copy link
Contributor Author

Thanks @kwridan , very busy with company project right now, I will spend time to rebase it later and ask you if I need help.

@dangthaison91 dangthaison91 deleted the scheme-manifest branch May 7, 2019 03:41
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.

Scheme PreAction and PostAction
4 participants