Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify and Improve the version format script #1237

Merged
merged 6 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Solutions/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.999.1
3.year.day.1
19 changes: 15 additions & 4 deletions tools/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ function dayNumber() {
return dayOfYear;
}

function yearNumber() {
var thisYear = new Date().getFullYear();
return (thisYear - 2016);
}

var fso = WScript.CreateObject("Scripting.Filesystemobject");

function readAll(filename) {
Expand All @@ -27,6 +32,12 @@ function readAll(filename) {
return result;
}

function updateYearAndDay(versionString){
var updatedVersion = versionString.replace("year", yearNumber());
updatedVersion = updatedVersion.replace("day", dayNumber() );
return updatedVersion;
}

function generateVersionHpp() {

var palTxt = "WIN32";
Expand All @@ -35,8 +46,7 @@ function generateVersionHpp() {
var ver1 = readAll("..\\Solutions\\version.txt");
// Remove end-of-line
ver1 = ver1.replace("\n", "");
// Replace 999 by today's dayNumber for nightly builds
ver1 = ver1.replace("999", dayNumber() );
ver1 = updateYearAndDay(ver1);
// console.log("version.txt => " + ver1 + "\n");
var ver2 = ver1.split(".").join(",");
var arr = ver1.split(".");
Expand Down Expand Up @@ -68,8 +78,9 @@ function generateVersionHpp() {
}

function generateVersionTxt() {
// Read base version and replace '999' with nightly build number
var version = readAll("..\\Solutions\\version.txt").replace("999", dayNumber());
var version = readAll("..\\Solutions\\version.txt")

version = updateYearAndDay(version);

// Create 'out' folder if it doesn't already exist. Otherwise, OpenTextFile below will fail
if (!fso.FolderExists("..\\Solutions\\out")) {
Expand Down
Loading