Hi,
Can carbide set the major, minor and build number at the PKG file? For example, I want my build number to be my svn revision number. How can I use carbide to do that automatically so every call to makesis will read the revision?
Thanks
Imzadi
Hi,
Can carbide set the major, minor and build number at the PKG file? For example, I want my build number to be my svn revision number. How can I use carbide to do that automatically so every call to makesis will read the revision?
Thanks
Imzadi
I think you are asking for a PKG editor, which Carbide doesn't currently do. You need to set these versions yourself in the PKG file. To see what Carbide can do with PKG files see the Carbide.c++ docs, there a topic on "working with PKG files".
Tim
Hi timm-ah,
Thanks for your reply. I looked at the help files of carbide but didn't find anything helpfull. Is there other IDE that can provide this functionality?
Imzadi
I made a small tool that reads current revision on SVN from .svn\\dir-wcprops file or from .svn\\entries file and writes it to the PKG file in the place needed.
I found no other way.
The code is packed in an executable that I run from project's root.
One sample code below (it works with Tortoise SVN):
Code:bool GetRevisionNumber(char* aRevision) { bool retVal = true; char rev1[5]; char rev2[5]; rev1[0] = 0; rev2[0] = 0; char lineContent[256]; char tokenToFind[30]; //get the revision information from ".svn\dir-wcprops" file FILE* rev1File = NULL; char rev1FilePath[50]; strcpy(rev1FilePath, ".svn\\dir-wcprops"); if((rev1File = fopen(rev1FilePath, "r")) != NULL) { char *revisionPtr, *auxPtr; strcpy(tokenToFind, "/!svn/ver/"); while (!feof(rev1File)) { fgets(lineContent, 256, rev1File); if(revisionPtr = strstr(lineContent, tokenToFind)) { revisionPtr = revisionPtr + strlen(tokenToFind); auxPtr = strchr(revisionPtr, '/'); auxPtr[0] = 0; strcpy(rev1, revisionPtr); break; } } fclose(rev1File); } //get the revision information from ".svn\entries" file FILE* rev2File = NULL; char rev2FilePath[50]; strcpy(rev2FilePath, ".svn\\entries"); if((rev2File = fopen(rev2FilePath, "r")) != NULL) { char *revisionPtr, *auxPtr; strcpy(tokenToFind, "committed-rev=\""); while (!feof(rev2File)) { fgets(lineContent, 256, rev2File); if(revisionPtr = strstr(lineContent, tokenToFind)) { revisionPtr = revisionPtr + strlen(tokenToFind); auxPtr = strchr(revisionPtr, '"'); auxPtr[0] = 0; strcpy(rev2, revisionPtr); break; } } fclose(rev2File); } if(rev1 || rev2) { strcpy(aRevision, rev1); if(strcmp(rev1, rev2)) { cout << "Revision number obtained but not confirmed! Check your .svn folder!" << endl; retVal = false; } else { cout << "Revision number obtained and confirmed! Current revision: " << aRevision << endl; retVal = true; } } else { cout << "Could not obtain revision number! Check your .svn folder!" << endl; retVal = false; } return retVal; }
Hi iulian_moldovan,
Wow! thanks for your efforts. I just saw it. You're the king!
Imzadi
Friday I installed Tortoise 1.4.0 and had to make a change in the code: the folder .svn\dir-wcprops changed to ".svn\all-wcprops" and the folder ".svn\entries" does not contain version information in a "programatically-readable" form
So the code simplifies to:
Code:////////////////////////////////////////////////////////////////////////// //gets the revision number from some .svn folder files ////////////////////////////////////////////////////////////////////////// bool GetRevisionNumber(char* aRevision) { bool retVal = true; char rev1[5]; rev1[0] = 0; char lineContent[256]; char tokenToFind[30]; //get the revision information from ".svn\all-wcprops" file FILE* rev1File = NULL; char rev1FilePath[50]; strcpy(rev1FilePath, ".svn\\all-wcprops"); if((rev1File = fopen(rev1FilePath, "r")) != NULL) { char *revisionPtr, *auxPtr; strcpy(tokenToFind, "/!svn/ver/"); while (!feof(rev1File)) { fgets(lineContent, 256, rev1File); if(revisionPtr = strstr(lineContent, tokenToFind)) { revisionPtr = revisionPtr + strlen(tokenToFind); auxPtr = strchr(revisionPtr, '/'); auxPtr[0] = 0; strcpy(rev1, revisionPtr); break; } } fclose(rev1File); } // //get the revision information from ".svn\dir-wcprops" file // FILE* rev1File = NULL; // char rev1FilePath[50]; // strcpy(rev1FilePath, ".svn\\dir-wcprops"); // if((rev1File = fopen(rev1FilePath, "r")) != NULL) // { // char *revisionPtr, *auxPtr; // // strcpy(tokenToFind, "/!svn/ver/"); // // while (!feof(rev1File)) // { // fgets(lineContent, 256, rev1File); // // if(revisionPtr = strstr(lineContent, tokenToFind)) // { // revisionPtr = revisionPtr + strlen(tokenToFind); // auxPtr = strchr(revisionPtr, '/'); // auxPtr[0] = 0; // // strcpy(rev1, revisionPtr); // // break; // } // } // // fclose(rev1File); // } if(rev1) { strcpy(aRevision, rev1); cout << "Revision number obtained! Current revision: " << aRevision << endl; retVal = true; } else { cout << "Could not obtain revision number! Check your .svn folder!" << endl; retVal = false; } return retVal; }