×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    57

    Can carbide set major, minor and build vesion?

    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

  2. #2
    Nokia Developer Expert
    Join Date
    Dec 2004
    Location
    Austin, TX
    Posts
    399

    Re: Can carbide set major, minor and build vesion?

    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

  3. #3
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    57

    Re: Can carbide set major, minor and build vesion?

    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

  4. #4
    Regular Contributor
    Join Date
    May 2005
    Location
    Brasov, Romania
    Posts
    431

    Re: Can carbide set major, minor and build vesion?

    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;
    }

  5. #5
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    57

    Re: Can carbide set major, minor and build vesion?

    Hi iulian_moldovan,

    Wow! thanks for your efforts. I just saw it. You're the king!

    Imzadi

  6. #6
    Regular Contributor
    Join Date
    May 2005
    Location
    Brasov, Romania
    Posts
    431

    Re: Can carbide set major, minor and build vesion?

    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;
    }

  7. #7
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    57

    Re: Can carbide set major, minor and build vesion?

    Thanks again!

Similar Threads

  1. Set stack and heap size in carbide
    By Skygyl in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2007-03-29, 15:39
  2. Import\Export Project Problem in Carbide
    By mohsin.sohail in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2006-07-17, 20:20
  3. Carbide: How doesn't one set a break on ...?
    By kernj in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 0
    Last Post: 2006-04-24, 20:39
  4. Issues with Carbide vs 2.0 installer!
    By kt10208 in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2006-01-16, 09:27
  5. Replies: 12
    Last Post: 2003-10-28, 06:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×