mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Builders now declares bmGIT_REVCOUNT macro (similar to former SVN_REVISION), now used in ide itself in the about box.
This commit is contained in:
parent
c1a9481037
commit
563ac57aa8
11 changed files with 52 additions and 53 deletions
|
|
@ -19,6 +19,9 @@ CONSOLE_APP_MAIN
|
|||
#ifdef bmSVN_REVISION
|
||||
LOG("Svn revision " << bmSVN_REVISION);
|
||||
#endif
|
||||
#ifdef bmGIT_REVCOUNT
|
||||
LOG("Git revcount " << bmGIT_REVCOUNT);
|
||||
#endif
|
||||
#ifdef bmSVN_URL
|
||||
LOG("Svn url " << bmSVN_URL);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -57,9 +57,11 @@ String SplashCtrl::GenerateVersionNumber()
|
|||
{
|
||||
#ifdef bmSVN_REVISION
|
||||
return bmSVN_REVISION;
|
||||
#else
|
||||
return IDE_VERSION;
|
||||
#endif
|
||||
#ifdef bmGIT_REVCOUNT
|
||||
return AsString(atoi(bmGIT_REVCOUNT) + 2270);
|
||||
#endif
|
||||
return IDE_VERSION;
|
||||
}
|
||||
|
||||
Size SplashCtrl::MakeLogo(Ctrl& parent, Array<Ctrl>& ctrl)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ void PutCompileTime(int time, int count);
|
|||
|
||||
String BrcToC(CParser& binscript, String basedir);
|
||||
|
||||
Vector<String> SvnInfo(const String& package);
|
||||
Vector<String> RepoInfo(const String& package);
|
||||
|
||||
String MakeIdent(const char *name);
|
||||
|
||||
|
|
|
|||
|
|
@ -476,28 +476,12 @@ String CppBuilder::Includes(const char *sep, const String& package, const Packag
|
|||
return cc;
|
||||
}
|
||||
|
||||
bool IsSvnDir2(const String& p)
|
||||
{ // this is a cope of usvn/IsSvnDir to avoid modular issues
|
||||
if(IsNull(p))
|
||||
return false;
|
||||
if(DirectoryExists(AppendFileName(p, ".svn")) || DirectoryExists(AppendFileName(p, "_svn")))
|
||||
return true;
|
||||
String path = p;
|
||||
String path0;
|
||||
while(path != path0) {
|
||||
path0 = path;
|
||||
path = GetFileFolder(path);
|
||||
if(DirectoryExists(AppendFileName(path, ".svn")))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector<String> SvnInfo(const String& package)
|
||||
Vector<String> RepoInfo(const String& package)
|
||||
{
|
||||
Vector<String> info;
|
||||
String d = GetFileFolder(PackagePath(package));
|
||||
if(IsSvnDir2(d)) {
|
||||
int repo = GetRepoKind(d);
|
||||
if(repo == SVN_DIR) {
|
||||
String v = Sys("svnversion " + d);
|
||||
if(IsDigit(*v))
|
||||
info.Add("#define bmSVN_REVISION " + AsCString(TrimBoth(v)));
|
||||
|
|
@ -511,6 +495,11 @@ Vector<String> SvnInfo(const String& package)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(repo == GIT_DIR) {
|
||||
String v = Sys("git rev-list --count HEAD");
|
||||
if(IsDigit(*v))
|
||||
info.Add("#define bmGIT_REVCOUNT " + AsCString(TrimBoth(v)));
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +521,7 @@ void CppBuilder::SaveBuildInfo(const String& package)
|
|||
info << "#define bmUSER " << AsCString(GetUserName()) << "\r\n";
|
||||
|
||||
if(package == mainpackage)
|
||||
info << Join(SvnInfo(package), "\r\n");
|
||||
info << Join(RepoInfo(package), "\r\n");
|
||||
}
|
||||
|
||||
String CppBuilder::DefinesTargetTime(const char *sep, const String& package, const Package& pkg)
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
|
|||
String svn_info;
|
||||
String build_info = "\"$(UPPOUT)/build_info.h\"";
|
||||
if(makefile_svn_revision) {
|
||||
Vector<String> bi = SvnInfo(wspc[i]);
|
||||
Vector<String> bi = RepoInfo(wspc[i]);
|
||||
for(int i = 0; i < bi.GetCount(); i++)
|
||||
svn_info << " echo '" << bi[i] << "' >> " << build_info << "\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -560,4 +560,9 @@ void DeletePCHFiles();
|
|||
|
||||
String GetLineEndings(const String& data, const String& default_eol = "\r\n");
|
||||
|
||||
enum { NOT_REPO_DIR = 0, SVN_DIR, GIT_DIR };
|
||||
|
||||
int GetRepoKind(const String& p);
|
||||
int GetRepo(String& path);
|
||||
|
||||
#endif
|
||||
|
|
@ -18,6 +18,7 @@ file
|
|||
Workspace.cpp,
|
||||
usc.cpp,
|
||||
BinObj.cpp,
|
||||
Util.cpp,
|
||||
Host readonly separator,
|
||||
Host.h,
|
||||
Host.cpp,
|
||||
|
|
|
|||
26
uppsrc/ide/Core/Util.cpp
Normal file
26
uppsrc/ide/Core/Util.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "Core.h"
|
||||
|
||||
int GetRepo(String& path)
|
||||
{
|
||||
if(IsNull(path))
|
||||
return NOT_REPO_DIR;
|
||||
if(DirectoryExists(AppendFileName(path, ".svn")) || DirectoryExists(AppendFileName(path, "_svn")))
|
||||
return SVN_DIR;
|
||||
for(;;) {
|
||||
if(DirectoryExists(AppendFileName(path, ".git")))
|
||||
return GIT_DIR;
|
||||
if(DirectoryExists(AppendFileName(path, ".svn")))
|
||||
return SVN_DIR;
|
||||
String path0 = path;
|
||||
path = GetFileFolder(path);
|
||||
if(path == path0)
|
||||
break;
|
||||
}
|
||||
return NOT_REPO_DIR;
|
||||
}
|
||||
|
||||
int GetRepoKind(const String& p)
|
||||
{
|
||||
String pp = p;
|
||||
return GetRepo(pp);
|
||||
}
|
||||
|
|
@ -311,7 +311,8 @@ void LayLib()
|
|||
global.Add("SColorHighlight", EscColor(SColorHighlight));
|
||||
|
||||
global.Add("IntNull", (int)Null);
|
||||
global.Add("DblNullLim", DOUBLE_NULL_LIM);
|
||||
global.Add("DblNull", (double)Null);
|
||||
global.Add("DblNullLim", -1e307);
|
||||
}
|
||||
|
||||
void EscDraw::DrawRect(EscEscape& e)
|
||||
|
|
|
|||
|
|
@ -558,27 +558,3 @@ String RepoSync::GetMsgs()
|
|||
{
|
||||
return Garble(StoreAsString(*this));
|
||||
}
|
||||
|
||||
int GetRepo(String& path)
|
||||
{
|
||||
if(IsNull(path))
|
||||
return NOT_REPO_DIR;
|
||||
if(DirectoryExists(AppendFileName(path, ".svn")) || DirectoryExists(AppendFileName(path, "_svn")))
|
||||
return SVN_DIR;
|
||||
String path0;
|
||||
while(path != path0) {
|
||||
path0 = path;
|
||||
if(DirectoryExists(AppendFileName(path, ".git")))
|
||||
return GIT_DIR;
|
||||
if(DirectoryExists(AppendFileName(path, ".svn")))
|
||||
return SVN_DIR;
|
||||
DirectoryUp(path);
|
||||
}
|
||||
return NOT_REPO_DIR;
|
||||
}
|
||||
|
||||
int GetRepoKind(const String& p)
|
||||
{
|
||||
String pp = p;
|
||||
return GetRepo(pp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@ String RepoSys(const char *cmd);
|
|||
|
||||
String SvnCmd(const char *cmd);
|
||||
|
||||
enum { NOT_REPO_DIR = 0, SVN_DIR, GIT_DIR };
|
||||
|
||||
int GetRepoKind(const String& p);
|
||||
int GetRepo(String& path);
|
||||
String GetSvnDir(const String& p);
|
||||
|
||||
String GitCmd(const char *dir, const char *command);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue