mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Resolved problems with blitz, build_info.h and additional includes
This commit is contained in:
parent
f27121af70
commit
e21ecf2de6
11 changed files with 88 additions and 48 deletions
|
|
@ -183,7 +183,6 @@ bool PathIsEqual(const char *p1, const char *p2)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_WINCE
|
||||
String GetCurrentDirectory() {
|
||||
#if defined(PLATFORM_WIN32)
|
||||
WCHAR h[MAX_PATH];
|
||||
|
|
@ -197,7 +196,6 @@ String GetCurrentDirectory() {
|
|||
return Null;
|
||||
#endif//PLATFORM
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_POSIX
|
||||
|
||||
|
|
@ -653,11 +651,7 @@ String FindFile::GetPath() const
|
|||
}
|
||||
|
||||
String NormalizePath(const char *path) {
|
||||
#ifdef PLATFORM_WINCE
|
||||
return NormalizePath(path, "");
|
||||
#else
|
||||
return NormalizePath(path, GetCurrentDirectory());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool FileCopy(const char *oldname, const char *newname)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ libraries.&]
|
|||
[s5;:Color`:`:Color`(RGBA`):%- [* Color]([_^RGBA^ RGBA]_[*@3 rgba])&]
|
||||
[s2; Conversion from a RGBA structure [%-*@3 rgba].&]
|
||||
[s3; &]
|
||||
[s0;%- &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Public Member List]]}}&]
|
||||
[s3; &]
|
||||
[s5;:Color`:`:operator Value`(`)const:%- [* operator_Value]()_[@(0.0.255) const]&]
|
||||
|
|
@ -161,7 +160,7 @@ etRaw]().&]
|
|||
[s4;%- &]
|
||||
[s5;:Upp`:`:Color`:`:ToString`(`)const:%- String [* ToString]() [@(0.0.255) const]&]
|
||||
[s2; Converts Color to textual form.&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[ {{10000@(113.42.0) [s0; [*@(229)4 SColor]]}}&]
|
||||
[s3;%- &]
|
||||
[s1;:Upp`:`:SColor:%- [@(0.0.255) struct ][*3 SColor][3 ][@(0.0.255)3 :][3
|
||||
|
|
@ -179,7 +178,7 @@ copied to normal Color while maintaining its dynamic feature.&]
|
|||
[s5;:Upp`:`:SColor`:`:SColor`(Color`(`*`)`(`)`):%- [* SColor](Color
|
||||
([@(0.0.255) `*]fn)() [@(0.0.255) `=] [@3 0])&]
|
||||
[s2; Creates SColor with color definition function.&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[ {{10000@(113.42.0) [s0; [*@(229)4 AColor]]}}&]
|
||||
[s3;%- &]
|
||||
[s1;:Upp`:`:AColor:%- [@(0.0.255) struct ][*3 AColor][3 ][@(0.0.255)3 :][3
|
||||
|
|
@ -190,14 +189,14 @@ theme, color is adjusted using [%-* DarkThemeCached] function.
|
|||
The AColor instances can be copied to normal Color while maintaining
|
||||
its dynamic feature. [/ (Unlike SColor there are no limitations
|
||||
with respect to storage duration).]&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Constructor Detail]]}}&]
|
||||
[s3;%- &]
|
||||
[s5;:Upp`:`:AColor`:`:AColor`(Color`):%- [* AColor](Color [*@3 c])&]
|
||||
[s5;:Upp`:`:AColor`:`:AColor`(int`,int`,int`):%- [* AColor]([@(0.0.255) int]
|
||||
[*@3 r], [@(0.0.255) int] [*@3 g], [@(0.0.255) int] [*@3 b])&]
|
||||
[s2; Creates AColor.&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[ {{10000@(113.42.0) [s0; [*@(229)4 Utility functions]]}}&]
|
||||
[s3;%- &]
|
||||
[s5;:GetRValue`(dword`):%- [@(0.0.255) int]_[* GetRValue]([_^dword^ dword]_[*@3 c])&]
|
||||
|
|
@ -408,7 +407,7 @@ and vice versa, sustaining the color hue.&]
|
|||
[s9; Predefined colors are represented by functions that return the
|
||||
predefined color value.&]
|
||||
[s3; &]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[s5;:Black`(`):%- [_^Color^ Color]_[* Black]()&]
|
||||
[s2; Black.&]
|
||||
[s3;%- &]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include "Builders.h"
|
||||
|
||||
namespace Upp {
|
||||
|
||||
String BlitzBaseFile()
|
||||
{
|
||||
return ConfigFile("blitzbase");
|
||||
|
|
@ -80,16 +78,18 @@ Blitz BlitzBuilderComponent::MakeBlitzStep(
|
|||
String blitz;
|
||||
if(!IdeGetOneFile().IsEmpty())
|
||||
return b;
|
||||
String build_info_path = NormalizePath(builder.GetBuildInfoPath());
|
||||
for(int i = 0; i < sourceFiles.GetCount(); i++) {
|
||||
String sourceFile = sourceFiles[i];
|
||||
String ext = ToLower(GetFileExt(sourceFile));
|
||||
String objfile = CatAnyPath(outDir, GetFileTitle(sourceFile) + objext);
|
||||
Time sourceFileTime = GetFileTime(sourceFile);
|
||||
Time htime = builder.HdependFileTime(sourceFile);
|
||||
if((ext == ".cpp" || ext == ".cc" || ext == ".cxx" || ext == ".icpp")
|
||||
&& HdependBlitzApproved(sourceFile) && IsNull(soptions[i])
|
||||
&& sourceFileTime < blitz_base_time
|
||||
&& noblitz.Find(sourceFile) < 0) {
|
||||
if(builder.HdependFileTime(sourceFile) > blitztime)
|
||||
if(htime > blitztime)
|
||||
b.build = true;
|
||||
BlitzFile(blitz, sourceFile, HdependGetDefines(sourceFile), i);
|
||||
b.info << ' ' << GetFileName(sourceFile);
|
||||
|
|
@ -119,5 +119,3 @@ Blitz BlitzBuilderComponent::MakeBlitzStep(
|
|||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ bool MakeBuild::BuildPackage(const Workspace& wspc, int pkindex, int pknumber, i
|
|||
String mainparam, String outfile, Vector<String>& linkfile, Vector<String>& immfile,
|
||||
String& linkopt, bool link)
|
||||
{
|
||||
HdependBaseIncludes();
|
||||
String package = wspc[pkindex];
|
||||
String mainpackage = wspc[0];
|
||||
const Package& pkg = wspc.package[pkindex];
|
||||
|
|
@ -341,6 +342,7 @@ bool MakeBuild::BuildPackage(const Workspace& wspc, int pkindex, int pknumber, i
|
|||
b->method = method;
|
||||
b->outdir = OutDir(b->config, package, bm);
|
||||
host.RealizeDir(b->outdir);
|
||||
HdependAddInclude(b->outdir);
|
||||
String mainfn = Null;
|
||||
Index<String> mcfg = PackageConfig(wspc, 0, bm, mainparam, host, *b, &mainfn);
|
||||
HdependClearDependencies();
|
||||
|
|
@ -428,7 +430,7 @@ void MakeBuild::SetHdependDirs()
|
|||
include.Add(SourcePath(wspc[i], pkg.include[j].text));
|
||||
}
|
||||
|
||||
HdependSetDirs(pick(include));
|
||||
HdependSetIncludes(pick(include));
|
||||
}
|
||||
|
||||
Vector<String> MakeBuild::GetAllUses(const Workspace& wspc, int f,
|
||||
|
|
@ -546,6 +548,7 @@ bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, b
|
|||
}
|
||||
EndBuilding(ok);
|
||||
SetErrorEditor();
|
||||
HdependBaseIncludes();
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include <Core/Core.h>
|
||||
|
||||
namespace Upp {
|
||||
|
||||
class BuilderComponent {
|
||||
public:
|
||||
BuilderComponent() { this->builder = NULL; }
|
||||
|
|
@ -51,6 +49,4 @@ private:
|
|||
String blitzFileName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ struct CppBuilder : Builder {
|
|||
void DoRc(Vector<String>& sfile, Vector<String>& soptions, const Package& pkg, const String& package);
|
||||
|
||||
String Includes(const char *sep, const String& package, const Package& pkg);
|
||||
virtual String GetBuildInfoPath() const;
|
||||
void SaveBuildInfo(const String& package);
|
||||
String DefinesTargetTime(const char *sep, const String& package, const Package& pkg);
|
||||
String IncludesDefinesTargetTime(const String& package, const Package& pkg);
|
||||
|
|
|
|||
|
|
@ -569,9 +569,14 @@ Vector<String> RepoInfo(const String& package)
|
|||
return info;
|
||||
}
|
||||
|
||||
String CppBuilder::GetBuildInfoPath() const
|
||||
{
|
||||
return AppendFileName(outdir, "build_info.h");
|
||||
}
|
||||
|
||||
void CppBuilder::SaveBuildInfo(const String& package)
|
||||
{
|
||||
String path = AppendFileName(outdir, "build_info.h");
|
||||
String path = GetBuildInfoPath();
|
||||
RealizePath(path);
|
||||
FileOut info(path);
|
||||
Time t = GetSysTime();
|
||||
|
|
|
|||
|
|
@ -36,8 +36,9 @@ VectorMap<String, String> Builder::cmdx_cache;
|
|||
|
||||
Time Builder::HdependFileTime(const String& path)
|
||||
{
|
||||
dependencies.Clear();
|
||||
return onefile.GetCount() ? path == onefile ? GetSysTime() : Time::Low()
|
||||
: HdependGetFileTime(path, outdir);
|
||||
: HdependGetFileTime(path, &dependencies);
|
||||
}
|
||||
|
||||
String Builder::CmdX(const char *s)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class PPInfo {
|
|||
int blitz; // AUTO, APPROVED, PROHIBITED
|
||||
Time time = Null; // file time
|
||||
|
||||
bool dirty = true; // need to be rechecked
|
||||
bool dirty = true; // need to be rechecked for change (filetime)
|
||||
|
||||
void Dirty() { dirty = true; time = Null; }
|
||||
void Parse(Stream& in);
|
||||
|
|
@ -73,8 +73,11 @@ class PPInfo {
|
|||
|
||||
ArrayMap<String, PPFile> files;
|
||||
Vector<String> includes; // include dirs
|
||||
int includes_base_count; // for trimming out additional includes
|
||||
VectorMap<String, String> inc_cache; // cache for FindIncludeFile
|
||||
VectorMap<String, Dir> dir_cache; // cache for GetFileTime, FileExists, DirExists
|
||||
String current_dir; // CurrentDirectory for NormalizePath
|
||||
VectorMap<String, String> normalize_path_cache; // cache for NormalizePath
|
||||
static std::atomic<int> scan_serial;
|
||||
VectorMap<String, Index<String> > depends; // externally forced dependecies
|
||||
|
||||
|
|
@ -86,9 +89,14 @@ public:
|
|||
Event<const String&, const String&> WhenBlitzBlock;
|
||||
Time GetFileTime(const String& path);
|
||||
bool FileExists(const String& path) { return !IsNull(GetFileTime(path)); }
|
||||
String NormalizePath(const String& path, const String& curr_dir);
|
||||
String NormalizePath(const String& path) { return NormalizePath(path, current_dir); }
|
||||
|
||||
void SetIncludes(Vector<String>&& includes);
|
||||
void SetIncludes(const String& includes);
|
||||
|
||||
void BaseIncludes();
|
||||
void AddInclude(const String& include);
|
||||
|
||||
String FindIncludeFile(const char *s, const String& filedir, const Vector<String>& incdirs);
|
||||
String FindIncludeFile(const char *s, const String& filedir);
|
||||
|
|
@ -109,7 +117,7 @@ public:
|
|||
ArrayMap<String, Index<String>>& define_includes,
|
||||
bool speculative = true);
|
||||
|
||||
Time GetTime(const String& path, const String& additional_include_path);
|
||||
Time GetTime(const String& path, VectorMap<String, Time> *ret_result = nullptr);
|
||||
|
||||
const VectorMap<String, String>& GetFileDefines(const String& path) { return File(NormalizePath(path)).all_defines; }
|
||||
const Vector<Tuple<String, int>>& GetFileFlags(const String& path) { return File(NormalizePath(path)).flags; }
|
||||
|
|
@ -117,11 +125,13 @@ public:
|
|||
void Dirty();
|
||||
};
|
||||
|
||||
void HdependSetDirs(Vector<String>&& id);
|
||||
void HdependSetIncludes(Vector<String>&& id);
|
||||
void HdependBaseIncludes();
|
||||
void HdependAddInclude(const String& inc);
|
||||
void HdependTimeDirty();
|
||||
void HdependClearDependencies();
|
||||
void HdependAddDependency(const String& file, const String& depends);
|
||||
Time HdependGetFileTime(const String& path, const String& additional_include_path);
|
||||
Time HdependGetFileTime(const String& path, VectorMap<String, Time> *ret_result = nullptr);
|
||||
Vector<String> HdependGetDependencies(const String& file, bool bydefine_too = true);
|
||||
bool HdependBlitzApproved(const String& path);
|
||||
const Vector<String>& HdependGetDefines(const String& path);
|
||||
|
|
@ -555,6 +565,7 @@ struct Builder {
|
|||
Vector<String> Macro;
|
||||
|
||||
VectorMap<String, int> tmpfilei; // for naming automatic response files
|
||||
VectorMap<String, Time> dependencies; // dependencies of the last HdependFileTime call
|
||||
|
||||
static VectorMap<String, String> cmdx_cache; // caching e.g. pkg-config
|
||||
|
||||
|
|
@ -579,6 +590,7 @@ struct Builder {
|
|||
const Index<String>& common_config, bool exporting, bool last_ws) {}
|
||||
virtual String GetTargetExt() const = 0;
|
||||
virtual void SaveBuildInfo(const String& package) {}
|
||||
virtual String GetBuildInfoPath() const { return String(); }
|
||||
virtual String CompilerName() const { return Null; }
|
||||
|
||||
Builder() { doall = false; main_conf = false; }
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ void PPInfo::SetIncludes(Vector<String>&& incs)
|
|||
{
|
||||
inc_cache.Clear();
|
||||
includes = pick(incs);
|
||||
includes_base_count = includes.GetCount();
|
||||
}
|
||||
|
||||
void PPInfo::SetIncludes(const String& incs)
|
||||
|
|
@ -227,6 +228,20 @@ void PPInfo::SetIncludes(const String& incs)
|
|||
SetIncludes(Split(incs, ';'));
|
||||
}
|
||||
|
||||
void PPInfo::BaseIncludes()
|
||||
{
|
||||
if(includes.GetCount() > includes_base_count) {
|
||||
inc_cache.Clear();
|
||||
includes.Trim(includes_base_count);
|
||||
}
|
||||
}
|
||||
|
||||
void PPInfo::AddInclude(const String& include)
|
||||
{
|
||||
inc_cache.Clear();
|
||||
includes << include;
|
||||
}
|
||||
|
||||
void PPInfo::Dir::Load(const String& dir)
|
||||
{
|
||||
for(FindFile ff(dir + "/*.*"); ff; ff.Next()) {
|
||||
|
|
@ -262,6 +277,18 @@ Time PPInfo::GetFileTime(const String& path)
|
|||
return dir_cache[q].files.Get(name, Null);
|
||||
}
|
||||
|
||||
String PPInfo::NormalizePath(const String& path, const String& curr_dir)
|
||||
{
|
||||
String key = path + "|" + curr_dir;
|
||||
int q = normalize_path_cache.Find(key);
|
||||
if(q < 0) {
|
||||
String p = Upp::NormalizePath(path, curr_dir);
|
||||
normalize_path_cache.Add(key, p);
|
||||
return p;
|
||||
}
|
||||
return normalize_path_cache[q];
|
||||
}
|
||||
|
||||
String PPInfo::FindIncludeFile(const char *s, const String& filedir, const Vector<String>& incdirs)
|
||||
{
|
||||
while(*s == ' ' || *s == '\t')
|
||||
|
|
@ -308,6 +335,11 @@ void PPInfo::Dirty()
|
|||
f.dirty = true;
|
||||
inc_cache.Clear();
|
||||
dir_cache.Clear();
|
||||
String cd = GetCurrentDirectory();
|
||||
if(cd != current_dir) {
|
||||
current_dir = cd;
|
||||
normalize_path_cache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
std::atomic<int> PPInfo::scan_serial;
|
||||
|
|
@ -430,13 +462,8 @@ void PPInfo::GatherDependencies(const String& path, VectorMap<String, Time>& res
|
|||
GatherDependencies(path, result, define_includes, flags, speculative);
|
||||
}
|
||||
|
||||
Time PPInfo::GetTime(const String& path, const String& additional_include_path)
|
||||
Time PPInfo::GetTime(const String& path, VectorMap<String, Time> *ret_result)
|
||||
{
|
||||
int inc_cache_bak = inc_cache.GetCount();
|
||||
int includes_bak = includes.GetCount();
|
||||
|
||||
includes.Append(Split(additional_include_path, ';'));
|
||||
|
||||
String p = NormalizePath(path);
|
||||
|
||||
VectorMap<String, Time> result;
|
||||
|
|
@ -447,15 +474,15 @@ Time PPInfo::GetTime(const String& path, const String& additional_include_path)
|
|||
int d = depends.Find(p);
|
||||
if(d >= 0) {
|
||||
const Index<String>& dep = depends[d];
|
||||
for(int i = 0; i < dep.GetCount(); i++) {
|
||||
Time tm = GetFileTime(dep[i]);
|
||||
for(const String& d : dep) {
|
||||
Time tm = GetFileTime(d);
|
||||
if(tm > ftm)
|
||||
ftm = tm;
|
||||
}
|
||||
}
|
||||
|
||||
inc_cache.Trim(inc_cache_bak);
|
||||
includes.Trim(includes_bak);
|
||||
if(ret_result)
|
||||
*ret_result = pick(result);
|
||||
|
||||
return ftm;
|
||||
}
|
||||
|
|
@ -473,11 +500,9 @@ bool PPInfo::BlitzApproved(const String& path)
|
|||
String ipath = FindIncludeFile(inc, dir);
|
||||
if(ipath.GetCount()) {
|
||||
PPFile& f = File(ipath);
|
||||
if(f.blitz == APPROVED)
|
||||
return true;
|
||||
if(f.blitz == PROHIBITED)
|
||||
return false;
|
||||
if(!f.guarded) {
|
||||
if(f.blitz != APPROVED && !f.guarded) {
|
||||
WhenBlitzBlock(ipath, path);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -488,11 +513,21 @@ bool PPInfo::BlitzApproved(const String& path)
|
|||
|
||||
static PPInfo hdepend;
|
||||
|
||||
void HdependSetDirs(Vector<String>&& id)
|
||||
void HdependSetIncludes(Vector<String>&& id)
|
||||
{
|
||||
hdepend.SetIncludes(pick(id));
|
||||
}
|
||||
|
||||
void HdependBaseIncludes()
|
||||
{
|
||||
hdepend.BaseIncludes();
|
||||
}
|
||||
|
||||
void HdependAddInclude(const String& inc)
|
||||
{
|
||||
hdepend.AddInclude(inc);
|
||||
}
|
||||
|
||||
void HdependTimeDirty()
|
||||
{
|
||||
hdepend.Dirty();
|
||||
|
|
@ -508,9 +543,9 @@ void HdependAddDependency(const String& file, const String& depends)
|
|||
hdepend.AddDependency(file, depends);
|
||||
}
|
||||
|
||||
Time HdependGetFileTime(const String& path, const String& additional_include_path)
|
||||
Time HdependGetFileTime(const String& path, VectorMap<String, Time> *ret_result)
|
||||
{
|
||||
return hdepend.GetTime(path, additional_include_path);
|
||||
return hdepend.GetTime(path, ret_result);
|
||||
}
|
||||
|
||||
Vector<String> HdependGetDependencies(const String& path, bool bydefine_too)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#include "ide.h"
|
||||
|
||||
#ifndef bmYEAR
|
||||
#include <build_info.h>
|
||||
#endif
|
||||
|
||||
bool SetupGITMaster()
|
||||
{
|
||||
WithSetupGITLayout<TopWindow> dlg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue