ide: 'Disable UHD mode' run option

git-svn-id: svn://ultimatepp.org/upp/trunk@12256 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-09-07 07:10:23 +00:00
parent 68a4f69269
commit ea02579b4d
11 changed files with 31 additions and 21 deletions

View file

@ -829,6 +829,8 @@ void Ctrl::SetUHDEnabled(bool set)
bool Ctrl::IsUHDEnabled()
{
if(GetEnv("UPP_DISABLE_UHD__") == "1")
return false;
return ApplicationUHDEnabled;
}

View file

@ -47,7 +47,7 @@ void Ide::BeginBuilding(bool sync_files, bool clear_console)
if(clear_console)
console.Clear();
build_time = GetTickCount();
CreateHost(sync_files);
CreateHost(sync_files, disable_uhd);
cmdout.Clear();
}
@ -56,7 +56,7 @@ void Ide::EndBuilding(bool ok)
console.EndGroup();
console.Wait();
Vector<String> errors = console.PickErrors();
CreateHost(false)->DeleteFile(errors);
CreateHost(false, disable_uhd)->DeleteFile(errors);
if(!errors.IsEmpty())
ok = false;
PutConsole("");
@ -183,7 +183,7 @@ void Ide::Preprocess(bool asmout) {
const Workspace& wspc = IdeWorkspace();
if(pi >= wspc.GetCount())
return;
One<Host> host = CreateHost(true);
One<Host> host = CreateHost(true, disable_uhd);
One<Builder> b = CreateBuilder(~host);
Vector<String> linkfile;
String linkopt;

View file

@ -89,7 +89,7 @@ String NoCr(const char *s)
return out;
}
One<Host> MakeBuild::CreateHost(bool sync_files)
One<Host> MakeBuild::CreateHost(bool sync_files, bool disable_uhd)
{
SetupDefaultMethod();
VectorMap<String, String> bm = GetMethodVars(method);
@ -101,6 +101,8 @@ One<Host> MakeBuild::CreateHost(bool sync_files)
env.GetAdd("PATH") = Join(host.exedirs, ";");
env.GetAdd("UPP_MAIN__") = GetFileDirectory(PackagePath(GetMain()));
env.GetAdd("UPP_ASSEMBLY__") = GetVar("UPP");
if(disable_uhd)
env.GetAdd("UPP_DISABLE_UHD__") = "1";
// setup LD_LIBRARY_PATH on target dir, needed for all shared builds on posix
#ifdef PLATFORM_POSIX
@ -295,7 +297,7 @@ bool MakeBuild::BuildPackage(const Workspace& wspc, int pkindex, int pknumber, i
ConsoleShow();
return false;
}
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, false);
if(!IsNull(onefile)) {
OneFileHost *h = new OneFileHost;
h->host = pick(host);
@ -466,7 +468,7 @@ bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, b
if(main_conf.GetCount()) {
VectorMap<String, String> bm = GetMethodVars(method);
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, false);
One<Builder> b = CreateBuilder(~host);
if(b) {
Index<String> mcfg = PackageConfig(wspc, 0, bm, mainparam, *host, *b, NULL);
@ -551,7 +553,7 @@ bool MakeBuild::Build()
ConsoleShow();
return false;
}
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, false);
One<Builder> builder = CreateBuilder(~host);
if(!builder)
return false;
@ -565,7 +567,7 @@ bool MakeBuild::Build()
void MakeBuild::CleanPackage(const Workspace& wspc, int package)
{
PutConsole(NFormat("Cleaning %s", wspc[package]));
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, false);
One<Builder> builder = CreateBuilder(~host);
if(!builder)
return;
@ -581,7 +583,7 @@ void MakeBuild::Clean()
{
ConsoleClear();
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, false);
One<Builder> builder = CreateBuilder(~host);
if(!builder)
return;
@ -607,7 +609,7 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
BeginBuilding(false, true);
VectorMap<String, String> bm = GetMethodVars(method);
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, false);
One<Builder> b = CreateBuilder(~host);
if(!b)

View file

@ -69,7 +69,7 @@ public:
Index<String> PackageConfig(const Workspace& wspc, int package, const VectorMap<String, String>& bm,
String mainparam, Host& host, Builder& b, String *target = NULL);
// bool SyncHostFiles(RemoteHost& host);
One<Host> CreateHost(bool sync_files);
One<Host> CreateHost(bool sync_files, bool disable_uhd);
One<Builder> CreateBuilder(Host *host);
String OutDir(const Index<String>& cfg, const String& package,
const VectorMap<String, String>& bm, bool use_target = false);

View file

@ -4,7 +4,7 @@
void Ide::SerializeWorkspace(Stream& s) {
int i;
int version = 16;
int version = 17;
s / version;
s.Magic(0x12354);
if(s.IsStoring()) {
@ -57,6 +57,8 @@ void Ide::SerializeWorkspace(Stream& s) {
s % consolemode;
if(version >= 14)
s % console_utf8;
if(version >= 17)
s % disable_uhd;
s % editfile;
for(i = 0; i < 10; i++)
s % bookmark[i];

View file

@ -36,6 +36,7 @@ void Ide::RunArgs() {
dlg.consolemode = consolemode;
dlg.utf8 <<= console_utf8;
dlg.runmode <<= dlg.Breaker(222);
dlg.disable_uhd <<= disable_uhd;
for(;;) {
bool b = ~dlg.runmode == RUN_FILE;
@ -53,6 +54,7 @@ void Ide::RunArgs() {
consolemode = dlg.consolemode;
console_utf8 = ~dlg.utf8;
stdout_file = ~dlg.stdout_file;
disable_uhd = ~dlg.disable_uhd;
dlg.arg.AddHistory();
{
StringStream ss;
@ -74,7 +76,7 @@ void Ide::RunArgs() {
One<Host> Ide::CreateHostRunDir()
{
One<Host> h = CreateHost(false);
One<Host> h = CreateHost(false, disable_uhd);
if(IsNull(rundir))
h->ChDir(GetFileFolder(target));
else
@ -212,7 +214,7 @@ void Ide::ExecuteApk()
if(!select.GetDeviceCount())
return;
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, disable_uhd);
Apk apk(target, sdk);
String packageName = apk.FindPackageName();
String activityName = apk.FindLaunchableActivity();
@ -401,7 +403,7 @@ void Ide::ConditionalBreak()
brk = "1";
Index<String> cfg = PackageConfig(IdeWorkspace(), 0, GetMethodVars(method), mainconfigparam,
*CreateHost(true), *CreateBuilder(~CreateHostRunDir()));
*CreateHost(true, disable_uhd), *CreateBuilder(~CreateHostRunDir()));
#ifdef PLATFORM_WIN32
if(cfg.Find("MSC") >= 0) {
if(EditPDBExpression("Conditional breakpoint", brk, NULL))

View file

@ -208,7 +208,7 @@ void Ide::FindPrevError() {
return;
int ln = console.GetLine(console.GetCursor());
int l = ln;
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, disable_uhd);
for(l = ln - 2; l >= 0; l--)
if(FindLineError(l)) return;
for(l = console.GetLineCount() - 1; l > ln; l--)

View file

@ -314,7 +314,7 @@ void OutMode::CmdOptions()
PromptOK("Invalid build method");
return;
}
One<Host> host = ide.CreateHost(false);
One<Host> host = ide.CreateHost(false, false);
One<Builder> b = ide.CreateBuilder(~host);
const String& p = wspc[pi];
String output = NativePath(ide.OutDir(ide.PackageConfig(wspc, pi, bm, ~config, *host, *b), p, bm, true));

View file

@ -545,6 +545,7 @@ public:
bool runexternal;
bool console_utf8;
int consolemode;
bool disable_uhd;
String stdout_file;
String recent_stdout_file;

View file

@ -56,7 +56,8 @@ LAYOUT(RunLayout, 560, 176)
ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(8, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24))
ITEM(Label, console_lable, SetLabel(t_("Open console:")).LeftPosZ(4, 112).TopPosZ(120, 20))
ITEM(Option, utf8, SetLabel(t_("Output is UTF-8")).LeftPosZ(328, 104).TopPosZ(76, 20))
ITEM(Option, utf8, SetLabel(t_("Output is UTF-8")).LeftPosZ(320, 104).TopPosZ(76, 20))
ITEM(Option, disable_uhd, SetLabel(t_("Disable UHD mode")).LeftPosZ(432, 120).TopPosZ(76, 20))
END_LAYOUT
LAYOUT(FindInFilesLayout, 568, 152)

View file

@ -552,18 +552,18 @@ void Ide::RemoveDs()
void Ide::LaunchAndroidSDKManager(const AndroidSDK& androidSDK)
{
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, disable_uhd);
IGNORE_RESULT(host->Execute(androidSDK.GetLauchSDKManagerCmd()));
}
void Ide::LaunchAndroidAVDManager(const AndroidSDK& androidSDK)
{
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, disable_uhd);
IGNORE_RESULT(host->Execute(androidSDK.GetLauchAVDManagerCmd()));
}
void Ide::LauchAndroidDeviceMonitor(const AndroidSDK& androidSDK)
{
One<Host> host = CreateHost(false);
One<Host> host = CreateHost(false, disable_uhd);
IGNORE_RESULT(host->Execute(androidSDK.MonitorPath()));
}