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

Runs pre-gen command before validating project #1500

Conversation

simonbs
Copy link
Contributor

@simonbs simonbs commented Aug 30, 2024

This PR updates the order of operations in the generate command to run the pre-gen command before project validation.

When running the generate command, the validation step fails if a target's sources list contains directories that don't exist yet. This is an issue when these directories are meant to be created by a pre-gen command.

Consider the following project specification:

name: Example
options:
  preGenCommand: ./scripts/generate-sources.sh
targets:
  Example:
    scheme: {}
    deploymentTarget: '16.0'
    platform: iOS
    type: application
    sources:
    - path: Example
    - path: GeneratedSources

The pre-gen command generates Swift source files into the GeneratedSources folder, which is in .gitignore. Without the changes in this PR, running generate results in an error:

Spec validation error: Target "Example" has a missing source directory "/Users/simonbs/Developer/Example/GeneratedSources"

With the changes in this PR, the pre-gen command is executed before the project is validated, meaning that GeneratedSources is present during validation. This prevents the error and causes project generation to succeed.

Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks @simonbs

@yonaskolb yonaskolb merged commit 2cf88e8 into yonaskolb:master Sep 12, 2024
2 checks passed
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.

2 participants