Auto increment version?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 64
- Joined: Fri Apr 26, 2013 8:38 am
Auto increment version?
How do I auto-increment the version that's on the Standalone Application Settings window every time I compile? I want to automate this instead of having to change the version number for each platform whenever I compile a new build.
Learning LiveCode, one step at a time.
Re: Auto increment version?
You don't..

-
- Posts: 64
- Joined: Fri Apr 26, 2013 8:38 am
Re: Auto increment version?
...unless you're sneaky. 
LiveCode stores the standalone version(s) in a custom property set that is normally hidden unless you turn on "LiveCode UI elements in lists" in the View menu. Then you can see the property sets that LiveCode uses to build the standalone. In the set named "cRevStandalonesettings" you will see the properties for each OS and its version entries. You can change those.
The standalone builder sends a "savingStandalone" message before the build actually begins. You can trap that, set those properties, and then the new build will have those versions. For example, it could set the cRevStandaloneSettings["OSX,shortversion"] to "1.1.0".
Now, the glitch with this method is that the standalone will have that new version but the entry is not permanently saved in the source stack, so unless you keep track of the version somewhere else, you can't just increment by 1 each time. You could set your own property in the stack, but you'd still need to update it manually. I usually have a little handler I run before building a standalone that sets the version, clears out field content, and does other cleanup before a build. Or the handler could just set the cRevStandaloneSettings version properties directly.

LiveCode stores the standalone version(s) in a custom property set that is normally hidden unless you turn on "LiveCode UI elements in lists" in the View menu. Then you can see the property sets that LiveCode uses to build the standalone. In the set named "cRevStandalonesettings" you will see the properties for each OS and its version entries. You can change those.
The standalone builder sends a "savingStandalone" message before the build actually begins. You can trap that, set those properties, and then the new build will have those versions. For example, it could set the cRevStandaloneSettings["OSX,shortversion"] to "1.1.0".
Now, the glitch with this method is that the standalone will have that new version but the entry is not permanently saved in the source stack, so unless you keep track of the version somewhere else, you can't just increment by 1 each time. You could set your own property in the stack, but you'd still need to update it manually. I usually have a little handler I run before building a standalone that sets the version, clears out field content, and does other cleanup before a build. Or the handler could just set the cRevStandaloneSettings version properties directly.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 64
- Joined: Fri Apr 26, 2013 8:38 am
Re: Auto increment version?
I saw something called save this stack. If I call it on the standaloneSaved handler, does it then keep the new version?jacque wrote:...unless you're sneaky.
LiveCode stores the standalone version(s) in a custom property set that is normally hidden unless you turn on "LiveCode UI elements in lists" in the View menu. Then you can see the property sets that LiveCode uses to build the standalone. In the set named "cRevStandalonesettings" you will see the properties for each OS and its version entries. You can change those.
The standalone builder sends a "savingStandalone" message before the build actually begins. You can trap that, set those properties, and then the new build will have those versions. For example, it could set the cRevStandaloneSettings["OSX,shortversion"] to "1.1.0".
Now, the glitch with this method is that the standalone will have that new version but the entry is not permanently saved in the source stack, so unless you keep track of the version somewhere else, you can't just increment by 1 each time. You could set your own property in the stack, but you'd still need to update it manually. I usually have a little handler I run before building a standalone that sets the version, clears out field content, and does other cleanup before a build. Or the handler could just set the cRevStandaloneSettings version properties directly.
Learning LiveCode, one step at a time.
Re: Auto increment version?
I'm not sure. The docs seem to indicate that the stack has already been closed at that point and the changes are only to the temporary copy that has been re-opened in RAM. I guess trying it is the best way to know. In that situation it's hard to know what "this" stack is.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 36
- Joined: Fri Jan 01, 2010 12:11 am
Re: Auto increment version?
This works nicely for me in version 6.1.2 Put these in your stack script.
I could never get the "savingStandalone" handler to receive a message, but the "standaloneSaved" works just fine. I think there is some smarts applied to when the standaloneSaved is fired. If I did not make a change to the stack, but rebuilt the standalone, I think the message does not fire. That seems fine to me, though. Note the above code uses the last number of the version as the autobuild number. You are free to change the other ones as you see fit. Should be easy enough to add the version numbers for the other OS's as well.
Code: Select all
on standaloneSaved
put the buildVersionNumber of this stack into x
add 1 to x
set the buildVersionNumber of this stack to x
set the cRevStandaloneSettings["Windows,productversion4"] of this stack to x
end standaloneSaved
on saveStackRequest
put the fileVersionNumber of this stack into x
add 1 to x
set the fileVersionNumber of this stack to x
set the cRevStandaloneSettings["Windows,fileversion4"] of this stack to x
end saveStackRequest
-
- Posts: 36
- Joined: Fri Jan 01, 2010 12:11 am
Re: Auto increment version?
In version 6.1.1 this is not perfect. The version number apparently gets saved after the standalone gets built--so it is ready for the next build. But changing the custom property does not set the "dirty" flag on the stack so if you forget to save the stack after the standalone is built, you will not save the updated version number. Only a minor annoyance. Just remember to save your stack AFTER the standalone is built.