Auto increment version?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Auto increment version?

Post by CoffeeCone » Mon Apr 29, 2013 10:57 am

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.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Auto increment version?

Post by Dixie » Mon Apr 29, 2013 11:20 am

You don't..:-)

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Re: Auto increment version?

Post by CoffeeCone » Mon Apr 29, 2013 11:26 am

Dixie wrote:You don't..:-)
D:
Learning LiveCode, one step at a time.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Auto increment version?

Post by jacque » Mon Apr 29, 2013 6:07 pm

...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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

Re: Auto increment version?

Post by CoffeeCone » Mon Apr 29, 2013 7:09 pm

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.
I saw something called save this stack. If I call it on the standaloneSaved handler, does it then keep the new version?
Learning LiveCode, one step at a time.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Auto increment version?

Post by jacque » Mon Apr 29, 2013 7:35 pm

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

WinstonJenks
Posts: 36
Joined: Fri Jan 01, 2010 12:11 am

Re: Auto increment version?

Post by WinstonJenks » Mon Nov 11, 2013 8:30 am

This works nicely for me in version 6.1.2 Put these in your stack script.

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
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.

WinstonJenks
Posts: 36
Joined: Fri Jan 01, 2010 12:11 am

Re: Auto increment version?

Post by WinstonJenks » Tue Nov 12, 2013 6:54 am

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.

Post Reply