#include "Builders.h" namespace Upp { String BlitzBaseFile() { return ConfigFile("blitzbase"); } void ResetBlitz() { SaveFile(BlitzBaseFile(), ""); } Time blitz_base_time; void InitBlitz() { Time ltm = Time::High(); const Workspace& wspc = GetIdeWorkspace(); for(int i = 0; i < wspc.GetCount(); i++) { // find lowest file time const Package& pk = wspc.GetPackage(i); String n = wspc[i]; for(int i = 0; i < pk.GetCount(); i++) { String path = SourcePath(n, pk.file[i]); if(FileExists(path)) ltm = min(ltm, FileGetTime(path)); } } blitz_base_time = max(GetSysTime() - 3600, Time(GetFileTime(BlitzBaseFile()))); if(ltm != Time::High()) blitz_base_time = max(blitz_base_time, ltm + 3 * 60); // should solve first build after install/checkout } Blitz BlitzBuilderComponent::MakeBlitzStep(Vector& sfile, Vector& soptions, Vector& obj, Vector& immfile, const char *objext, const Index& noblitz) { Blitz b; b.count = 0; b.build = false; if(!IsBuilder()) return b; Vector excluded; Vector excludedoptions; b.object = CatAnyPath(builder->outdir, "$blitz" + String(objext)); Time blitztime = GetFileTime(b.object); String blitz; if(!IdeGetOneFile().IsEmpty()) return b; for(int i = 0; i < sfile.GetCount(); i++) { String fn = sfile[i]; String ext = ToLower(GetFileExt(fn)); String objfile = CatAnyPath(builder->outdir, GetFileTitle(fn) + objext); Time fntime = GetFileTime(fn); if((ext == ".cpp" || ext == ".cc" || ext == ".cxx" || ext == ".icpp") && HdependBlitzApproved(fn) && IsNull(soptions[i]) && fntime < blitz_base_time && noblitz.Find(fn) < 0) { if(HdependFileTime(fn) > blitztime) b.build = true; blitz << "\r\n" << "#define BLITZ_INDEX__ F" << i << "\r\n" << "#include \"" << builder->GetHostPath(fn) << "\"\r\n"; b.info << ' ' << GetFileName(fn); const Vector& d = HdependGetDefines(fn); for(int i = 0; i < d.GetCount(); i++) blitz << "#ifdef " << d[i] << "\r\n" << "#undef " << d[i] << "\r\n" << "#endif\r\n"; blitz << "#undef BLITZ_INDEX__\r\n"; b.count++; } else { excluded.Add(fn); excludedoptions.Add(soptions[i]); } } b.path = CatAnyPath(builder->outdir, "$blitz.cpp"); if(b.count > 1) { sfile = pick(excluded); soptions = pick(excludedoptions); if(builder->LoadFile(b.path) != blitz) { builder->SaveFile(b.path, blitz); b.build = true; } obj.Add(b.object); immfile.Add(b.object); } else { builder->DeleteFile(b.path); b.build = false; } return b; } }