Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Auto. version incrementation on building

Auto. version incrementation on building
Thread Tools
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 15, 2002, 01:01 AM
 
Hi,

Maybe this question is very easy to answer, but I have not found it nor in the docs, nor with google...

How can I have Project Builder to auto-increment a project version when building ?
Have I to make a script that edit the plist file, or is there an easy way to do it in Project Builder ?

I think this is a basic feature...

Thanks
Imagine that my signature is here...
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
May 15, 2002, 09:41 PM
 
Bump.

I as well would like to accomplish this.
3R1C
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 16, 2002, 12:18 AM
 
I am sure there is an easy way to implement this.

Apple Mac OS X build versions must be auto-incremented (the last number increments by one each build).

Omni uses that with their product (the version in parenthesis).

So, is there a developer on this forum that knows the best way to do this ?

Am I forced to execute a custom shell script to edit the Info.plist file and the build version ?
Imagine that my signature is here...
     
Mac Elite
Join Date: Feb 2001
Location: Bristol, UK, living in Melbourne, Australia
Status: Offline
Reply With Quote
May 16, 2002, 01:52 AM
 
i would recommend using CVS, (concurrent versioning system?) which enables you to roll back to different versions etc. and other neat features. combine it with some of the scripts available (ViewCVS) which produces html pages with diffs etc. and you have a very nice versioning system.

The only problem with CVS is that it's not mega obvious or mac-like. If you need help with CVS there are lots of people here that can help as it is pretty universal in the dev world. Once you have it running it is very easy to use though. Installation is the only slightly tricky part.
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
May 16, 2002, 04:03 AM
 
Uh. I don't think he (myself at least) is talking about versioning like in CVS, but rather having the .plist update the version in parenthesis everytime you press the build button.

like this

myApp v 1.0 (v925)

where (v925) is how many time the user has pressed the build button in PB.
3R1C
     
Mac Elite
Join Date: Feb 2001
Location: Bristol, UK, living in Melbourne, Australia
Status: Offline
Reply With Quote
May 16, 2002, 05:41 AM
 
Originally posted by 3R1C:
<STRONG>Uh. I don't think he (myself at least) is talking about versioning like in CVS, but rather having the .plist update the version in parenthesis everytime you press the build button.

like this

myApp v 1.0 (v925)

where (v925) is how many time the user has pressed the build button in PB.</STRONG>
oh yeah! my mistake
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 16, 2002, 11:48 AM
 
That's it !

I do not want to have a versoning system, but like he said, press build and version auto-increase...

But since nobody has answered yet, it seems that it is not a so easy and common thing...

Then I will make a shell script that will execute at each builds...

I will send feedback to Apple about this. It ould be great if it could be implemented.
Imagine that my signature is here...
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
May 16, 2002, 02:06 PM
 
When your script is done, will you hook me up with it? how will the script be executed when the user presses build?
3R1C
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
May 16, 2002, 03:22 PM
 
See the stuff about the Apple Generic Versioning system in the Project Builder release notes...
Rick Roe
icons.cx | weblog
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 16, 2002, 07:19 PM
 
Originally posted by Rickster:
<STRONG>See the stuff about the Apple Generic Versioning system in the Project Builder release notes...</STRONG>
You speak about the VERSIONING-SYSTEM build setting ?
I have read that, but I thinked it was for versioning like CVS, to control changes made, etc...

But since you are who you are, you must be true, and I will play with that option to see how it works.

Thx...
Imagine that my signature is here...
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 16, 2002, 08:16 PM
 
1) _______________ TO RICK _________________

If I have well undertood this, it means that :
With those build settings :
  • CURRENT_PROJECT_VERSION = 3.2
  • PRODUCT_NAME = MyApp
  • VERSIONING_SYSTEM = apple-generic
I will get those two global variables in my App :
  • const unsigned char MyAppVersionString[] = "@(#)PROGRAM:MyApp PROJECT: MyApp-3.2 DEVELOPER:me BUILT:" __DATE__ " " __TIME__ "\n";
  • const double MyAppVersionNumber = (double)3.2;
BUT
  • CFBundleVersion will not be affected by CURRENT_PROJECT_VERSION, and these two can be different
  • CURRENT_PROJECT_VERSION is not incrementing on each build...

Is this that you are using for Omni products ? is the (v399) OmniWeb based on a variable called OmniWebVersionNumber that is created by VERSIONING_SYSTEM = apple-generic ?

2) _______________ To 3R1C _________________
You can execute a script when building.
See <font color = blue>"Running a Script While Building"</font> in the developer help center...

[ 05-16-2002: Message edited by: hELLO wORLD ]
Imagine that my signature is here...
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 16, 2002, 08:29 PM
 
2x post...

[ 05-16-2002: Message edited by: hELLO wORLD ]
Imagine that my signature is here...
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
May 16, 2002, 09:02 PM
 
Actually, we're still investigating adding AGV to our build system here at Omni. And no, it alone doesn't increment CFBUndleVersion every time you make a build. I think you'll need <font face = "courier">agvtool</font> and/or a shell script build phase for that.
Rick Roe
icons.cx | weblog
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 16, 2002, 09:31 PM
 
Originally posted by Rickster:
<STRONG>Actually, we're still investigating adding AGV to our build system here at Omni. And no, it alone doesn't increment CFBUndleVersion every time you make a build. I think you'll need &lt;font face = "courier"&gt;agvtool&lt;/font&gt; and/or a shell script build phase for that.</STRONG>
Excellent !!

Thank you ! I have not noticed this utility "agvtool", but here is the solution.

3R1C, just go to the terminal, and type : /Developer/Tools/agvtool help
Here is an extract of the output :
The CURRENT_PROJECT_VERSION and the DYLIB_CURRENT_VERSION will
be updated. The -all option will cause agvtool to also update
the CFBundleVersion Info.plist key
Then, you just have to execute agvtool while building.

Thx again
Imagine that my signature is here...
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 16, 2002, 11:13 PM
 
Hi there,

I have been able to do something that is working. The bad thing is that the version number is not updating live in Project Builder, but if I quit and relaunch the project, I can see it worked. The thing must be perfectionned to use a relative link, instead of absolute. I have to change the directory because during the build phase, we are in /build/PROJECT.build, and I have to be in the folder containing the .lproj folder.

Here are the parameters :
In the "Build Settings" field :
CURRENT_PROJECT_VERSION = 13 (what you want, it will increase by 1 each build)
VERSIONING_SYSTEM = apple-generic

In the "Build Phases/Shell Script Files" (put the shell phase at the top)
The two following lines go to the Script field.
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
cd /Users/me/Desktop/MyApp/
/Developer/Tools/agvtool next-version -all
</font>[/code]

So the next phase is to use relative links and have PB update changes...
Imagine that my signature is here...
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
May 17, 2002, 01:02 AM
 
Then, you just have to execute agvtool while building.
how do i run agvtool while building?

In the "Build Phases/Shell Script Files" (put the shell phase at the top)
The two following lines go to the Script field.

code:
------------------------------------------------------------------------


cd /Users/me/Desktop/MyApp/
/Developer/Tools/agvtool next-version -all
I dont see "Build Phases/Shell Script Files" I see nothing in any tab about shell scripts.

I really wnt to know how to do this. Could you please give me step by step instructions?
3R1C
     
Fresh-Faced Recruit
Join Date: May 2002
Status: Offline
Reply With Quote
May 22, 2002, 06:01 PM
 
Here's a step by step.

0) In the Targets pane, click on your build target - MyApp
1) Click on the Build Settings tab and scroll to the bottom.
2) Add two entries to the Build Settings section with the following names and values;
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>CURRENT_PROJECT_VERSION = <font color = blue>23</font>
VERSIONING_SYSTEM = apple-generic
</font>[/code]
3) Click on the Files & Build Phases tab and click on the Headers section to activate the tab.
4) In the project menu, choose New Build Phase -&gt; New Shell Script Build Phase.
5) Enter to following in to the Script: field;
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>cd /Users/me/Desktop/MyApp/
/Developer/Tools/agvtool next-version -all
</font>[/code]
When you run your app, CURRENT_PROJECT_VERSION will be displayed in MyApp -&gt; About MyApp.

hELLO wORLD: When you switch back to PB and you get the message that the project was changed externally, choose Revert and CURRENT_PROJECT_VERSION will be updated in Build Settings.
Love,
The Surfer
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 23, 2002, 10:34 PM
 
That's it serversurfer (and thanks for the "revert" tip). Sorry 31RC to have not been enough specific.
Imagine that my signature is here...
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
May 24, 2002, 01:28 AM
 
Its no ones fault but my own. Im kinda 'slow'
3R1C
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 24, 2002, 03:25 AM
 
Hi there,

The "revert thing" maybe works, but... Project Builder crashes, so it us not very useful.

I have the choice between :
- close messages saying the doc was modified externaly every 30 seconds
- close the project and reopen it (well...)
- click "revert" and crash...

This is not the ideal yet.
We have a great base there for auto-incrementation, but we need to develop the method.

I am using April beta developer tools, so this may be the problem. Any feedback from people trying this ? Please post dev tools version and results. Thx.


To anyone on this forum, if you want to submit your comments, ideas or something on this, then, we are ready to listen to you, and are interested in your ideas or suggestions.

P.S. :
Apple has its own build scheme with surely some auto-incrementation (on build) : 1A1, 1A2 1A3, 1A(n+1) etc...
Omni uses its own auto-incrementation system : (v1), (v2), (v3), (vn+1)
I've seen other apps or compiled stuff using such schemes (like GPGMail bundle)

So there is surely someone somewhere that have a working solution for that.
Imagine that my signature is here...
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
May 24, 2002, 04:52 AM
 
I get no crash on revert. Thanx to all of you it works flawlessly here. I am not using april devTools.
3R1C
     
Fresh-Faced Recruit
Join Date: May 2002
Status: Offline
Reply With Quote
May 25, 2002, 03:19 AM
 
Originally posted by hELLO wORLD:
P.S. :
Apple has its own build scheme with surely some auto-incrementation (on build) : 1A1, 1A2 1A3, 1A(n+1) etc...
Omni uses its own auto-incrementation system : (v1), (v2), (v3), (vn+1)
I've seen other apps or compiled stuff using such schemes (like GPGMail bundle)

So there is surely someone somewhere that have a working solution for that.[/QB]
Use this in your about box for Omni style:
&lt;BLOCKQUOTE&gt;&lt;font size="1"face="Geneva, Verdana, Arial"&gt;code:&lt;/font&gt;&lt;HR&gt;&lt;pre&gt;& amp;lt;font size=1 face=courier&gt; buildNumber = [infoDictionary objectForKey:&lt;font color = orange&gt;@"CFBundleVersion"&lt;/font&gt;];
CFBundleShortVersionString = [infoDictionary objectForKey:&lt;font color = orange&gt;@"CFBundleShortVersionString"&lt ;/font&gt;];
[versionField setStringValue:[NSString stringWithFormat:&lt;font color = orange&gt;@"Version %@ (v%@)"&lt;/font&gt;, CFBundleShortVersionString, buildNumber]];&lt;/font&gt;&lt;/pre&gt;&lt;HR&gt;&lt;/BLOCKQUOTE&gt;
Apple style:
&lt;BLOCKQUOTE&gt;&lt;font size="1"face="Geneva, Verdana, Arial"&gt;code:&lt;/font&gt;&lt;HR&gt;&lt;pre&gt;& amp;lt;font size=1 face=courier&gt; [versionField setStringValue:[NSString stringWithFormat:&lt;font color = orange&gt;@"%@%@"&lt;/font&gt;, CFBundleShortVersionString, buildNumber]];&lt;/font&gt;&lt;/pre&gt;&lt;HR&gt;&lt;/BLOCKQUOTE&gt;
Note: I don't know that Omni's 'v' goes up every build. if it does, it must reset or something at some point. OmniWeb 4.1b7 is a respectable v410, but OmniGraffle 2.0.4 and OmniOutliner 1.2 are only v20 and v10, respectively. I can build that many times tracking a single bug.
Maybe they work on the components separately, and the 'v' represents the number of times they tried to "bring it all together"?

Edit: Geez. Never mind. Good luck editing code posts in this forum. I guess it's pretty if you get it right the first time though.

[ 05-25-2002: Message edited by: serversurfer ]
Love,
The Surfer
     
Fresh-Faced Recruit
Join Date: May 2002
Status: Offline
Reply With Quote
May 25, 2002, 03:25 AM
 
Originally posted by hELLO wORLD:
P.S. :
Apple has its own build scheme with surely some auto-incrementation (on build) : 1A1, 1A2 1A3, 1A(n+1) etc...
Omni uses its own auto-incrementation system : (v1), (v2), (v3), (vn+1)
I've seen other apps or compiled stuff using such schemes (like GPGMail bundle)

So there is surely someone somewhere that have a working solution for that.[/QB]
Use this in your about box for Omni style:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier> buildNumber = [infoDictionary objectForKey:<font color = orange>@"CFBundleVersion"</font>];
CFBundleShortVersionString = [infoDictionary objectForKey:<font color = orange>@"CFBundleShortVersionString"</font>];
[versionField setStringValue:[NSString stringWithFormat:<font color = orange>@"Version %@ (v%@)"</font>, CFBundleShortVersionString, buildNumber]];</font>[/code]
Apple style:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier> [versionField setStringValue:[NSString stringWithFormat:<font color = orange>@"%@%@"</font>, CFBundleShortVersionString, buildNumber]];</font>[/code]
Note: I don't know that Omni's 'v' goes up every build. if it does, it must reset or something at some point. OmniWeb 4.1b7 is a respectable v410, but OmniGraffle 2.0.4 and OmniOutliner 1.2 are only v20 and v10, respectively. I can build that many times tracking a single bug.
Maybe they work on the components separately, and the 'v' represents the number of times they tried to "bring it all together"?
Love,
The Surfer
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
May 27, 2002, 01:01 PM
 
Perhaps you could make it increase every time you build a deployment build?
     
Fresh-Faced Recruit
Join Date: May 2002
Status: Offline
Reply With Quote
May 27, 2002, 05:09 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Angus_D:
<strong>Perhaps you could make it increase every time you build a deployment build? </strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">As a matter of fact, there is an checkbox for "only run script when building for install" in the 'Script:' field of the Files & Build Phases tab. I just started using it.
Love,
The Surfer
     
Forum Regular
Join Date: Mar 2001
Status: Offline
Reply With Quote
May 27, 2002, 11:27 PM
 
Hi there,

Some fresh news on this topic :

1) my crashing problems comes from the april beta dev tools, and it is a known bug that Apple is working on.

2) an apple PB developer told me that this feature is a good suggestion, so they may implement it built-in into PB.

P.S. : the feedback for beta dev tools is really efficient, and Apple is hearing developers that have bug reports and good suggestions.
However, please, do not abuse of their time and send them feedback, bug or suggestion only when you think it is serious enough
Imagine that my signature is here...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:59 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2