Update version number

This commit is contained in:
zilmar 2021-04-25 20:18:30 +09:30
parent a0d6da6ad9
commit 11813ff5f2
11 changed files with 205 additions and 64 deletions

View File

@ -5,11 +5,11 @@
AppId={{BEB5FB69-4080-466F-96C4-F15DF271718B}
AppName=Project64
AppVersion={#AppVersion}
DefaultDirName={pf32}\Project64 2.3
DefaultDirName={pf32}\Project64 Dev 3.0
VersionInfoVersion={#AppVersion}
OutputDir={#BaseDir}\Bin\{#Configuration}
OutputBaseFilename=Setup Project64 2.3
VersionInfoDescription=Installation Setup of Project64 2.3
OutputBaseFilename=Setup Project64 Dev 3.0
VersionInfoDescription=Installation Setup of Project64 Dev 3.0
Compression=lzma2/ultra64
WizardImageFile=Installer-Sidebar.bmp
WizardSmallImageFile=Pj64LogoSmallImage.bmp

View File

@ -1,15 +1,20 @@
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#define VERSION_MAJOR 1
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 1
#define VERSION_REVISION 0
#define VERSION_BUILD 9999
#define GIT_VERSION ""
#define VERSION_PREFIX "Dev-"
#define GIT_REVISION ""
#define GIT_REVISION_SHORT ""
#define GIT_DIRTY ""
#define GIT_VERSION "Unknown"
#define VER_FILE_DESCRIPTION_STR "Project64-audio"
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
#define VER_FILE_VERSION_STR VERSION_PREFIX STRINGIZE(VERSION_MAJOR) \
"." STRINGIZE(VERSION_MINOR) \
"." STRINGIZE(VERSION_REVISION) \
"." STRINGIZE(VERSION_BUILD) \

View File

@ -247,4 +247,7 @@
<Project>{1968162c-0793-491d-91a1-81645a24d399}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Version.h.in" />
</ItemGroup>
</Project>

View File

@ -348,6 +348,9 @@
<ClCompile Include="N64System\Enhancement\EnhancementList.cpp">
<Filter>Source Files\N64 System\Enhancement</Filter>
</ClCompile>
<ClCompile Include="N64System\N64Rom.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@ -669,4 +672,9 @@
<Filter>Header Files\N64 System\Enhancement</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Version.h.in">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,21 +1,20 @@
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#ifdef ANDROID
#define VERSION_MAJOR 2
#define VERSION_MINOR 3
#define VERSION_REVISION 3
#else
#define VERSION_MAJOR 2
#define VERSION_MINOR 4
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 0
#endif
#define VERSION_BUILD 9999
#define GIT_VERSION ""
#define VERSION_PREFIX "Dev-"
#define GIT_REVISION ""
#define GIT_REVISION_SHORT ""
#define GIT_DIRTY ""
#define GIT_VERSION "Unknown"
#define VER_FILE_DESCRIPTION_STR "Project64"
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
#define VER_FILE_VERSION_STR VERSION_PREFIX STRINGIZE(VERSION_MAJOR) \
"." STRINGIZE(VERSION_MINOR) \
"." STRINGIZE(VERSION_REVISION) \
"." STRINGIZE(VERSION_BUILD) \

View File

@ -1,15 +1,20 @@
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#define VERSION_MAJOR 1
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 0
#define VERSION_BUILD 9999
#define GIT_VERSION ""
#define VERSION_PREFIX "Dev-"
#define GIT_REVISION ""
#define GIT_REVISION_SHORT ""
#define GIT_DIRTY ""
#define GIT_VERSION "Unknown"
#define VER_FILE_DESCRIPTION_STR "Project64-input"
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
#define VER_FILE_VERSION_STR VERSION_PREFIX STRINGIZE(VERSION_MAJOR) \
"." STRINGIZE(VERSION_MINOR) \
"." STRINGIZE(VERSION_REVISION) \
"." STRINGIZE(VERSION_BUILD) \

View File

@ -1,15 +1,20 @@
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#define VERSION_MAJOR 2
#define VERSION_MINOR 2
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 0
#define VERSION_BUILD 9999
#define GIT_VERSION ""
#define VERSION_PREFIX "Dev-"
#define GIT_REVISION ""
#define GIT_REVISION_SHORT ""
#define GIT_DIRTY ""
#define GIT_VERSION "Unknown"
#define VER_FILE_DESCRIPTION_STR "Project64-video"
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
#define VER_FILE_VERSION_STR VERSION_PREFIX STRINGIZE(VERSION_MAJOR) \
"." STRINGIZE(VERSION_MINOR) \
"." STRINGIZE(VERSION_REVISION) \
"." STRINGIZE(VERSION_BUILD) \

View File

@ -1,21 +1,26 @@
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#define VERSION_MAJOR 1
#define VERSION_MINOR 7
#define VERSION_REVISION 4
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 0
#define VERSION_BUILD 9999
#define GIT_VERSION ""
#define VERSION_PREFIX "Dev-"
#define VER_FILE_DESCRIPTION_STR "RSP emulation plugin"
#define GIT_REVISION ""
#define GIT_REVISION_SHORT ""
#define GIT_DIRTY ""
#define GIT_VERSION "Unknown"
#define VER_FILE_DESCRIPTION_STR "Project64-RSP"
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
#define VER_FILE_VERSION_STR VERSION_PREFIX STRINGIZE(VERSION_MAJOR) \
"." STRINGIZE(VERSION_MINOR) \
"." STRINGIZE(VERSION_REVISION) \
"." STRINGIZE(VERSION_BUILD) \
"-" GIT_VERSION
#define VER_PRODUCTNAME_STR "RSP"
#define VER_PRODUCTNAME_STR "Project64-RSP"
#define VER_PRODUCT_VERSION VER_FILE_VERSION
#define VER_PRODUCT_VERSION_STR VER_FILE_VERSION_STR
#define VER_ORIGINAL_FILENAME_STR VER_PRODUCTNAME_STR ".dll"

View File

@ -6,24 +6,21 @@ cd /d %~dp0..\..
set base_dir=%cd%
cd /d %origdir%
for /f %%i in ('git describe --tags --long') do set GIT_DESCRIBE=%%i > nul
for /f %%i in ('git rev-parse --short HEAD') do set GIT_REVISION_SHORT=%%i > nul
for /f %%i in ('git rev-list --count HEAD') do set GIT_BUILD_VERSION=%%i > nul
for /F "tokens=1,2,3 delims=-" %%i in ("%GIT_DESCRIBE%") do call :process_git_desc %%i %%j %%k
for /F "tokens=1,2,3" %%i in (%base_dir%\Source\Project64-core\version.h.in) do call :process_version %%i %%j %%k
set VERSION=v%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%-%VERSION_BUILD%-%VERSION_COMMIT%
set GIT_REVISION_SHORT=%GIT_REVISION_SHORT: =%
set GIT_BUILD_VERSION=%GIT_BUILD_VERSION: =%
set VERSION=%VERSION_PREFIX%%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%-%GIT_BUILD_VERSION%-%GIT_REVISION_SHORT%
echo %VERSION%
echo GIT_DESCRIBE = %VERSION% > "%base_dir%\git.properties"
goto :EOF
:process_git_desc
set VERSION_BUILD=%2
set VERSION_COMMIT=%3
goto :EOF
:process_version
if "%1" == "#define" if "%2" == "VERSION_MAJOR" set VERSION_MAJOR=%3
if "%1" == "#define" if "%2" == "VERSION_MINOR" set VERSION_MINOR=%3
if "%1" == "#define" if "%2" == "VERSION_REVISION" set VERSION_REVISION=%3
if "%1" == "#define" if "%2" == "VERSION_PREFIX" set VERSION_PREFIX=%~3
goto :EOF

View File

@ -4,6 +4,111 @@
#include <Common/File.h>
#include <Common/StdString.h>
bool GitCommand(CPath & SourceDirectory, const char * Command, std::string & Output)
{
CPath CurrentDir(CPath::CURRENT_DIRECTORY);
if (CurrentDir != SourceDirectory)
{
SourceDirectory.ChangeDirectory();
}
Output.clear();
FILE * pipe = _popen(stdstr_f("git %s", Command).c_str(), "r");
if (pipe == nullptr)
{
if (CurrentDir != SourceDirectory)
{
CurrentDir.ChangeDirectory();
}
return false;
}
char buffer[128];
while (!feof(pipe))
{
// use buffer to read and add to result
if (fgets(buffer, 128, pipe) != NULL)
{
Output += buffer;
}
}
if (CurrentDir != SourceDirectory)
{
CurrentDir.ChangeDirectory();
}
if (feof(pipe))
{
_pclose(pipe);
return true;
}
return false;
}
uint32_t GitBuildVersion(CPath & SourceDirectory)
{
enum
{
DefaultBuildVersion = 9999
};
std::string Result;
if (!GitCommand(SourceDirectory, "rev-list --count HEAD", Result))
{
return DefaultBuildVersion;
}
if (Result.empty())
{
return DefaultBuildVersion;
}
uint32_t BuildVersion = atoi(Result.c_str());
if (BuildVersion != 0)
{
return BuildVersion;
}
return 9999;
}
bool GitBuildDirty(CPath & SourceDirectory)
{
std::string Result;
if (!GitCommand(SourceDirectory, "diff --stat", Result))
{
return false;
}
return !Result.empty();
}
std::string GitRevision(CPath & SourceDirectory)
{
stdstr Result;
if (!GitCommand(SourceDirectory, "rev-parse HEAD", Result))
{
return "";
}
Result.Replace("\r", "");
strvector ResultVector = Result.Tokenize("\n");
if (ResultVector.size() > 0)
{
return ResultVector[0];
}
return "";
}
std::string GitRevisionShort(CPath & SourceDirectory)
{
stdstr Result;
if (!GitCommand(SourceDirectory, "rev-parse --short HEAD", Result))
{
return "";
}
Result.Replace("\r", "");
strvector ResultVector = Result.Tokenize("\n");
if (ResultVector.size() > 0)
{
return ResultVector[0];
}
return "";
}
int main()
{
if (__argc < 4)
@ -25,6 +130,12 @@ int main()
}
}
CPath SourceDirectory(SourceFile.GetDriveDirectory(), "");
uint32_t VersionBuild = GitBuildVersion(SourceDirectory);
bool BuildDirty = GitBuildDirty(SourceDirectory);
std::string Revision = GitRevision(SourceDirectory);
std::string RevisionShort = GitRevisionShort(SourceDirectory);
CFile InFile(SourceFile, CFileBase::modeRead);
if (!InFile.IsOpen())
{
@ -36,16 +147,6 @@ int main()
InFile.Read(InputData.get(), FileLen);
strvector VersionData = stdstr(std::string((char *)InputData.get(), FileLen)).Tokenize("\n");
strvector verinfo = stdstr(__argv[3]).Tokenize('-');
if (verinfo.size() < 3 || verinfo.size() > 4)
{
return 0;
}
if (verinfo.size() == 4)
{
verinfo[2] += "-" + verinfo[3];
}
CFile OutFile(DestFile, CFileBase::modeWrite | CFileBase::modeCreate);
if (!OutFile.IsOpen())
{
@ -56,13 +157,25 @@ int main()
{
stdstr &line = VersionData[i];
line += "\n";
if (_strnicmp(line.c_str(), "#define VERSION_BUILD", 21) == 0)
if (_strnicmp(line.c_str(), "#define GIT_VERSION ", 20) == 0)
{
line = "#define VERSION_BUILD " + verinfo[1] + "\n";
line.Format("#define GIT_VERSION \"%s%s%s\"\n", RevisionShort.c_str(), BuildDirty ? "-" : "", BuildDirty ? "Dirty" : "");
}
if (_strnicmp(line.c_str(), "#define GIT_VERSION", 18) == 0)
else if (_strnicmp(line.c_str(), "#define VERSION_BUILD", 21) == 0)
{
line = "#define GIT_VERSION \"" + verinfo[2] + "\"\n";
line.Format("#define VERSION_BUILD %d\n", VersionBuild);
}
else if (_strnicmp(line.c_str(), "#define GIT_REVISION ", 21) == 0)
{
line.Format("#define GIT_REVISION \"%s\"\n", Revision.c_str());
}
else if (_strnicmp(line.c_str(), "#define GIT_REVISION_SHORT ", 26) == 0)
{
line.Format("#define GIT_REVISION_SHORT \"%s\"\n", RevisionShort.c_str());
}
else if (_strnicmp(line.c_str(), "#define GIT_DIRTY ", 11) == 0)
{
line.Format("#define GIT_DIRTY \"%s\"\n", BuildDirty ? "Dirty" : "");
}
if (!OutFile.Write(line.c_str(), (uint32_t)line.length()))
{

View File

@ -23,19 +23,20 @@
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#define VERSION_MAJOR 2
#define VERSION_MINOR 5
#define VERSION_REVISION 3
#ifndef VERSION_BUILD
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 0
#define VERSION_BUILD 9999
#endif
#ifndef GIT_VERSION
#define GIT_VERSION ""
#endif
#define VERSION_PREFIX "Dev-"
#define GIT_REVISION ""
#define GIT_REVISION_SHORT ""
#define GIT_DIRTY ""
#define GIT_VERSION "Unknown"
#define VER_FILE_DESCRIPTION_STR "N-Rage for Project64"
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
#define VER_FILE_VERSION_STR VERSION_PREFIX STRINGIZE(VERSION_MAJOR) \
"." STRINGIZE(VERSION_MINOR) \
"." STRINGIZE(VERSION_REVISION) \
"." STRINGIZE(VERSION_BUILD) \
@ -46,7 +47,7 @@
#define VER_PRODUCT_VERSION_STR VER_FILE_VERSION_STR
#define VER_ORIGINAL_FILENAME_STR VER_PRODUCTNAME_STR ".dll"
#define VER_INTERNAL_NAME_STR VER_PRODUCTNAME_STR
#define VER_COPYRIGHT_STR "Copyright (C) 2017"
#define VER_COPYRIGHT_STR "Copyright (C) 2021"
#ifdef _DEBUG
#define VER_VER_DEBUG VS_FF_DEBUG