getting there

This commit is contained in:
Mirek Fidler 2026-07-09 16:35:28 +02:00
parent 4f2254e27b
commit edef086d4a
4 changed files with 26 additions and 8 deletions

View file

@ -346,7 +346,7 @@ Array<CompileCommand> MakeBuild::GetCompileCommands()
b->include << m;
}
incs << ' ' << "-I" << b->GetPathQ(UnixPath(GetUppOut()));
incs << ' ' << "-I" << GetPathQ(UnixPath(GetUppOut()));
b->cc_inc = incs;

View file

@ -158,29 +158,45 @@ void Ide::ClangTidy()
dlg.Save();
MakeBuild *mb = dynamic_cast<MakeBuild *>(TheIdeContext());
MakeBuild *mb = dynamic_cast<MakeBuild *>(TheIdeContext()); // TODO: Move to Builders/umk
if(!mb)
return;
Array<CompileCommand> commands = mb->GetCompileCommands();
String cmdline;
JsonArray ccj;
String outdir;
for(const auto& m : commands) {
String dir = GetFileFolder(m.file);
if(IsNull(outdir))
outdir = dir; // this is as good place as any
ccj << Upp::Json("directory", dir)("command", m.command)("file", GetFileName(m.file));
outdir = GetFileFolder(m.ofile);
ccj << Upp::Json("directory", GetFileFolder(m.file))("command", m.command)("file", GetFileName(m.file));
cmdline << ' ' << GetPathQ(m.file);
}
String cc_path = outdir + "/compile_commands.json";
RealizePath(cc_path);
Upp::SaveFile(cc_path, ccj.ToString());
DDUMP(cc_path);
DDUMP(ccj.ToString());
cmdline << " -checks=" << Join(ClangTidyDlg::active_checks.GetKeys(), ",")
<< " -p " << cc_path;
/*
String rf_path = outdir + "/clang_tidy_parameters_file";
Upp::SaveFile(rf_path, cmdline);
BeginBuilding(true);
Host host;
CreateHost(host, darkmode, disable_uhd);
host.Execute(ClangTidyDlg::path + " @" + rf_path);
EndBuilding(true);
SetErrorEditor();
/*
String files;
for(const String& f : ResolveFiles(sc, ccjpath, paths))
path << "\"" << f << "\" ";

View file

@ -12,7 +12,7 @@ String TrimSlash(String s)
return s;
}
String Builder::GetPathQ(const String& path) const
String GetPathQ(const String& path)
{
return '\"' + TrimSlash(path) + '\"';
}

View file

@ -607,7 +607,6 @@ struct Builder {
virtual ~Builder() {}
void ChDir(const String& path);
String GetPathQ(const String& path) const;
Vector<Host::FileInfo> GetFileInfo(const Vector<String>& path) const;
Host::FileInfo GetFileInfo(const String& path) const;
Time GetFileTime(const String& path) const;
@ -616,6 +615,9 @@ struct Builder {
bool HasFlag(const char *f) const { return config.Find(f) >= 0; }
};
String TrimSlash(String s);
String GetPathQ(const String& path);
VectorMap<String, Builder *(*)()>& BuilderMap();
void RegisterBuilder(const char *name, Builder *(*create)());