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

Modify how 'override' argument is implemented #20

Closed
end2endzone opened this issue Dec 16, 2017 · 2 comments
Closed

Modify how 'override' argument is implemented #20

end2endzone opened this issue Dec 16, 2017 · 2 comments
Labels
Milestone

Comments

@end2endzone
Copy link
Owner

end2endzone commented Dec 16, 2017

The current implementation defines --override as the following:

  • If *.h or *.cpp file exists,
  • Compute MD5 of input file and compare with MD5 found in *.cpp file.
  • If MD5 compare is the same, skip file generation
  • Else, look for the --override flag for deciding if we should regenerate the output file.

This makes the --override flag useless if the MD5 in the cpp file is not changed while the content of the *.cpp file is changed.

In other words, --override should always override the output files

The implementation should be changed as the following:

  • By default, the application stores the input file 'modified date' into the generated output files header.
  • If the output files exists and that 'modified date' in the generated files matches the intput files, then skip file regeneration (the resulting files will likely be the same which will trigger Visual Studio to rebuild the project)
  • If the --override flag is specified, then the application should not look for the 'modified date' value and regenerated the files anyway.
@end2endzone
Copy link
Owner Author

Note that implementing this will let the MD5 computation obsolete. The MD5 implementation may be set as deprecated.

The getMd5() api will also be broken.

@end2endzone end2endzone added this to the 2.0 milestone Jan 5, 2018
@end2endzone
Copy link
Owner Author

Another option would be to store the input file's modified date into the destination files. This date would allow the application to know if the input file was modified.

The rules are as follow:

  • If the override flag is specified, override the destination files.
  • If the destination files already exists and that input file is modifed, then the override flag should be automatically set.

end2endzone added a commit that referenced this issue Jan 8, 2018
…he application should override or not the output files.
end2endzone added a commit that referenced this issue Jan 14, 2018
…ented

* Implemented getOutputFileModifiedDate() function to get the modified date of an embedded file.
* Modified logic in main.cpp to follow issue #20 suggested behavior.
end2endzone added a commit that referenced this issue Jan 14, 2018
* Now using the input file's modified date to know if the output files is outdated.
* Implemented the same logic for header and source files:
  * If file does not exists, it is written.
  * If the override flag is specified, the file is overwrite.
  * If the file exists, the application looks if the file is up to date and update the file accordingly.
  * If not, then the file is untouched (skipped).
* Note that application does not return an error anymore when the file already exist.
* The application returns a success code for all modes: write, update, overwrite & skip. The application returns an error code is the application is unable to process the selected mode.
end2endzone added a commit that referenced this issue Jan 14, 2018
…ot required anymore. The application now uses file modified date to detect if input file has changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant