mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-25 14:22:54 -06:00
ide: Custom build steps refresh
git-svn-id: svn://ultimatepp.org/upp/trunk@4203 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ce8513ea5d
commit
e8dcdd4f51
11 changed files with 99 additions and 52 deletions
|
|
@ -569,9 +569,6 @@ String IntFormatter(const Formatting& f)
|
|||
return AsString((int)f.arg);
|
||||
StringBuffer q;
|
||||
q.SetLength(1000);
|
||||
DDUMP(f.format);
|
||||
DDUMP(f.id);
|
||||
DDUMP('%' + f.format + f.id);
|
||||
q.SetLength(sprintf(q, '%' + f.format + f.id, (int)f.arg));
|
||||
return q;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
description "Visual style for ToolBar and MenuBar";
|
||||
description "Visual style for ToolBar and MenuBar\377";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
BlueBar.h,
|
||||
BlueSkin.iml,
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ struct CppBuilder : Builder {
|
|||
bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
|
||||
bool Wait();
|
||||
bool HasFlag(const char *f) const { return config.Find(f) >= 0; }
|
||||
Vector<String> CustomStep(const String& file);
|
||||
bool Cp(const String& cmd, const String& package, bool& error);
|
||||
bool Cd(const String& cmd);
|
||||
Vector<String> CustomStep(const String& path, const String& package, bool& error);
|
||||
|
||||
String Includes(const char *sep, const String& package, const Package& pkg);
|
||||
String IncludesShort(const char *sep, const String& package, const Package& pkg);
|
||||
|
|
|
|||
|
|
@ -187,19 +187,39 @@ Vector<String> Cuprep(const String& m, const VectorMap<String, String>& mac,
|
|||
return Split(r, CharFilterTextTest(CharFilterEol));
|
||||
}
|
||||
|
||||
bool IsCd(const String& cmd) {
|
||||
bool CppBuilder::Cd(const String& cmd) {
|
||||
if(cmd.GetLength() > 2 && ToLower(cmd.Mid(0, 3)) == "cd ") {
|
||||
String path = cmd.Mid(3);
|
||||
#ifdef PLATFOTM_POSIX
|
||||
chdir(path);
|
||||
#endif
|
||||
#ifdef PLATFORM_WIN32
|
||||
SetCurrentDirectory(cmd.Mid(3));
|
||||
SetCurrentDirectory(path);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CppBuilder::Cp(const String& cmd, const String& package, bool& error) {
|
||||
if(cmd.GetLength() > 2 && ToLower(cmd.Mid(0, 3)) == "cp ") {
|
||||
Vector<String> path = Split(cmd.Mid(3), ' ');
|
||||
if(path.GetCount() == 2) {
|
||||
String p = GetFileFolder(PackagePath(package));
|
||||
String p1 = NormalizePath(path[0], p);
|
||||
String p2 = NormalizePath(path[1], p);
|
||||
RealizePath(p2);
|
||||
if(!FileExists(p1)) {
|
||||
PutConsole("FAILED: " + cmd);
|
||||
error = true;
|
||||
}
|
||||
SaveFile(p2, LoadFile(p1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void AddPath(VectorMap<String, String>& out, String key, String path)
|
||||
{
|
||||
out.Add(key, path);
|
||||
|
|
@ -207,8 +227,9 @@ static void AddPath(VectorMap<String, String>& out, String key, String path)
|
|||
out.Add(key + "_UNIX", UnixPath(path));
|
||||
}
|
||||
|
||||
Vector<String> CppBuilder::CustomStep(const String& path)
|
||||
Vector<String> CppBuilder::CustomStep(const String& pf, const String& package, bool& error)
|
||||
{
|
||||
String path = package.GetCount() ? SourcePath(package, pf) : pf;
|
||||
String file = GetHostPath(path);
|
||||
String ext = ToLower(GetFileExt(file));
|
||||
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||
|
|
@ -218,13 +239,21 @@ Vector<String> CppBuilder::CustomStep(const String& path)
|
|||
if(MatchWhen(m.when, config.GetKeys()) && m.MatchExt(ext)) {
|
||||
VectorMap<String, String> mac;
|
||||
AddPath(mac, "PATH", file);
|
||||
AddPath(mac, "RELPATH", pf);
|
||||
AddPath(mac, "DIR", GetFileFolder(file));
|
||||
AddPath(mac, "PACKAGE", package);
|
||||
mac.Add("FILE", GetFileName(file));
|
||||
mac.Add("TITLE", GetFileTitle(file));
|
||||
AddPath(mac, "OUTPATH", GetHostPath(target));
|
||||
AddPath(mac, "EXEPATH", GetHostPath(target));
|
||||
AddPath(mac, "EXEDIR", GetHostPath(GetFileFolder(target)));
|
||||
mac.Add("EXEFILE", GetFileName(target));
|
||||
mac.Add("EXETITLE", GetFileTitle(target));
|
||||
AddPath(mac, "OUTDIR", GetHostPath(outdir));
|
||||
mac.Add("OUTFILE", GetFileName(target));
|
||||
mac.Add("OUTTITLE", GetFileTitle(target));
|
||||
//BW
|
||||
AddPath(mac, "OUTDIR", GetHostPath(GetFileFolder(target)));
|
||||
AddPath(mac, "OUTFILE", GetHostPath(GetFileName(target)));
|
||||
AddPath(mac, "OUTTITLE", GetHostPath(GetFileTitle(target)));
|
||||
|
||||
mac.Add("INCLUDE", Join(include, ";"));
|
||||
Vector<String> out = Cuprep(m.output, mac, include);
|
||||
bool dirty = out.IsEmpty();
|
||||
|
|
@ -235,8 +264,9 @@ Vector<String> CppBuilder::CustomStep(const String& path)
|
|||
PutConsole(GetFileName(file));
|
||||
Vector<String> cmd = Cuprep(m.command, mac, include);
|
||||
String cmdtext;
|
||||
for(int c = 0; c < cmd.GetCount(); c++)
|
||||
if(!IsCd(cmd[c])) {
|
||||
for(int c = 0; c < cmd.GetCount(); c++) {
|
||||
PutVerbose(cmd[c]);
|
||||
if(!Cd(cmd[c]) && !Cp(cmd[c], package, error)) {
|
||||
String ctext = cmd[c];
|
||||
const char *cm = ctext;
|
||||
if(*cm == '?')
|
||||
|
|
@ -244,9 +274,12 @@ Vector<String> CppBuilder::CustomStep(const String& path)
|
|||
if(*ctext != '?' && Execute(cm)) {
|
||||
for(int t = 0; t < out.GetCount(); t++)
|
||||
DeleteFile(out[t]);
|
||||
PutConsole("FAILED: " + ctext);
|
||||
error = true;
|
||||
return Vector<String>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ bool GccBuilder::BuildPackage(const String& package, Vector<String>& linkfile,
|
|||
return false;
|
||||
if(!pkg[i].separator) {
|
||||
String gop = Gather(pkg[i].option, config.GetKeys());
|
||||
Vector<String> srcfile = CustomStep(SourcePath(package, pkg[i]));
|
||||
Vector<String> srcfile = CustomStep(pkg[i], package, error);
|
||||
if(srcfile.GetCount() == 0)
|
||||
error = true;
|
||||
for(int j = 0; j < srcfile.GetCount(); j++) {
|
||||
|
|
@ -392,12 +392,13 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
|
|||
if(!HasFlag("SOLARIS") && !HasFlag("OSX11"))
|
||||
lnk << " -Wl,--end-group";
|
||||
PutConsole("Linking...");
|
||||
CustomStep(".pre-link");
|
||||
if(Execute(lnk) == 0) {
|
||||
CustomStep(".post-link");
|
||||
bool error = false;
|
||||
CustomStep(".pre-link", Null, error);
|
||||
if(!error && Execute(lnk) == 0) {
|
||||
CustomStep(".post-link", Null, error);
|
||||
PutConsole(String().Cat() << GetHostPath(target) << " (" << GetFileInfo(target).length
|
||||
<< " B) linked in " << GetPrintTime(time));
|
||||
return true;
|
||||
return !error;
|
||||
}
|
||||
else {
|
||||
DeleteFile(target);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ bool JavaBuilder::BuildPackage(const String& package, Vector<String>& linkfile,
|
|||
return false;
|
||||
if(!pkg[i].separator) {
|
||||
String gop = Gather(pkg[i].option, config.GetKeys());
|
||||
Vector<String> srcfile = CustomStep(SourcePath(package, pkg[i]));
|
||||
Vector<String> srcfile = CustomStep(pkg[i], package, error);
|
||||
if(srcfile.GetCount() == 0)
|
||||
error = true;
|
||||
for(int j = 0; j < srcfile.GetCount(); j++)
|
||||
|
|
@ -273,8 +273,9 @@ bool JavaBuilder::Link(const Vector<String>& linkfile, const String& linkoptions
|
|||
Time tm = Time::Low();
|
||||
for(int i = ITEMCOUNT; i < linkfile.GetCount(); i++)
|
||||
tm = max(tm, AddClassDeep(cmdline, linkfile[i], Null));
|
||||
bool error = false;
|
||||
if(tm > targettime) {
|
||||
CustomStep(".pre-link");
|
||||
CustomStep(".pre-link", Null, error);
|
||||
String link, response;
|
||||
link << "jar ";
|
||||
if(cmdline.GetLength() < 32000)
|
||||
|
|
@ -294,7 +295,7 @@ bool JavaBuilder::Link(const Vector<String>& linkfile, const String& linkoptions
|
|||
DeleteFile(target);
|
||||
return false;
|
||||
}
|
||||
CustomStep(".post-link");
|
||||
CustomStep(".post-link", Null, error);
|
||||
PutConsole(String().Cat() << target << " (" << GetFileInfo(target).length
|
||||
<< " B) archived in " << GetPrintTime(time));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ bool MscBuilder::BuildPackage(const String& package, Vector<String>& linkfile, S
|
|||
return false;
|
||||
if(!pkg[i].separator) {
|
||||
String gop = Gather(pkg[i].option, config.GetKeys());
|
||||
Vector<String> srcfile = CustomStep(SourcePath(package, pkg[i]));
|
||||
Vector<String> srcfile = CustomStep(pkg[i], package, error);
|
||||
if(srcfile.GetCount() == 0)
|
||||
error = true;
|
||||
for(int j = 0; j < srcfile.GetCount(); j++) {
|
||||
|
|
@ -520,9 +520,10 @@ bool MscBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
|
|||
for(i = 0; i < linkfile.GetCount(); i++)
|
||||
link << ' ' << GetHostPathQ(AppendExt(linkfile[i], ".lib"));
|
||||
PutConsole("Linking...");
|
||||
CustomStep(".pre-link");
|
||||
if(Execute(link) == 0) {
|
||||
CustomStep(".post-link");
|
||||
bool error = false;
|
||||
CustomStep(".pre-link", Null, error);
|
||||
if(!error, Execute(link) == 0) {
|
||||
CustomStep(".post-link", Null, error);
|
||||
if((IsMsc86() || IsMsc64()) && HasFlag("SHARED")) {
|
||||
String mt("mt -nologo -manifest ");
|
||||
mt << GetHostPathQ(target) << ".manifest -outputresource:" << GetHostPathQ(target)
|
||||
|
|
@ -531,7 +532,7 @@ bool MscBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
|
|||
}
|
||||
PutConsole(String().Cat() << GetHostPath(target) << " (" << GetFileInfo(target).length
|
||||
<< " B) linked in " << GetPrintTime(time));
|
||||
return true;
|
||||
return !error;
|
||||
}
|
||||
else {
|
||||
DeleteFile(target);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ bool OwcBuilder::BuildPackage(const String& package, Vector<String>& linkfile, S
|
|||
return false;
|
||||
if (!pkg[i].separator) {
|
||||
String gop = Gather(pkg[i].option, config.GetKeys());
|
||||
Vector<String> srcfile = CustomStep(SourcePath(package, pkg[i]));
|
||||
Vector<String> srcfile = CustomStep(pkg[i], package, error);
|
||||
if (srcfile.GetCount() == 0)
|
||||
error = true;
|
||||
for (int j = 0; j < srcfile.GetCount(); j++) {
|
||||
|
|
@ -346,13 +346,13 @@ bool OwcBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
|
|||
link << " name '" << GetHostPath(target) << '\'';
|
||||
|
||||
PutConsole("Linking...");
|
||||
CustomStep(".pre-link");
|
||||
if (Execute(link) == 0) {
|
||||
CustomStep(".post-link");
|
||||
|
||||
bool error = false;
|
||||
CustomStep(".pre-link", Null, error);
|
||||
if (!error, Execute(link) == 0) {
|
||||
CustomStep(".post-link", Null, error);
|
||||
PutConsole(String().Cat() << GetHostPath(target) << " (" << GetFileInfo(target).length
|
||||
<< " B) linked in " << GetPrintTime(time));
|
||||
return true;
|
||||
return !error;
|
||||
}
|
||||
else {
|
||||
DeleteFile(target);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ bool ScriptBuilder::BuildPackage(const String& package, Vector<String>& linkfile
|
|||
return false;
|
||||
if(!pkg[i].separator) {
|
||||
String gop = Gather(pkg[i].option, config.GetKeys());
|
||||
Vector<String> srcfile = CustomStep(SourcePath(package, pkg[i]));
|
||||
Vector<String> srcfile = CustomStep(pkg[i], package, error);
|
||||
if(srcfile.GetCount() == 0)
|
||||
error = true;
|
||||
for(int j = 0; j < srcfile.GetCount(); j++) {
|
||||
|
|
@ -255,15 +255,16 @@ bool ScriptBuilder::Link(const Vector<String>& linkfile, const String& linkoptio
|
|||
linkargs.Add(GetHostPathQ(target));
|
||||
linkargs.Add(linkoptions);
|
||||
PutConsole("Linking...");
|
||||
CustomStep(".pre-link");
|
||||
if(!ExecuteIf("link", linkargs).GetNumber()) {
|
||||
bool error = false;
|
||||
CustomStep(".pre-link", Null, error);
|
||||
if(!error && !ExecuteIf("link", linkargs).GetNumber()) {
|
||||
DeleteFile(target);
|
||||
return false;
|
||||
}
|
||||
CustomStep(".post-link");
|
||||
CustomStep(".post-link", Null, error);
|
||||
PutConsole(String().Cat() << GetHostPath(target) << " (" << GetFileInfo(target).length
|
||||
<< " B) linked in " << GetPrintTime(time));
|
||||
return true;
|
||||
return !error;
|
||||
}
|
||||
PutConsole(String().Cat() << GetHostPath(target) << " (" << GetFileInfo(target).length
|
||||
<< " B) is up to date.");
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
#define _ide_Builders_icpp_init_stub
|
||||
#include "coff\binobj/init"
|
||||
#include "ide\Core/init"
|
||||
#define BLITZ_INDEX__ F5D63248A216048F12A96280BF9CB1E86
|
||||
#define BLITZ_INDEX__ F774b8a1ae84f2d8f255be80983d999ac
|
||||
#include "GccBuilder.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F58692EE5FAB064756C1AE099CA890EDA
|
||||
#define BLITZ_INDEX__ F0059f6d7377da3c3eb3cac2ae785c40f
|
||||
#include "MscBuilder.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F5A4713C90AFE78208C685537F21EFDF9
|
||||
#define BLITZ_INDEX__ F6d37e82e414afc35c42d6c74d0c5b4ed
|
||||
#include "OwcBuilder.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F9915670F587B8AA51BB4595212B2EC34
|
||||
#define BLITZ_INDEX__ Ffe78d94eb9485fbb8fec961febd10712
|
||||
#include "JavaBuilder.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ F9D46EF492170960498EA1803DF22DF89
|
||||
#define BLITZ_INDEX__ Fdc76aa28fa51a1f2aee853343af491ef
|
||||
#include "ScriptBuilder.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ struct Custom : public WithCustomLayout<TopWindow> {
|
|||
|
||||
void InsertCmd(String s);
|
||||
void InsertOut(String s);
|
||||
void DoMenu(Button& b, Callback1<String> cb);
|
||||
void DoMenu(Button& b, Callback1<String> cb, bool cmd);
|
||||
void OutMenu();
|
||||
void CmdMenu();
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ void Custom::InsertOut(String s) {
|
|||
output.SetFocus();
|
||||
}
|
||||
|
||||
void Custom::DoMenu(Button& b, Callback1<String> cb) {
|
||||
void Custom::DoMenu(Button& b, Callback1<String> cb, bool cmd) {
|
||||
if(!list.IsCursor()) return;
|
||||
MenuBar menu;
|
||||
// CallbackArg<String> set;
|
||||
|
|
@ -40,30 +40,40 @@ void Custom::DoMenu(Button& b, Callback1<String> cb) {
|
|||
String ext = (String)list.Get(2);
|
||||
if(ext[0] != '.')
|
||||
ext = '.' + ext;
|
||||
String sample = SourcePath(pk, ForceExt("sample", ext));
|
||||
String samplefile = "foo/" + ForceExt("sample", ext);
|
||||
String sample = SourcePath(pk, samplefile);
|
||||
menu.Add("Input file path (like '" + UnixPath(sample) + "')", callback1(cb, "$(PATH)"));
|
||||
menu.Add("Input file package-relative path (like '" + samplefile + "')", callback1(cb, "$(RELPATH)"));
|
||||
menu.Add("Input file directory (like '" + UnixPath(GetFileFolder(sample)) + "')", callback1(cb, "$(DIR)"));
|
||||
menu.Add("Input file name (like '" + GetFileName(sample) + "')", callback1(cb, "$(FILE)"));
|
||||
menu.Add("Input file title (like '" + GetFileTitle(sample) + "')", callback1(cb, "$(TITLE)"));
|
||||
menu.Add("Input file package (like '" + pk + "')", callback1(cb, "$(PACKAGE)"));
|
||||
Vector<String> ss = SplitFlags0((String)list.Get(1));
|
||||
String opath = "f:/out/app/WIN32-ST/somefile.ext";
|
||||
menu.Add("Package output directory (like '" + UnixPath(GetFileFolder(opath)) + "')", callback1(cb, "$(OUTDIR)"));
|
||||
menu.Add("Package output path (like '" + UnixPath(opath) + "')", callback1(cb, "$(OUTPATH)"));
|
||||
menu.Add("Package output path (like '" + GetFileName(opath) + "')", callback1(cb, "$(OUTFILE)"));
|
||||
menu.Add("Package output path (like '" + GetFileTitle(opath) + "')", callback1(cb, "$(OUTTITLE)"));
|
||||
String opath = "f:/out/mypackage/WIN32-ST/somefile.ext";
|
||||
menu.Add("Package output directory (like '" + opath + "')", callback1(cb, "$(OUTDIR)"));
|
||||
opath = "f:/out/WIN32-ST/myapp.exe";
|
||||
menu.Add("Executable path (like '" + UnixPath(opath) + "')", callback1(cb, "$(EXEPATH)"));
|
||||
menu.Add("Executable directory (like '" + UnixPath(GetFileFolder(opath)) + "')", callback1(cb, "$(EXEDIR)"));
|
||||
menu.Add("Executable filename (like '" + UnixPath(GetFileName(opath)) + "')", callback1(cb, "$(EXEFILE)"));
|
||||
menu.Add("Executable title (like '" + UnixPath(GetFileTitle(opath)) + "')", callback1(cb, "$(EXETITLE)"));
|
||||
menu.Add("Semicolon separated include dirs (like '/bin/include;/cpp/inc')", callback1(cb, "$(INCLUDE)"));
|
||||
menu.Add("Prefixed include dirs (like '-inc/include -inc/cpp/inc' for '$(!-inc)')",
|
||||
callback1(cb, "$(!)"));
|
||||
menu.Add("$ character", callback1(cb, "$$"));
|
||||
if(cmd) {
|
||||
menu.Separator();
|
||||
menu.Add("copy command", callback1(cb, "cp "));
|
||||
menu.Add("chdir command", callback1(cb, "cd "));
|
||||
}
|
||||
menu.Execute(b.GetScreenRect().BottomLeft());
|
||||
}
|
||||
|
||||
void Custom::OutMenu() {
|
||||
DoMenu(outputmenu, THISBACK(InsertOut));
|
||||
DoMenu(outputmenu, THISBACK(InsertOut), false);
|
||||
}
|
||||
|
||||
void Custom::CmdMenu() {
|
||||
DoMenu(commandmenu, THISBACK(InsertCmd));
|
||||
DoMenu(commandmenu, THISBACK(InsertCmd), true);
|
||||
}
|
||||
|
||||
Custom::Custom() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue