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

Fix generating CoreData models in resourceSynthesizer .coreData() #6201

Merged

Conversation

alexfilimon
Copy link
Contributor

Resolves #6200

Short description 📝

I have realized that during project mapping, resources and CoreData models are explicitly separated in the project structure (Target.resources and Target.coreDataModels). However, in the SynthesizedResourceInterfaceProjectMapper class, when generating code from templates, the search for files is done only in Target.resources. When generating the CoreData template, it looks for files with the xcdatamodeld extension, which are located in Target.coreDataModels.

  • I have modified it to search for the appropriate files for code generation in both resources and coreDataModels.
  • I have also enhanced the tests in SynthesizedResourceInterfaceProjectMapperTests, and running these tests before my changes will result in failures.

How to test the changes locally 🧐

  1. Create a project with .coreData() resourceSynthesizer
  2. Run the tuist target with the parameters (generate, --no-open, --path /path/to/project)
  3. Make sure that the TuistCoreData+AppCore.swift file appears in the tuist Derived folder

Contributor checklist ✅

  • The code has been linted using run mise run lint:fix
  • The change is tested via unit testing or acceptance testing, or both
  • The title of the PR is formulated in a way that is usable as a changelog entry
  • In case the PR introduces changes that affect users, the documentation has been updated

Reviewer checklist ✅

  • The code architecture and patterns are consistent with the rest of the codebase
  • Reviewer has checked that, if needed, the PR includes the label changelog:added, changelog:fixed, or changelog:changed, and the title is usable as a changelog entry

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR! The changes look good – however, can you update the ios_app_with_coredata fixture, so it would have failed without your changes?

@alexfilimon alexfilimon force-pushed the fix/coredata-model-generating-issue-6200 branch from 37749b5 to 2125397 Compare April 19, 2024 19:51
@alexfilimon
Copy link
Contributor Author

Yes, of course. @fortmarek thanks for the suggestion.
I updated the fixture ios_app_with_core_data and checked that without my fix this test was failing

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Thanks for updating the fixture! We can merge this after the lint pipeline is fixed (you need to run mise run lint:fix. Also, if we can update the coredata template file, that'd be amazing

@alexfilimon alexfilimon force-pushed the fix/coredata-model-generating-issue-6200 branch from 5c8e9cf to f114566 Compare April 24, 2024 13:03
Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

👏

@fortmarek fortmarek added the changelog:fixed PR will be listed in the Fixed section of CHANGELOG label Apr 24, 2024
@fortmarek fortmarek merged commit b4be486 into tuist:main Apr 24, 2024
8 checks passed
@fortmarek
Copy link
Member

@all-contributors add @alexfilimon for code

Copy link
Contributor

@fortmarek

I've put up a pull request to add @alexfilimon! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:fixed PR will be listed in the Fixed section of CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResourceSynthesizer .coreData() is not generating code for CoreData models
3 participants