diff --git a/src/dlangide/builders/builder.d b/src/dlangide/builders/builder.d index 8702ac4..9d82a64 100644 --- a/src/dlangide/builders/builder.d +++ b/src/dlangide/builders/builder.d @@ -91,6 +91,14 @@ class Builder : BackgroundOperationWatcher { } else if (_buildOp == BuildOperation.Upgrade) { params ~= "upgrade".dup; params ~= "--force-remove".dup; + import std.path; + import std.file; + string projectFile = project.filename; + string selectionsFile = projectFile.stripExtension ~ ".selections.json"; + if (selectionsFile.exists && selectionsFile.isFile) { + Log.i("Removing file ", selectionsFile); + remove(selectionsFile); + } } if (_buildOp != BuildOperation.Clean && _buildOp != BuildOperation.Upgrade) { diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 2383152..19ae0f6 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1246,6 +1246,10 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL } } + void refreshProject(Project project) { + // TODO + } + void buildProject(BuildOperation buildOp, Project project, BuildResultListener listener = null) { if (!currentWorkspace) { _logPanel.logLine("No workspace is opened"); @@ -1257,6 +1261,16 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL _logPanel.logLine("No project is opened"); return; } + if (!listener) { + if (buildOp == BuildOperation.Upgrade || buildOp == BuildOperation.Build || buildOp == BuildOperation.Rebuild) { + listener = delegate(int result) { + if (!result) { + // success: update workspace + refreshProject(project); + } + }; + } + } ProjectSettings projectSettings = project.settings; string toolchain = projectSettings.getToolchain(_settings); string arch = projectSettings.getArch(_settings); diff --git a/src/dlangide/workspace/project.d b/src/dlangide/workspace/project.d index 429749c..47884e3 100644 --- a/src/dlangide/workspace/project.d +++ b/src/dlangide/workspace/project.d @@ -704,6 +704,13 @@ class DubPackageFinder { fn = buildNormalizedPath(pathName, "package.json"); if (fn.exists && fn.isFile) return fn; + // new DUB support - with package subdirectory + fn = buildNormalizedPath(pathName, packageName, "dub.json"); + if (fn.exists && fn.isFile) + return fn; + fn = buildNormalizedPath(pathName, packageName, "package.json"); + if (fn.exists && fn.isFile) + return fn; } return null; }