Skip to content

Commit 76e3756

Browse files
committed
- check and report invalid non-empty DMD/LDC installation folders
- mago: fix conditional breakpoints "not supported"
1 parent e079e38 commit 76e3756

File tree

5 files changed

+138
-33
lines changed

5 files changed

+138
-33
lines changed

CHANGES

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,8 @@ unreleased Version 0.50.0
11211121
* VS 16.1 Preview 2: ignore tracked files in *.delete.*.tlog as dependencies, too
11221122
* now another installer available that includes DMD and LDC
11231123
* installer no longer asks for DMD path when updating existing installation
1124-
* check for updates for Visual D, DMD and LDC, assisted download and install
1124+
* check for updates for Visual D, DMD and LDC, assisted download and install
1125+
* check and report invalid non-empty DMD/LDC installation folders
11251126
* experimental highlight references to the same symbol as the one at the caret
11261127
* VC project:
11271128
- new projects now determine Windows SDK automatically
@@ -1131,7 +1132,7 @@ unreleased Version 0.50.0
11311132
- "New item" now also allows adding D module
11321133
- new option for -extern-std=c++xx
11331134
* visualdproj:
1134-
- Error List: classify warnings and deprecations according to the repective options
1135+
- Error List: classify warnings and deprecations according to the respective options
11351136
* bugzilla 19930: visualdproj: fix building projects with "&|<>" in directory names
11361137
* dparser:
11371138
- add semantic coloring for module and package names
@@ -1143,3 +1144,4 @@ unreleased Version 0.50.0
11431144
- demangle D symbol names
11441145
- regression: use of registers in expression was lost at some point
11451146
- show class and message for exceptions that the debugger breaks on
1147+
- fix conditional breakpoints "not supported"

visuald/dpackage.d

Lines changed: 114 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ class Package : DisposingComObject,
285285
mLangsvc = addref(newCom!LanguageService(this));
286286
mProjFactory = addref(newCom!ProjectFactory(this));
287287
mLibInfos = new LibraryInfos();
288+
mCheckMessages = new UpdateMessages();
288289
}
289290

290291
~this()
@@ -675,7 +676,7 @@ version(none)
675676
}
676677
if(nCmdID == CmdShowLangPage)
677678
{
678-
openSettingsPage("002A2DE9-8BB6-484D-9823-7E4AD4084715");
679+
openSettingsPage(g_IntellisensePropertyPage);
679680
return S_OK;
680681
}
681682
if(nCmdID == CmdShowWebsite)
@@ -699,6 +700,48 @@ version(none)
699700
{
700701
auto opts = GetGlobalOptions();
701702

703+
enum Result { kNotSet, kBinaryExists, kBinaryMissing }
704+
Result checkInstalledBinary(CheckProduct prod)
705+
{
706+
string exe;
707+
switch(prod)
708+
{
709+
case CheckProduct.DMD:
710+
exe = opts.DMD.getCompilerPath(opts.DMD.InstallDir);
711+
break;
712+
case CheckProduct.GDC:
713+
exe = opts.GDC.getCompilerPath(opts.GDC.InstallDir);
714+
break;
715+
case CheckProduct.LDC:
716+
exe = opts.LDC.getCompilerPath(opts.LDC.InstallDir);
717+
break;
718+
default:
719+
return Result.kNotSet;
720+
}
721+
if (exe.empty)
722+
return Result.kNotSet;
723+
if (std.file.exists(exe))
724+
return Result.kBinaryExists;
725+
return Result.kBinaryMissing;
726+
}
727+
728+
void showMissingBinaryInfo(CheckProduct prod)
729+
{
730+
switch(prod)
731+
{
732+
case CheckProduct.DMD:
733+
mCheckMessages.addMessage("Visual D: DMD installation directory invalid", "Goto DMD Setup Page",
734+
(int) { openSettingsPage(g_DmdDirPropertyPage); return true; });
735+
break;
736+
case CheckProduct.LDC:
737+
mCheckMessages.addMessage("Visual D: LDC installation directory invalid", "Goto LDC Setup Page",
738+
(int) { openSettingsPage(g_LdcDirPropertyPage); return true; });
739+
break;
740+
default:
741+
break;
742+
}
743+
}
744+
702745
string getInstalledVersion(CheckProduct prod)
703746
{
704747
switch(prod)
@@ -716,17 +759,31 @@ version(none)
716759

717760
string checkProduct(CheckProduct prod, ubyte freq)
718761
{
762+
if (prod != CheckProduct.VisualD)
763+
{
764+
auto res = checkInstalledBinary(prod);
765+
if (res == Result.kNotSet)
766+
return null;
767+
768+
if (res == Result.kBinaryMissing)
769+
{
770+
showMissingBinaryInfo(prod);
771+
return null;
772+
}
773+
}
774+
719775
CheckFrequency frequency = cast(CheckFrequency)freq;
720-
if (frequency != CheckFrequency.Never)
721-
if (auto info = checkForUpdate(prod, toDuration(frequency), frequency))
722-
if (info.updated)
723-
{
724-
string ver = getInstalledVersion(prod);
725-
if (extractVersion(ver) >= extractVersion(info.name))
726-
return null;
727-
return info.name;
728-
}
729-
return null;
776+
if (frequency == CheckFrequency.Never)
777+
return null;
778+
779+
auto info = checkForUpdate(prod, toDuration(frequency), frequency);
780+
if (!info || !info.updated)
781+
return null;
782+
783+
string ver = getInstalledVersion(prod);
784+
if (extractVersion(ver) >= extractVersion(info.name))
785+
return null;
786+
return info.name;
730787
}
731788

732789
string[3] msgs;
@@ -745,30 +802,27 @@ version(none)
745802
cnt++;
746803
}
747804

748-
if (cnt == 1)
749-
mUpdateCheckMessage = "New update available: " ~ message;
805+
if (cnt > 1)
806+
message = "Visual D: New update available: " ~ message;
750807
else if (cnt > 1)
751-
mUpdateCheckMessage = "New updates available: " ~ message;
752-
else
753-
mUpdateCheckMessage = null;
808+
message = "Visual D: New updates available: " ~ message;
809+
810+
if (message)
811+
mCheckMessages.addMessage(message, "Goto Update Page",
812+
(int) { openSettingsPage(g_UpdatePropertyPage); return true; });
754813
}
755814

756815
void idleCheckUpdates()
757816
{
758-
if (!mHasMadeUpdateCheck &&
759-
(GetGlobalOptions().checkUpdatesVisualD != CheckFrequency.Never ||
760-
GetGlobalOptions().checkUpdatesDMD != CheckFrequency.Never ||
761-
GetGlobalOptions().checkUpdatesLDC != CheckFrequency.Never))
817+
if (!mHasMadeUpdateCheck)
762818
{
763819
import core.thread;
764820
mHasMadeUpdateCheck = true;
765821
new Thread(&checkUpdates).start();
766822
}
767-
else if (mUpdateCheckMessage)
823+
else if (mCheckMessages.hasMessages())
768824
{
769-
showInfoBar(mUpdateCheckMessage, "Goto Update Page",
770-
(int) { openSettingsPage("002A2DE9-8BB6-484D-9829-7E4AD4084715"); return true; });
771-
mUpdateCheckMessage = null;
825+
mCheckMessages.showMessages();
772826
}
773827

774828
if (mSaveOptionsInIdle)
@@ -1295,9 +1349,42 @@ private:
12951349
Library mLibrary;
12961350
bool mWantsUpdateLibInfos;
12971351

1352+
bool mHasMadePatchCheck;
12981353
bool mHasMadeUpdateCheck;
12991354
bool mSaveOptionsInIdle;
1300-
string mUpdateCheckMessage;
1355+
UpdateMessages mCheckMessages;
1356+
}
1357+
1358+
class UpdateMessages
1359+
{
1360+
static struct UpdateMessage
1361+
{
1362+
string message;
1363+
string action;
1364+
bool delegate(int) callback;
1365+
}
1366+
1367+
UpdateMessage[] messages;
1368+
1369+
void addMessage(string msg, string action, bool delegate(int) callback)
1370+
{
1371+
synchronized(this)
1372+
messages ~= UpdateMessage(msg, action, callback);
1373+
}
1374+
bool hasMessages() const
1375+
{
1376+
return messages.length > 0;
1377+
}
1378+
1379+
void showMessages()
1380+
{
1381+
synchronized(this)
1382+
{
1383+
foreach(m; messages)
1384+
showInfoBar(m.message, m.action, m.callback);
1385+
messages = null;
1386+
}
1387+
}
13011388
}
13021389

13031390
struct CompilerDirectories
@@ -1346,6 +1433,8 @@ struct CompilerDirectories
13461433
}
13471434
string getCompilerPath(string instdir)
13481435
{
1436+
if (instdir.empty)
1437+
return null;
13491438
string exe;
13501439
if (compiler == Compiler.DMD)
13511440
{

visuald/pkgutil.d

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,15 @@ IVsOutputWindowPane getBuildOutputPane()
8888
return pane;
8989
}
9090

91-
void openSettingsPage(string pageGuid)
91+
void openSettingsPage(in GUID clsid)
9292
{
9393
auto pIVsUIShell = ComPtr!(IVsUIShell)(queryService!(IVsUIShell), false);
94+
if (!pIVsUIShell)
95+
return;
96+
wstring pageGuid = GUID2wstring(clsid);
9497
VARIANT var;
9598
var.vt = VT_BSTR;
96-
var.bstrVal = allocBSTR(pageGuid);
99+
var.bstrVal = allocwBSTR(pageGuid);
97100
pIVsUIShell.PostExecCommand(&CMDSETID_StandardCommandSet97, cmdidToolsOptions, OLECMDEXECOPT_DODEFAULT, &var);
98101
freeBSTR(var.bstrVal);
99102
}

visuald/register.d

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,18 @@ HRESULT registerMago(in wchar* pszRegRoot, in bool useRanu)
821821
wstring languageGuid = GUID2wstring(g_languageCLSID);
822822
wstring vendorGuid = GUID2wstring(g_vendorCLSID);
823823

824-
scope RegKey keyEE = new RegKey(keyRoot, registrationRoot ~ "\\AD7Metrics\\ExpressionEvaluator\\"w ~ languageGuid ~ "\\"w ~ vendorGuid);
824+
wstring eeKeyStr = registrationRoot ~ "\\AD7Metrics\\ExpressionEvaluator\\"w ~ languageGuid ~ "\\"w ~ vendorGuid;
825+
scope RegKey keyEE = new RegKey(keyRoot, eeKeyStr);
825826
keyEE.Set("Language"w, "D"w);
826827
keyEE.Set("Name"w, "D"w);
827828

829+
// needed to avoid "D does not support conditional breakpoints", see
830+
// https://github.com/Microsoft/ConcordExtensibilitySamples/issues/18
831+
scope RegKey keyEEEngine = new RegKey(keyRoot, eeKeyStr ~ "\\Engine"w);
832+
keyEE.Set("0"w, "{449EC4CC-30D2-4032-9256-EE18EB41B62B}"w); // COMPlusOnlyEng
833+
keyEE.Set("1"w, "{92EF0900-2251-11D2-B72E-0000F87572EF}"w); // COMPlusNativeEng
834+
keyEE.Set("2"w, "{3B476D35-A401-11D2-AAD4-00C04F990171}"w); // NativeOnlyEng
835+
828836
scope RegKey keyCV = new RegKey(keyRoot, registrationRoot ~ "\\Debugger\\CodeView Compilers\\68:*"w);
829837
keyEE.Set("LanguageID"w, languageGuid);
830838
keyEE.Set("VendorID"w, vendorGuid);

visuald/updates.d

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum CheckProduct
4747
VisualD,
4848
DMD,
4949
LDC,
50+
GDC,
5051
}
5152

5253
struct UpdateInfo
@@ -410,9 +411,11 @@ VersionInfo extractVersion(string verstr)
410411
try
411412
{
412413
__gshared static Regex!char re;
413-
if(re.empty)
414-
re = regex(`([0-9]+)\.([0-9]+)(\.([0-9]+))?([-\.]?([abr])?[a-z]*[-\.]?([0-9]*))?`);
415-
414+
synchronized
415+
{
416+
if (re.empty)
417+
re = regex(`([0-9]+)\.([0-9]+)(\.([0-9]+))?([-\.]?([abr])?[a-z]*[-\.]?([0-9]*))?`);
418+
}
416419
auto rematch = match(verstr, re);
417420
if (!rematch.empty)
418421
{

0 commit comments

Comments
 (0)