Identify and flag nightly builds. If a new version is released as stable they will be able to recognize that there's a new version available.

This commit is contained in:
Martín Lucas Golini
2024-10-19 17:29:18 -03:00
parent 1914488336
commit b9667b75a3
7 changed files with 60 additions and 36 deletions

View File

@@ -77,6 +77,7 @@ jobs:
bash projects/linux/scripts/install_sdl2.sh
- name: Build ecode
run: |
bash projects/scripts/patch_commit_number.sh
bash projects/linux/ecode/build.app.sh --version ${{ env.INSTALL_REF }} --arch ${{ matrix.config.arch }}
- name: Upload Files
uses: softprops/action-gh-release@v2
@@ -136,6 +137,7 @@ jobs:
bash projects/linux/scripts/install_sdl2.sh --aarch64
- name: Build ecode
run: |
bash projects/scripts/patch_commit_number.sh
bash projects/linux/ecode/build.app.sh --version ${{ env.INSTALL_REF }} --arch ${{ matrix.config.arch }}
- name: Upload Files
uses: softprops/action-gh-release@v2
@@ -189,6 +191,7 @@ jobs:
sudo update-alternatives --config g++
- name: Build ecode
run: |
bash projects/scripts/patch_commit_number.sh
bash projects/mingw32/ecode/build.app.sh --version ${{ env.INSTALL_REF }}
- name: Upload Files
uses: softprops/action-gh-release@v2
@@ -229,6 +232,7 @@ jobs:
brew install bash sdl2 create-dmg premake p7zip
- name: Build
run: |
bash projects/scripts/patch_commit_number.sh
bash projects/macos/ecode/build.app.sh --version ${{ env.INSTALL_REF }}
- name: Create DMG Image
run: |
@@ -276,6 +280,7 @@ jobs:
hdiutil detach /Volumes/SDL2
- name: Build
run: |
bash projects/scripts/patch_commit_number.sh
bash projects/macos/ecode/cross.build.app.sh --version ${{ env.INSTALL_REF }}
- name: Create DMG Image
run: |

View File

@@ -10,14 +10,14 @@
#define EEPP_CODENAME "Siddhi"
/** The compiled version of the library */
#define EEPP_VERSION( x ) \
{ \
( x )->major = EEPP_MAJOR_VERSION; \
( x )->minor = EEPP_MINOR_VERSION; \
( x )->patch = EEPP_PATCH_LEVEL; \
#define EEPP_VERSION( x ) \
{ \
x.major = EEPP_MAJOR_VERSION; \
x.minor = EEPP_MINOR_VERSION; \
x.patch = EEPP_PATCH_LEVEL; \
}
#define EEPP_VERSIONNUM( X, Y, Z ) ( (X)*1000 + (Y)*100 + ( Z ) )
#define EEPP_VERSIONNUM( X, Y, Z ) ( ( X ) * 1000 + ( Y ) * 100 + ( Z ) )
#define EEPP_COMPILEDVERSION \
EEPP_VERSIONNUM( EEPP_MAJOR_VERSION, EEPP_MINOR_VERSION, EEPP_PATCH_LEVEL )

View File

@@ -0,0 +1,13 @@
#!/bin/bash
cd "$(dirname "$0")" || exit
COMMIT_NUMBER=$(git rev-list "$(git tag --sort=-creatordate | grep ecode | sed -n 1p)"..HEAD --count) || exit
FILE_PATH="../../src/tools/ecode/version.hpp"
if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == "freebsd"* ]]; then
sed -i '' "s/#define ECODE_COMMIT_NUMBER [0-9]\+/#define ECODE_COMMIT_NUMBER $COMMIT_NUMBER/" "$FILE_PATH"
else
sed -i "s/#define ECODE_COMMIT_NUMBER [0-9]\+/#define ECODE_COMMIT_NUMBER $COMMIT_NUMBER/" "$FILE_PATH"
fi

View File

@@ -5,7 +5,7 @@ namespace EE {
Version Version::getVersion() {
Version ver;
EEPP_VERSION( &ver );
EEPP_VERSION( ver );
return ver;
}

View File

@@ -1879,7 +1879,7 @@ void LSPClientPlugin::setHoverDelay( const Time& hoverDelay ) {
}
void LSPClientPlugin::onVersionUpgrade( Uint32 oldVersion, Uint32 ) {
if ( oldVersion <= ECODE_VERSIONNUM( 0, 5, 0 ) ) {
if ( oldVersion <= ECODE_VERSIONNUM( 0, 5, 0, 0 ) ) {
mSemanticHighlighting = true;
}
}

View File

@@ -5,35 +5,34 @@ namespace ecode {
Version Version::getVersion() {
Version ver;
ECODE_VERSION( &ver );
ECODE_VERSION( ver );
return ver;
}
Uint32 Version::getVersionNum() {
Uint64 Version::getVersionNum() {
Version ver = getVersion();
return ECODE_VERSIONNUM( ver.major, ver.minor, ver.patch );
return ECODE_VERSIONNUM( ver.major, ver.minor, ver.patch, ver.commit );
}
std::string Version::getVersionNumString() {
Version ver = getVersion();
if ( ver.commit > 0 && ver.commit < 9999 )
return String::format( "%d.%d.%d-%d", ver.major, ver.minor, ver.patch, ver.commit );
return String::format( "%d.%d.%d", ver.major, ver.minor, ver.patch );
}
std::string Version::getVersionFullName() {
Version ver = getVersion();
return String::format( "ecode version %d.%d.%d", ver.major, ver.minor, ver.patch );
}
std::string Version::getTagName() {
Version ver = getVersion();
return String::format( "ecode-%d.%d.%d", ver.major, ver.minor, ver.patch );
if ( ver.commit > 0 && ver.commit < 9999 )
return String::format( "ecode version %s nightly", getVersionNumString() );
return String::format( "ecode version %s", getVersionNumString() );
}
std::string Version::getCodename() {
return std::string( ECODE_CODENAME );
}
Uint32 Version::getVersionNumFromTag( const std::string& tag ) {
Uint64 Version::getVersionNumFromTag( const std::string& tag ) {
auto tagPart = String::split( tag, '-' );
if ( tagPart.size() == 2 ) {
auto versionPart = String::split( tagPart[1], '.' );
@@ -42,7 +41,8 @@ Uint32 Version::getVersionNumFromTag( const std::string& tag ) {
if ( String::fromString( ver.major, versionPart[0] ) &&
String::fromString( ver.minor, versionPart[1] ) &&
String::fromString( ver.patch, versionPart[2] ) ) {
return ECODE_VERSIONNUM( ver.major, ver.minor, ver.patch );
return ECODE_VERSIONNUM( ver.major, ver.minor, ver.patch,
0 /* tags don't count commits */ );
}
}
}

View File

@@ -9,36 +9,45 @@ using namespace EE;
#define ECODE_MAJOR_VERSION 0
#define ECODE_MINOR_VERSION 6
#define ECODE_PATCH_LEVEL 2
/* ECODE_COMMIT_NUMBER 9999 is used for official releases, nightly builds (pre-releases) will
* contain the number of commits after the last official release
*/
#define ECODE_COMMIT_NUMBER 9999
#define ECODE_CODENAME "Prāpti"
/** The compiled version of the library */
#define ECODE_VERSION( x ) \
{ \
( x )->major = ECODE_MAJOR_VERSION; \
( x )->minor = ECODE_MINOR_VERSION; \
( x )->patch = ECODE_PATCH_LEVEL; \
#define ECODE_VERSION( x ) \
{ \
x.major = ECODE_MAJOR_VERSION; \
x.minor = ECODE_MINOR_VERSION; \
x.patch = ECODE_PATCH_LEVEL; \
x.commit = ECODE_COMMIT_NUMBER; \
}
#define ECODE_VERSIONNUM( X, Y, Z ) ( (X)*1000 + (Y)*100 + ( Z ) )
#define ECODE_VERSIONNUM( X, Y, Z, C ) \
( ( X ) * 100000000 + ( Y ) * 1000000 + ( Z ) * 10000 + ( C ) )
#define ECODE_COMPILEDVERSION \
ECODE_VERSIONNUM( ECODE_MAJOR_VERSION, ECODE_MINOR_VERSION, ECODE_PATCH_LEVEL )
#define ECODE_COMPILEDVERSION \
ECODE_VERSIONNUM( ECODE_MAJOR_VERSION, ECODE_MINOR_VERSION, ECODE_PATCH_LEVEL, \
ECODE_COMMIT_NUMBER )
#define ECODE_VERSION_ATLEAST( X, Y, Z ) ( ECODE_COMPILEDVERSION >= ECODE_VERSIONNUM( X, Y, Z ) )
#define ECODE_VERSION_ATLEAST( X, Y, Z, C ) \
( ECODE_COMPILEDVERSION >= ECODE_VERSIONNUM( X, Y, Z, C ) )
namespace ecode {
class Version {
public:
Uint32 major; /**< major version */
Uint32 minor; /**< minor version */
Uint32 patch; /**< update version */
Uint64 major; /**< major version */
Uint64 minor; /**< minor version */
Uint64 patch; /**< update version */
Uint64 commit; /**< commit number, used for nightly builds */
/** @return The linked version of the library */
static Version getVersion();
/** @return The linked version number of the library */
static Uint32 getVersionNum();
static Uint64 getVersionNum();
/** @return The linked version number of the library */
static std::string getVersionNumString();
@@ -46,9 +55,6 @@ class Version {
/** @return The library version name: "ecode version major.minor.patch" */
static std::string getVersionFullName();
/** @return The library release tag name: "ecode-major.minor.patch" */
static std::string getTagName();
/** @return The version codename */
static std::string getCodename();
@@ -57,7 +63,7 @@ class Version {
return std::string( __DATE__ ) + " " + std::string( __TIME__ );
}
static Uint32 getVersionNumFromTag( const std::string& tag );
static Uint64 getVersionNumFromTag( const std::string& tag );
};
} // namespace ecode