How can we sensibly control the version numbers that go into recources.rc and the various Info.plist. We have an automatically generated header containing the version number and conversions into various formats.
Usually (in sensible projects without impeding projucer dependencies) such a header gets included in the .rc or with the .plist preprocess. But how do we work around projucers helping hands here?
Iâve always found projucer manages the version just fine including in the plist and the include_juce_audio_plugin_client_AU.r resource file. You can also preprocess the plist.
Click on the Xcode exporter
Navigate to Custom PList and set your version number field to whatever you want
Below that set the PList Preprocess field to Enabled
Below that set the PList Prefix Header field
You could then presumably use a single header to manage your version number? that header could also be included by the AppConfig.h to override any settings in there? does that help?
then in ProJucer, set JUCE_DONT_DECLARE_PROJECTINFO as a preprocessor definition.
This will automatically generate a Version.h with your most recent commit number appended to the version number. you could modify it further to read the existing Version.hâs versionNumber line and bump the value by 1âŠ
The only annoying bit I havenât figured out how to do yet is to automatically include the âVersion.hâ in main.cpp and also add it to jucer file.
Well, the AppConfig.h gets rewritten every time you save in ProJucer, like if you add new header/cpp files. Maybe your workflow doesnât involve projucer after the initial project creation, but mine does.
if you put "</some/relative/path/>Version.h" inside the BEGIN_USER_CODE_SECTION and END_USER_CODE_SECTION sections it wonât be overwritten, but you will have to commit the file to your repo.
I have to apologise I didnât remember what the resources.rc was for, I realise now itâs for Windows. Inside the rc file you can see at the top that if you define JUCE_USER_DEFINED_RC_FILE to point to some file it will include this instead of defining all the info for you, does this fit your needs?
@anthony-nicholls: thanks, the plist generation works! Though I donât see any advantage of having the intermediary projucer between me and the project. @matkatmusic: What is the ProjectInfo good for?
But my question remains: how can the resources.rc be customized, so that the defines from a header file can be used? Or more precisely how can JUCE_USER_DEFINED_RC_FILE be set:
If defined as preprocessor directive in projucer it will not get forwarded to the resource compiler (VS2015). No other header seems to get included either. Does anybody actually use this? If not how are you setting Windows resources?
Just to add to the conversation, I have this pre-build script in Xcode which sets the Build number to the number of commits, works very well for my needs:
# Set the build number to the count of Git commits
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
I donât think there is anything stopping you from not using the Projucer, if itâs not an advantage for you then go without.
Iâm not at a Windows machine to test but maybe there is a bug here, possibly because no one is using the feature and a regression has occured at some point? out of interest what Windows resources are you trying to set that the Projucer doesnât already deal with?
Its pretty impractical to keep JUCE up to date without the projucer, but thats a different topic with a lot of ingredients from not providing a referenceable library project to macro orgy.
Is there really nobody who can either confirm or deny that a jucer project can be setup in a way so sets up VS to constructs a Windows version information resource from a header define? Where can JUCE_USER_DEFINED_RC_FILE be set? Or can the resource.rc generation at least be turned off if thats not working?
essentially my question boils down to âWhat is it about the existing resource.rc thatâs causing you a problem with versioning?â
For us we set the version in the jucer project file and it just works, we have bump scripts that set the version number - which if you want to make your life even easier the Projucer has command line arguments that let you set or bump the version number.
I need to be able to put my version information from a header file in the resource.rc. This is not possible, since the projucer generates the resource.rc and it seems the intended way of setting JUCE_USER_DEFINED_RC_FILE is not working since there is no place to be defined where it reaches the resource compiler of VS.
Again we use bump scripts so we can update multiple things. If not that, could you consider using the AppConfig.h as the source of your version number rather than the other way around?
This is highly dependant on how you have things setup but if you have some build scripts (I donât just mean the pre/post build scripts, but the ones that actually trigger the builds) and you regenerate your projects using the Projucer in the build scripts, then you could also handle it there and forget about it when youâre building locally? i.e. your script could read the version from your header file then set the version on the jucer project (using the command line arguments in the Projucer) and resave which will generate a jucer project with the right version just before it builds.
Sounds likely to be a bug to me. I would say the Projucer probably needs a âResources Preprocessor Definitionsâ field in each of the configurations for the relevant exporters, like the âPList Preprocessor Definitionsâ for Xcode.