[Android] Be able to create version.gradle
This commit is contained in:
parent
e55cec5ea6
commit
b0c5bbe0ae
|
@ -1,6 +1,8 @@
|
|||
# Generated and temporary files
|
||||
assets/project64_data/Config
|
||||
assets/project64_data/Lang
|
||||
config/version.gradle
|
||||
|
||||
# Generated and temporary files
|
||||
bin/
|
||||
gen/
|
||||
obj/
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,13 @@
|
|||
@ECHO OFF
|
||||
SETLOCAL
|
||||
|
||||
set origdir=%cd%
|
||||
cd /d %~dp0..\..\
|
||||
set base_dir=%cd%
|
||||
cd /d %origdir%
|
||||
|
||||
"%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Android\config\version.gradle.in" "%base_dir%\Android\config\version.gradle"
|
||||
|
||||
:End
|
||||
ENDLOCAL
|
||||
exit /B 0
|
|
@ -0,0 +1,15 @@
|
|||
android {
|
||||
buildToolsVersion '30.0.3'
|
||||
compileSdkVersion 30
|
||||
ndkVersion "22.1.7171670"
|
||||
defaultConfig {
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 30
|
||||
VersionMajor = 4
|
||||
VersionMinor = 0
|
||||
VersionRevison = 0
|
||||
VersionPrefix = "Dev"
|
||||
versionCode = 1
|
||||
versionName = "4.0.0 (Unknown)"
|
||||
}
|
||||
}
|
|
@ -153,7 +153,48 @@ int main()
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (size_t i = 0, n = VersionData.size() - 1; i < n; i++)
|
||||
uint32_t VersionMajor = 0, VersionMinor = 0, VersionRevison = 0;
|
||||
std::string VersionPrefix;
|
||||
for (size_t i = 0, n = VersionData.size(); i < n; i++)
|
||||
{
|
||||
stdstr line = VersionData[i];
|
||||
line.Trim();
|
||||
|
||||
if (_strnicmp(line.c_str(), "VersionMajor = ", 13) == 0)
|
||||
{
|
||||
VersionMajor = atoi(&(line.c_str()[14]));
|
||||
}
|
||||
else if (_strnicmp(line.c_str(), "VersionMinor = ", 13) == 0)
|
||||
{
|
||||
VersionMinor = atoi(&(line.c_str()[14]));
|
||||
}
|
||||
else if (_strnicmp(line.c_str(), "VersionRevison = ", 17) == 0)
|
||||
{
|
||||
VersionRevison = atoi(&(line.c_str()[17]));
|
||||
}
|
||||
else if (_strnicmp(line.c_str(), "VersionPrefix = ", 15) == 0)
|
||||
{
|
||||
size_t StartPrefix = line.find("\"", 15);
|
||||
size_t EndPrefix = std::string::npos;
|
||||
if (StartPrefix != std::string::npos)
|
||||
{
|
||||
EndPrefix = line.find("\"", StartPrefix + 1);
|
||||
}
|
||||
if (EndPrefix != std::string::npos)
|
||||
{
|
||||
VersionPrefix = line.substr(StartPrefix + 1, EndPrefix - (StartPrefix + 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
VersionData.erase(VersionData.begin() + i);
|
||||
i -= 1;
|
||||
n -= 1;
|
||||
}
|
||||
|
||||
for (size_t i = 0, n = VersionData.size(); i < n; i++)
|
||||
{
|
||||
stdstr &line = VersionData[i];
|
||||
line += "\n";
|
||||
|
@ -177,6 +218,19 @@ int main()
|
|||
{
|
||||
line.Format("#define GIT_DIRTY \"%s\"\n", BuildDirty ? "Dirty" : "");
|
||||
}
|
||||
else if (_strnicmp(line.c_str(), " versionCode = ", 22) == 0)
|
||||
{
|
||||
line.Format(" versionCode = %d\n", VersionBuild);
|
||||
}
|
||||
else if (_strnicmp(line.c_str(), " versionName = ", 22) == 0)
|
||||
{
|
||||
line.Format(" versionName = \"%d.%d.%d.%d", VersionMajor, VersionMinor, VersionRevison, VersionBuild);
|
||||
if (VersionPrefix.length() > 0)
|
||||
{
|
||||
line += stdstr_f(" (%s)", VersionPrefix.c_str());
|
||||
}
|
||||
line += "\"\n";
|
||||
}
|
||||
if (!OutFile.Write(line.c_str(), (uint32_t)line.length()))
|
||||
{
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue