mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
ide: Fixed issue with assist and main.conf
This commit is contained in:
parent
ffee231395
commit
bba3c76769
7 changed files with 75 additions and 42 deletions
|
|
@ -4,4 +4,4 @@ public:
|
|||
~ViewDraw();
|
||||
};
|
||||
|
||||
class DHCtrl : Ctrl {};
|
||||
class DHCtrl : public Ctrl {};
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ void Ide::FileCompile()
|
|||
if(wspc.GetCount()) {
|
||||
Vector<String> linkfile, immfile;
|
||||
String linkopt;
|
||||
MainConf(wspc);
|
||||
for(int i = 0; i < wspc.GetCount(); i++)
|
||||
BuildPackage(wspc, i, 1, wspc.GetCount(), mainconfigparam, Null, linkfile, immfile, linkopt, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,6 +278,43 @@ void MakeBuild::PkgConfig(const Workspace& wspc, const Index<String>& config, In
|
|||
pkg_config.FindAdd(h);
|
||||
}
|
||||
|
||||
String SaveMainConf(const String& main_conf)
|
||||
{
|
||||
String main_conf_dir = CacheFile("main_conf_" + SHA1String(main_conf));
|
||||
RealizeDirectory(main_conf_dir);
|
||||
String path = AppendFileName(main_conf_dir, "main.conf.h");
|
||||
SaveChangedFile(path, main_conf);
|
||||
return path;
|
||||
}
|
||||
|
||||
String MainConf(const Workspace& wspc, String& add_includes)
|
||||
{
|
||||
String main_conf;
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
const Package& pk = wspc.package[i];
|
||||
for(int j = 0; j < pk.GetCount(); j++)
|
||||
if(pk[j] == "main.conf") {
|
||||
String pn = wspc[i];
|
||||
String p = SourcePath(pn, "main.conf");
|
||||
main_conf << "// " << pn << "\r\n" << LoadFile(p) << "\r\n";
|
||||
PutConsole("Found " + p);
|
||||
}
|
||||
}
|
||||
|
||||
if(main_conf.GetCount()) {
|
||||
String path = SaveMainConf(main_conf);
|
||||
PutConsole("Saving " + path);
|
||||
PutVerbose(main_conf);
|
||||
MergeWith(add_includes, ";", GetFileFolder(path));
|
||||
}
|
||||
return main_conf;
|
||||
}
|
||||
|
||||
void MakeBuild::MainConf(const Workspace& wspc)
|
||||
{
|
||||
main_conf = ::MainConf(wspc, add_includes);
|
||||
}
|
||||
|
||||
bool MakeBuild::BuildPackage(const Workspace& wspc, int pkindex, int pknumber, int pkcount,
|
||||
String mainparam, String outfile, Vector<String>& linkfile, Vector<String>& immfile,
|
||||
String& linkopt, bool link)
|
||||
|
|
@ -452,38 +489,13 @@ bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, b
|
|||
DeleteFile(hfile);
|
||||
|
||||
BeginBuilding(clear_console);
|
||||
|
||||
MainConf(wspc);
|
||||
|
||||
bool ok = true;
|
||||
main_conf.Clear();
|
||||
add_includes.Clear();
|
||||
if(wspc.GetCount()) {
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
const Package& pk = wspc.package[i];
|
||||
for(int j = 0; j < pk.GetCount(); j++)
|
||||
if(pk[j] == "main.conf") {
|
||||
String pn = wspc[i];
|
||||
String p = SourcePath(pn, "main.conf");
|
||||
main_conf << "// " << pn << "\r\n" << LoadFile(p) << "\r\n";
|
||||
PutConsole("Found " + p);
|
||||
}
|
||||
}
|
||||
|
||||
if(main_conf.GetCount()) {
|
||||
VectorMap<String, String> bm = GetMethodVars(method);
|
||||
Host host;
|
||||
CreateHost(host, false, false);
|
||||
One<Builder> b = CreateBuilder(&host);
|
||||
if(b) {
|
||||
Index<String> mcfg = PackageConfig(wspc, 0, bm, mainparam, host, *b, NULL);
|
||||
String outdir = OutDir(mcfg, wspc[0], bm, false);
|
||||
String path = AppendFileName(outdir, "main.conf.h");
|
||||
RealizePath(path);
|
||||
SaveChangedFile(path, main_conf);
|
||||
PutConsole("Saving " + path);
|
||||
PutVerbose(main_conf);
|
||||
add_includes << outdir << ';';
|
||||
}
|
||||
}
|
||||
|
||||
Vector<int> build_order;
|
||||
if(cfg.Find("SO") < 0) {
|
||||
for(int i = 1; i < wspc.GetCount(); i++)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ int CharFilterSlash(int c);
|
|||
String GetDefaultMethod();
|
||||
VectorMap<String, String> GetMethodVars(const String& method);
|
||||
|
||||
String MainConf(const Workspace& wspc, String& add_includes);
|
||||
String SaveMainConf(const String& main_conf);
|
||||
|
||||
class MakeBuild {
|
||||
public:
|
||||
virtual void ConsoleShow() = 0; // ShowConsole(); console.Sync();
|
||||
|
|
@ -75,6 +78,7 @@ public:
|
|||
String OutDir(const Index<String>& cfg, const String& package,
|
||||
const VectorMap<String, String>& bm, bool use_target = false);
|
||||
void PkgConfig(const Workspace& wspc, const Index<String>& config, Index<String>& pkg_config);
|
||||
void MainConf(const Workspace& wspc);
|
||||
bool BuildPackage(const Workspace& wspc, int pkindex, int pknumber, int pkcount,
|
||||
String mainparam, String outfile, Vector<String>& linkfile, Vector<String>& immfile,
|
||||
String& linkopt, bool link = false);
|
||||
|
|
|
|||
|
|
@ -939,23 +939,15 @@ String Ide::GetCurrentIncludePath()
|
|||
IncludeAddPkgConfig(include_path, clang_method);
|
||||
|
||||
String main_conf;
|
||||
const Workspace& wspc = GetIdeWorkspace();
|
||||
const Workspace& wspc = AssistWorkspace();
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
const Package& pkg = wspc.GetPackage(i);
|
||||
for(int j = 0; j < pkg.GetCount(); j++) {
|
||||
for(int j = 0; j < pkg.GetCount(); j++)
|
||||
if(pkg[j] == "import.ext")
|
||||
AddDirs(include_path, GetFileFolder(PackagePath(wspc[i])));
|
||||
if(pkg[j] == "main.conf")
|
||||
main_conf << LoadFile(SourcePath(wspc[i], "main.conf")) << "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
if(main_conf.GetCount()) {
|
||||
String main_conf_dir = CacheFile("main_conf_" + SHA1String(main_conf));
|
||||
RealizeDirectory(main_conf_dir);
|
||||
SaveChangedFile(AppendFileName(main_conf_dir, "main.conf.h"), main_conf);
|
||||
return Merge(";", main_conf_dir, include_path);
|
||||
}
|
||||
|
||||
::MainConf(wspc, include_path);
|
||||
|
||||
return include_path;
|
||||
}
|
||||
|
|
@ -968,7 +960,8 @@ String Ide::GetCurrentDefines()
|
|||
String r;
|
||||
for(String s : flags)
|
||||
MergeWith(r, ";", "flag" + s);
|
||||
const Workspace& wspc = GetIdeWorkspace();
|
||||
|
||||
const Workspace& wspc = AssistWorkspace();
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
const Package& pkg = wspc.GetPackage(i);
|
||||
for(int j = 0; j < pkg.GetCount(); j++) {
|
||||
|
|
|
|||
|
|
@ -685,6 +685,27 @@ const Workspace& Ide::IdeWorkspace() const
|
|||
return wspc;
|
||||
}
|
||||
|
||||
const Workspace& Ide::AssistWorkspace() const
|
||||
{
|
||||
static Workspace wspc;
|
||||
static String _main;
|
||||
bool update = false;
|
||||
if(main != _main || wspc.GetCount() == 0) {
|
||||
update = true;
|
||||
_main = main;
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < wspc.GetCount(); i++)
|
||||
if(wspc.GetPackage(i).time != FileGetTime(PackagePath(wspc[i]))) {
|
||||
update = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(update)
|
||||
wspc.Scan(main, SplitFlags(mainconfigparam, false));
|
||||
return wspc;
|
||||
}
|
||||
|
||||
void Ide::AddPackage(const String& p)
|
||||
{
|
||||
const Workspace& wspc = IdeWorkspace();
|
||||
|
|
|
|||
|
|
@ -1142,6 +1142,8 @@ public:
|
|||
void ShowTopics();
|
||||
void ShowTopicsWin();
|
||||
|
||||
const Workspace& AssistWorkspace() const;
|
||||
|
||||
void IncludeAddPkgConfig(String& include_path, const String& clang_method);
|
||||
String GetIncludePath();
|
||||
String GetCurrentIncludePath();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue