From 4bd3e09d7809c7f1c1f49c6238198cd618c50be8 Mon Sep 17 00:00:00 2001
From: Basile Burg <basile.b@gmx.com>
Date: Thu, 6 Oct 2016 15:45:12 +0200
Subject: [PATCH] static dub options, add setting

---
 src/ce_dubproject.pas | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/ce_dubproject.pas b/src/ce_dubproject.pas
index 2fd49c51..6e7627c7 100644
--- a/src/ce_dubproject.pas
+++ b/src/ce_dubproject.pas
@@ -14,6 +14,8 @@ type
 
   TDubLinkMode = (dlmSeparate, dlmAllAtOnce, dlmSingleFile);
 
+  TDubDependencyCheck = (dcStandard, dcOffline, dcNo);
+
   (**
    * Stores the build options, always applied when a project is build
    *)
@@ -23,6 +25,7 @@ type
     fForceRebuild: boolean;
     fLinkMode: TDubLinkMode;
     fCombined: boolean;
+    fDepCheck: TDubDependencyCheck;
     fOther: string;
     procedure setLinkMode(value: TDubLinkMode);
   published
@@ -31,6 +34,7 @@ type
     property linkMode: TDubLinkMode read fLinkMode write setLinkMode;
     property combined: boolean read fCombined write fCombined;
     property other: string read fOther write fOther;
+    property dependenciesCheck: TDubDependencyCheck read fDepCheck write fDepCheck;
   public
     procedure assign(source: TPersistent); override;
     procedure getOpts(options: TStrings);
@@ -39,18 +43,18 @@ type
   (**
    * Make the build options editable
    *)
-   TCEDubBuildOptions = class(TCEDubBuildOptionsBase, ICEEditableOptions)
-   strict private
-     fBackup: TCEDubBuildOptionsBase;
-     function optionedWantCategory(): string;
-     function optionedWantEditorKind: TOptionEditorKind;
-     function optionedWantContainer: TPersistent;
-     procedure optionedEvent(event: TOptionEditorEvent);
-     function optionedOptionsModified: boolean;
-   public
-     constructor create(aOwner: TComponent); override;
-     destructor destroy; override;
-   end;
+  TCEDubBuildOptions = class(TCEDubBuildOptionsBase, ICEEditableOptions)
+  strict private
+    fBackup: TCEDubBuildOptionsBase;
+    function optionedWantCategory(): string;
+    function optionedWantEditorKind: TOptionEditorKind;
+    function optionedWantContainer: TPersistent;
+    procedure optionedEvent(event: TOptionEditorEvent);
+    function optionedOptionsModified: boolean;
+  public
+    constructor create(aOwner: TComponent); override;
+    destructor destroy; override;
+  end;
 
   TCEDubProject = class(TComponent, ICECommonProject)
   private
@@ -152,7 +156,7 @@ var
   DubCompilerFilename: string = 'dmd';
 
 const
-  DubSdlWarning = 'this feature is not available for a DUB project with the SDL format';
+  DubSdlWarning = 'this feature is deactivated in DUB projects with the SDL format';
 
 implementation
 
@@ -191,6 +195,7 @@ begin
     combined:=opts.combined;
     linkMode:=opts.linkMode;
     other:=opts.other;
+    dependenciesCheck:=opts.dependenciesCheck;
   end
   else inherited;
 end;
@@ -207,6 +212,10 @@ begin
     dlmAllAtOnce: options.Add('--build-mode=allAtOnce');
     dlmSingleFile: options.Add('--build-mode=singleFile');
   end;
+  case dependenciesCheck of
+    dcNo: options.Add('--skip-registry=all');
+    dcOffline: options.Add('--skip-registry=standard');
+  end;
   if other.isNotEmpty then
     CommandToList(other, options);
 end;