Android Tutorial Add a Change log as well as Build number to projects

A few weeks ago I posted a thread on a build number implementation for your project in this thread

http://www.b4x.com/android/forum/th...-your-projects-compilation.32823/#post-191560

Please read the above thread before trying to understand the following additions.

I have now extended this to having a changelog file (history file of changes made) as well. Most developers want to keep track of what has changed between versions/builds and perhaps allow user to view changelog.

My script has been extended as below

var fst, f, fileCount;
var ForReading = 1, ForWriting = 2, ForAppending =8;
var filebuild = "D:\\Software development ANDROID\\bzPlayer\\Files\\mybuild.txt";
var filechangelog = "D:\\Software development ANDROID\\bzPlayer\\Files\\mychangelog.txt";
var command ="Notepad.exe D:\\Software development ANDROID\\bzPlayer\\Files\\mychangelog.txt";
var wshell = WScript.CreateObject("wscript.Shell")
var myresult, myok=1;
var mylog
var mycrlf="\n\r"

fst = new ActiveXObject("Scripting.FileSystemObject");

//create file if its not found
if (! fso.FileExists(filebuild))
{
f = fst.openTextFile(filebuild, ForWriting, true);
f.Write("0");
f.Close();
}

f = fst.openTextFile(filebuild, ForReading);
fileCount = parseInt(f.ReadAll());

//make sure the input is a whole number
if (isNaN(fileCount))
{
fileCount = 0;
}

fileCount = fileCount + 1;

f = fst.oenTextFile(filebuild, ForWriting, true);
f.Write(fileCount);
f.Close();

myresult= wshell.Popup("Do you wish to update CHANGE LOG", 3, "Program Change log", 65);

if (myresult == myok)
{
if (! fso.FileExists(filechangelog))
{
f = fst.openTextFile(filechangelog, ForWriting, true);
f.Write(" Build " + fileCount);
f.Close();
}
else
{
f = fst.openTextFile(filechangelog, ForAppending, true);
f.Write(mycrlf + mycrlf + " Build " + fileCount + mycrlf + mycrlf );
f.write("================================================= " + mycrlf + mycrlf);
f.Close();
}

wshell.run (command);
WScript.Sleep(100);
wshell.AppActivate("Notepad");
WScript.Sleep(100);
wshell.SendKeys("^{END}");
}

A small popup window occurs when you start compilation of your project and allows user access to a Notepad type text file to edit a changelog. If user waits 3 seconds the dialog disappears and program execution occurs. (so be fast to click if you want to enter some information... )

The Changelog can be any format the user wants but I use a simple layout as shown below

Build 148
=================================================
First public release of myProgram

Build 171
=================================================
- fixed bug with GUI and small screens
- fixed big with divide by zero
- fixed bug with user input

Build 192
=================================================
- added better screen size choices
- added user buttons for settings

- fixed bug with making coffee


The Notepad window automatically goes to end of file where the script has added a couple of lines with the current build number and then a separator line of "=" signs.

Obviously by changing the script file you could even start a full Word processor or whatever and have a more sophisticated changelog.
 

Mike Maurice

Member
Licensed User
Longtime User
An alternative to your scheme is the git version system that I built and have just added a build number option to.

At: http://www.b4x.com/android/forum/th...ing-tags-commits-and-hash-info.27572/#content

I won't try to compare your solution except a simple summary. Your solution now has a changelog, which Git in effect provides. If someone is not using Git then your changelog is a definite advantage as the solution I built expects Git to provide that. On the other hand if someone doesn't need or want a changelog and is not using Git then my solution may be simpler to implement. I don't consider these solutions to be in competition; each has it's advantages and disadvantages. I only think of one useful comment: that both of these solutions are in effect shiny KLUGES to fix shortcomings in B4A. Consider this a hint. Hint.
 

blong

Active Member
Licensed User
Longtime User
Mike... good stuff. I concur that having a "built in" version number and changelog should be part of some future (next week hehe) B4A release...
Hint ++
 
Top