Skip to content
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
9 changes: 4 additions & 5 deletions lib/include/public/Version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define MAT_VERSION_HPP
// WARNING: DO NOT MODIFY THIS FILE!
// This file has been automatically generated, manual changes will be lost.
#define BUILD_VERSION_STR "3.8.249.1"
#define BUILD_VERSION 3,8,249,1
#define BUILD_VERSION_STR "3.9.22.1"
#define BUILD_VERSION 3,9,22,1

#ifndef RESOURCE_COMPILER_INVOKED
#include "ctmacros.hpp"
Expand All @@ -17,8 +17,8 @@ namespace MAT_NS_BEGIN {

uint64_t const Version =
((uint64_t)3 << 48) |
((uint64_t)8 << 32) |
((uint64_t)249 << 16) |
((uint64_t)9 << 32) |
((uint64_t)22 << 16) |
((uint64_t)1);

} MAT_NS_END
Expand All @@ -27,4 +27,3 @@ namespace PAL_NS_BEGIN { } PAL_NS_END

#endif // RESOURCE_COMPILER_INVOKED
#endif

20 changes: 17 additions & 3 deletions tools/version-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ function dayNumber() {
return dayOfYear;
}

function calculateMinorVersion() {
var baseYear = 2020; // VER_MINOR starts at 4 in 2020
var currentYear = new Date().getFullYear();
return (currentYear - baseYear) + 4; // Increment annually
}

function readAll(filename) {
var contents = fs.readFileSync(filename, 'utf8');
return contents;
Expand All @@ -20,16 +26,21 @@ function fileExists(path) {

function generateVersionHpp() {
var palTxt = "CPP11";
var verMinor = calculateMinorVersion(); // Calculate minor version dynamically
var verPatch = dayNumber(); // Day of the year as the patch version

// Read version tag
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());
// console.log("version.txt => " + ver1 + "\n");
// Replace placeholders in version tag
ver1 = ver1.replace("year", verMinor).replace("day", verPatch);

// Parse version tag into components
var ver2 = ver1.split(".").join(",");
var arr = ver1.split(".");
var versionHpp = "../lib/include/public/Version.hpp";

if (fileExists(versionHpp)) {
var versionHppTxt = readAll(versionHpp);
if (versionHppTxt.search(ver1) != -1) {
Expand All @@ -39,15 +50,18 @@ function generateVersionHpp() {
// Delete and recreate
fs.unlinkSync(versionHpp);
}

var templText = readAll("../lib/include/public/Version.hpp.template");
templText = templText.replace(/\@ull/gi, "@");
templText = templText.replace(/\@BUILD_VERSION_MAJOR\@/g, arr[0]);
templText = templText.replace(/\@BUILD_VERSION_MINOR\@/g, arr[1]);
templText = templText.replace(/\@BUILD_VERSION_PATCH\@/g, arr[2]);
templText = templText.replace(/\@BUILD_NUMBER\@/g, arr[3]);
templText = templText.replace(/\@PAL_IMPLEMENTATION_UPPER\@/g, palTxt);

fs.writeFileSync(versionHpp, templText);
console.log("Version.hpp " + ver1 + " generated (clean build)\n");
}

generateVersionHpp();

Loading