From 5ba4a7bffa4e820de26804bb21f51286b6cb81e2 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sat, 8 Jul 2017 03:28:08 +0200 Subject: [PATCH 01/11] Add check for asserts without an explantory message --- README.md | 1 + src/analysis/assert_without_msg.d | 68 +++++++++++++++++++++++++++++++ src/analysis/config.d | 3 ++ src/analysis/run.d | 5 +++ 4 files changed, 77 insertions(+) create mode 100644 src/analysis/assert_without_msg.d diff --git a/README.md b/README.md index ac69b98..7e7b9ae 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ Note that the "--skipTests" option is the equivalent of changing each * Allman brace style * Redundant visibility attributes * Public declarations without a documented unittest. By default disabled. +* Asserts without an explanatory message. By default disabled. #### Wishlist diff --git a/src/analysis/assert_without_msg.d b/src/analysis/assert_without_msg.d new file mode 100644 index 0000000..5a69a37 --- /dev/null +++ b/src/analysis/assert_without_msg.d @@ -0,0 +1,68 @@ +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +module analysis.assert_without_msg; + +import analysis.base : BaseAnalyzer; +import dsymbol.scope_ : Scope; +import dparse.lexer; +import dparse.ast; + +import std.stdio; + +/** + * Check that all asserts have an explanatory message. + */ +class AssertWithoutMessageCheck : BaseAnalyzer +{ + enum string KEY = "dscanner.style.assert_without_msg"; + enum string MESSAGE = "An assert should have an explanatory message"; + + /// + this(string fileName, const(Scope)* sc, bool skipTests = false) + { + super(fileName, sc, skipTests); + } + + override void visit(const AssertExpression expr) + { + if (expr.message is null) + addErrorMessage(expr.line, expr.column, KEY, MESSAGE); + } + + alias visit = BaseAnalyzer.visit; + +} + +unittest +{ + import std.stdio : stderr; + import std.format : format; + import analysis.config : StaticAnalysisConfig, Check, disabledConfig; + import analysis.helpers : assertAnalyzerWarnings; + + StaticAnalysisConfig sac = disabledConfig(); + sac.assert_without_msg = Check.enabled; + + assertAnalyzerWarnings(q{ + unittest { + assert(0, "foo bar"); + assert(0); // [warn]: %s + } + }c.format( + AssertWithoutMessageCheck.MESSAGE, + ), sac); + + assertAnalyzerWarnings(q{ + unittest { + static assert(0, "foo bar"); + static assert(0); // [warn]: %s + } + }c.format( + AssertWithoutMessageCheck.MESSAGE, + ), sac); + + + stderr.writeln("Unittest for AssertWithoutMessageCheck passed."); +} diff --git a/src/analysis/config.d b/src/analysis/config.d index 1966e98..ebf811b 100644 --- a/src/analysis/config.d +++ b/src/analysis/config.d @@ -189,6 +189,9 @@ struct StaticAnalysisConfig @INI("Check public declarations without a documented unittest") string has_public_example = Check.disabled; + @INI("Check for asserts without an explanatory message") + string assert_without_msg = Check.disabled; + @INI("Module-specific filters") ModuleFilters filters; } diff --git a/src/analysis/run.d b/src/analysis/run.d index 16f7e67..847da2f 100644 --- a/src/analysis/run.d +++ b/src/analysis/run.d @@ -69,6 +69,7 @@ import analysis.useless_initializer; import analysis.allman; import analysis.redundant_attributes; import analysis.has_public_example; +import analysis.assert_without_msg; import dsymbol.string_interning : internString; import dsymbol.scope_; @@ -481,6 +482,10 @@ MessageSet analyze(string fileName, const Module m, const StaticAnalysisConfig a checks ~= new HasPublicExampleCheck(fileName, moduleScope, analysisConfig.has_public_example == Check.skipTests && !ut); + if (moduleName.shouldRun!"assert_without_msg"(analysisConfig)) + checks ~= new AssertWithoutMessageCheck(fileName, moduleScope, + analysisConfig.assert_without_msg == Check.skipTests && !ut); + version (none) if (moduleName.shouldRun!"redundant_if_check"(analysisConfig)) checks ~= new IfStatementCheck(fileName, moduleScope, From 8304e8540c0cc2711500fad2e8813327be0b400e Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sat, 8 Jul 2017 09:58:04 +0200 Subject: [PATCH 02/11] assert_without_msg: Check for std.exception.enforce --- src/analysis/assert_without_msg.d | 87 +++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/src/analysis/assert_without_msg.d b/src/analysis/assert_without_msg.d index 5a69a37..7e43e31 100644 --- a/src/analysis/assert_without_msg.d +++ b/src/analysis/assert_without_msg.d @@ -10,6 +10,7 @@ import dparse.lexer; import dparse.ast; import std.stdio; +import std.algorithm; /** * Check that all asserts have an explanatory message. @@ -31,8 +32,60 @@ class AssertWithoutMessageCheck : BaseAnalyzer addErrorMessage(expr.line, expr.column, KEY, MESSAGE); } + override void visit(const FunctionCallExpression expr) + { + if (!isStdExceptionImported) + return; + + if (expr.unaryExpression !is null && + expr.unaryExpression.primaryExpression !is null && + expr.unaryExpression.primaryExpression.identifierOrTemplateInstance !is null) + { + auto ident = expr.unaryExpression.primaryExpression.identifierOrTemplateInstance.identifier; + if (ident.text == "enforce" && expr.arguments !is null && expr.arguments.argumentList !is null && + expr.arguments.argumentList.items.length < 2) + addErrorMessage(ident.line, ident.column, KEY, MESSAGE); + } + } + + override void visit(const SingleImport sImport) + { + static immutable stdException = ["std", "exception"]; + if (sImport.identifierChain.identifiers.map!(a => a.text).equal(stdException)) + isStdExceptionImported = true; + } + + // revert the stack after new scopes + override void visit(const Declaration decl) + { + // be careful - ImportDeclarations don't introduce a new scope + if (decl.importDeclaration is null) + { + bool tmp = isStdExceptionImported; + scope(exit) isStdExceptionImported = tmp; + decl.accept(this); + } + else + decl.accept(this); + } + + mixin ScopedVisit!IfStatement; + mixin ScopedVisit!BlockStatement; + alias visit = BaseAnalyzer.visit; +private: + bool isStdExceptionImported; + + template ScopedVisit(NodeType) + { + override void visit(const NodeType n) + { + bool tmp = isStdExceptionImported; + scope(exit) isStdExceptionImported = tmp; + n.accept(this); + } + } } unittest @@ -63,6 +116,40 @@ unittest AssertWithoutMessageCheck.MESSAGE, ), sac); + // check for std.exception.enforce + assertAnalyzerWarnings(q{ + unittest { + enforce(0); // std.exception not imported yet - could be a user-defined symbol + import std.exception; + enforce(0, "foo bar"); + enforce(0); // [warn]: %s + } + }c.format( + AssertWithoutMessageCheck.MESSAGE, + ), sac); + + // check for std.exception.enforce + assertAnalyzerWarnings(q{ + unittest { + import exception; + class C { + import std.exception; + } + enforce(0); // std.exception not imported yet - could be a user-defined symbol + struct S { + import std.exception; + } + enforce(0); // std.exception not imported yet - could be a user-defined symbol + if (false) { + import std.exception; + } + enforce(0); // std.exception not imported yet - could be a user-defined symbol + { + import std.exception; + } + enforce(0); // std.exception not imported yet - could be a user-defined symbol + } + }c, sac); stderr.writeln("Unittest for AssertWithoutMessageCheck passed."); } From f1e337c222164ea50cad56f6a29b198620081fd3 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sat, 10 Jun 2017 18:10:44 +0200 Subject: [PATCH 03/11] Enable testing on Windows with AppVeyor --- appveyor.yml | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++ build.bat | 91 +++++++++++++++++++------------------ 2 files changed, 170 insertions(+), 44 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..8a2469b --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,123 @@ +platform: x64 +environment: + matrix: + - DC: dmd + DVersion: nightly + arch: x64 + - DC: dmd + DVersion: nightly + arch: x86 + - DC: dmd + DVersion: beta + arch: x64 + - DC: dmd + DVersion: beta + arch: x86 + - DC: dmd + DVersion: stable + arch: x64 + - DC: dmd + DVersion: stable + arch: x86 + - DC: ldc + DVersion: beta + arch: x86 + - DC: ldc + DVersion: beta + arch: x64 + - DC: ldc + DVersion: stable + arch: x86 + - DC: ldc + DVersion: stable + arch: x64 + +skip_tags: false +branches: + only: + - master + +install: + - ps: function ResolveLatestDMD + { + $version = $env:DVersion; + if($version -eq "stable") { + $latest = (Invoke-WebRequest "http://downloads.dlang.org/releases/LATEST").toString(); + $url = "http://downloads.dlang.org/releases/2.x/$($latest)/dmd.$($latest).windows.7z"; + }elseif($version -eq "beta") { + $latest = (Invoke-WebRequest "http://downloads.dlang.org/pre-releases/LATEST").toString(); + $latestVersion = $latest.split("-")[0].split("~")[0]; + $url = "http://downloads.dlang.org/pre-releases/2.x/$($latestVersion)/dmd.$($latest).windows.7z"; + }elseif($version -eq "nightly") { + $url = "http://nightlies.dlang.org/dmd-master-2017-05-20/dmd.master.windows.7z" + }else { + $url = "http://downloads.dlang.org/releases/2.x/$($version)/dmd.$($version).windows.7z"; + } + $env:PATH += ";C:\dmd2\windows\bin;"; + return $url; + } + - ps: function ResolveLatestLDC + { + $version = $env:DVersion; + if($version -eq "stable") { + $latest = (Invoke-WebRequest "https://ldc-developers.github.io/LATEST").toString().replace("`n","").replace("`r",""); + $url = "https://github.com/ldc-developers/ldc/releases/download/v$($latest)/ldc2-$($latest)-win64-msvc.zip"; + }elseif($version -eq "beta") { + $latest = (Invoke-WebRequest "https://ldc-developers.github.io/LATEST_BETA").toString().replace("`n","").replace("`r",""); + $url = "https://github.com/ldc-developers/ldc/releases/download/v$($latest)/ldc2-$($latest)-win64-msvc.zip"; + } else { + $latest = $version; + $url = "https://github.com/ldc-developers/ldc/releases/download/v$($version)/ldc2-$($version)-win64-msvc.zip"; + } + $env:PATH += ";C:\ldc2-$($latest)-win64-msvc\bin"; + $env:DC = "ldc2"; + return $url; + } + - ps: function SetUpDCompiler + { + $env:toolchain = "msvc"; + if($env:DC -eq "dmd"){ + echo "downloading ..."; + $url = ResolveLatestDMD; + echo $url; + Invoke-WebRequest $url -OutFile "c:\dmd.7z"; + echo "finished."; + pushd c:\\; + 7z x dmd.7z > $null; + popd; + } + elseif($env:DC -eq "ldc"){ + echo "downloading ..."; + $url = ResolveLatestLDC; + echo $url; + Invoke-WebRequest $url -OutFile "c:\ldc.zip"; + echo "finished."; + pushd c:\\; + 7z x ldc.zip > $null; + popd; + } + } + - ps: SetUpDCompiler + +build_script: + - ps: if($env:arch -eq "x86"){ + $env:compilersetupargs = "x86"; + $env:Darch = "x86"; + $env:DConf = "m32"; + }elseif($env:arch -eq "x64"){ + $env:compilersetupargs = "amd64"; + $env:Darch = "x86_64"; + $env:DConf = "m64"; + } + - ps: $env:compilersetup = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall"; + - '"%compilersetup%" %compilersetupargs%' + +test_script: + - echo %PLATFORM% + - echo %Darch% + - echo %DC% + - echo %PATH% + - '%DC% --version' + - dub test --arch=%Darch% --compiler=%DC% + - git submodule update --init --recursive + - build.bat test diff --git a/build.bat b/build.bat index 04a988b..51cdf16 100644 --- a/build.bat +++ b/build.bat @@ -1,44 +1,47 @@ -@echo off -setlocal enabledelayedexpansion - -set DFLAGS=-O -release -inline -version=StdLoggerDisableWarning -set TESTFLAGS=-g -w -version=StdLoggerDisableWarning -set CORE= -set LIBDPARSE= -set STD= -set ANALYSIS= -set INIFILED= -set DSYMBOL= -set CONTAINERS= -set LIBDDOC= - -for %%x in (src\*.d) do set CORE=!CORE! %%x -for %%x in (src\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x -for %%x in (libdparse\src\dparse\*.d) do set LIBDPARSE=!LIBDPARSE! %%x -for %%x in (libdparse\src\std\experimental\*.d) do set LIBDPARSE=!LIBDPARSE! %%x -for %%x in (libddoc\src\ddoc\*.d) do set LIBDDOC=!LIBDDOC! %%x -for %%x in (inifiled\source\*.d) do set INIFILED=!INIFILED! %%x -for %%x in (dsymbol\src\dsymbol\*.d) do set DSYMBOL=!DSYMBOL! %%x -for %%x in (dsymbol\src\dsymbol\builtin\*.d) do set DSYMBOL=!DSYMBOL! %%x -for %%x in (dsymbol\src\dsymbol\conversion\*.d) do set DSYMBOL=!DSYMBOL! %%x -for %%x in (containers\src\containers\*.d) do set CONTAINERS=!CONTAINERS! %%x -for %%x in (containers\src\containers\internal\*.d) do set CONTAINERS=!CONTAINERS! %%x - -if "%1" == "test" goto test_cmd - -@echo on -dmd %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -ofbin\dscanner.exe -goto eof - -:test_cmd -@echo on -set TESTNAME="bin\dscanner-unittest" -dmd %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -lib %TESTFLAGS% -of%TESTNAME%.lib -if exist %TESTNAME%.lib dmd %CORE% %ANALYSIS% %TESTNAME%.lib -I"src" -I"inifiled\source" -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -unittest %TESTFLAGS% -of%TESTNAME%.exe -if exist %TESTNAME%.exe %TESTNAME%.exe - -if exist %TESTNAME%.obj del %TESTNAME%.obj -if exist %TESTNAME%.lib del %TESTNAME%.lib -if exist %TESTNAME%.exe del %TESTNAME%.exe - -:eof +@echo off +setlocal enabledelayedexpansion + +IF "%DC%"=="" SET DC="dmd" +IF "%DC%"=="ldc2" SET DC="ldmd2" + +set DFLAGS=-O -release -inline -version=StdLoggerDisableWarning +set TESTFLAGS=-g -w -version=StdLoggerDisableWarning +set CORE= +set LIBDPARSE= +set STD= +set ANALYSIS= +set INIFILED= +set DSYMBOL= +set CONTAINERS= +set LIBDDOC= + +for %%x in (src\*.d) do set CORE=!CORE! %%x +for %%x in (src\analysis\*.d) do set ANALYSIS=!ANALYSIS! %%x +for %%x in (libdparse\src\dparse\*.d) do set LIBDPARSE=!LIBDPARSE! %%x +for %%x in (libdparse\src\std\experimental\*.d) do set LIBDPARSE=!LIBDPARSE! %%x +for %%x in (libddoc\src\ddoc\*.d) do set LIBDDOC=!LIBDDOC! %%x +for %%x in (inifiled\source\*.d) do set INIFILED=!INIFILED! %%x +for %%x in (dsymbol\src\dsymbol\*.d) do set DSYMBOL=!DSYMBOL! %%x +for %%x in (dsymbol\src\dsymbol\builtin\*.d) do set DSYMBOL=!DSYMBOL! %%x +for %%x in (dsymbol\src\dsymbol\conversion\*.d) do set DSYMBOL=!DSYMBOL! %%x +for %%x in (containers\src\containers\*.d) do set CONTAINERS=!CONTAINERS! %%x +for %%x in (containers\src\containers\internal\*.d) do set CONTAINERS=!CONTAINERS! %%x + +if "%1" == "test" goto test_cmd + +@echo on +%DC% %CORE% %STD% %LIBDPARSE% %LIBDDOC% %ANALYSIS% %INIFILED% %DSYMBOL% %CONTAINERS% %DFLAGS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -ofbin\dscanner.exe +goto eof + +:test_cmd +@echo on +set TESTNAME="bin\dscanner-unittest" +%DC% %STD% %LIBDPARSE% %LIBDDOC% %INIFILED% %DSYMBOL% %CONTAINERS% -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -lib %TESTFLAGS% -of%TESTNAME%.lib +if exist %TESTNAME%.lib %DC% %CORE% %ANALYSIS% %TESTNAME%.lib -I"src" -I"inifiled\source" -I"libdparse\src" -I"dsymbol\src" -I"containers\src" -I"libddoc\src" -unittest %TESTFLAGS% -of%TESTNAME%.exe +if exist %TESTNAME%.exe %TESTNAME%.exe + +if exist %TESTNAME%.obj del %TESTNAME%.obj +if exist %TESTNAME%.lib del %TESTNAME%.lib +if exist %TESTNAME%.exe del %TESTNAME%.exe + +:eof From 84e49521e2d5c19e82720b7cfd010cb68d760f02 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Mon, 4 Dec 2017 04:32:46 +0100 Subject: [PATCH 04/11] Enable automatic releases for Windows --- appveyor.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 8a2469b..19aa110 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -121,3 +121,17 @@ test_script: - dub test --arch=%Darch% --compiler=%DC% - git submodule update --init --recursive - build.bat test + - build.bat + +deploy: + release: dscanner-v$(appveyor_build_version) + description: 'DScanner release' + provider: GitHub + auth_token: + secure: FhQH4pdE0v2jKANNhX5wlm1oKBfizXyArWUskWfL/bmxaTaLjeyduTzotBTzNQ4p + artifact: bin\dscanner.exe # upload D-Scanner binary + draft: false + prerelease: true + on: + branch: master # release from master branch only + appveyor_repo_tag: true # deploy on tag push only From 67b9697be9a419b9430b7034970f7ab0b3d49120 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Mon, 4 Dec 2017 04:34:14 +0100 Subject: [PATCH 05/11] Remove nightly from AppVeyor --- appveyor.yml | 6 ------ build.bat | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 19aa110..e208809 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,12 +1,6 @@ platform: x64 environment: matrix: - - DC: dmd - DVersion: nightly - arch: x64 - - DC: dmd - DVersion: nightly - arch: x86 - DC: dmd DVersion: beta arch: x64 diff --git a/build.bat b/build.bat index 51cdf16..4d35502 100644 --- a/build.bat +++ b/build.bat @@ -1,8 +1,8 @@ @echo off setlocal enabledelayedexpansion -IF "%DC%"=="" SET DC="dmd" -IF "%DC%"=="ldc2" SET DC="ldmd2" +if "%DC%"=="" set DC="dmd" +if "%DC%"=="ldc2" set DC="ldmd2" set DFLAGS=-O -release -inline -version=StdLoggerDisableWarning set TESTFLAGS=-g -w -version=StdLoggerDisableWarning From 7830eddc6166ab2fff02c462ca297fe79a88ff07 Mon Sep 17 00:00:00 2001 From: skl131313 Date: Sat, 16 Dec 2017 10:05:27 -0500 Subject: [PATCH 06/11] Fix line endings of code being checked out for Appveyor. --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index e208809..d992c87 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,6 +31,9 @@ branches: only: - master +init: + - git config --global core.autocrlf true + install: - ps: function ResolveLatestDMD { From c908c8d10f54d462e1faa1c53c85c17a1b502e27 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sun, 17 Dec 2017 06:40:57 +0100 Subject: [PATCH 07/11] Temporarily disable ldc beta + ldc stable x86 --- appveyor.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d992c87..2be4e70 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,15 +13,15 @@ environment: - DC: dmd DVersion: stable arch: x86 - - DC: ldc - DVersion: beta - arch: x86 - - DC: ldc - DVersion: beta - arch: x64 - - DC: ldc - DVersion: stable - arch: x86 + #- DC: ldc + #DVersion: beta + #arch: x86 + #- DC: ldc + #DVersion: beta + #arch: x64 + #- DC: ldc + #DVersion: stable + #arch: x86 - DC: ldc DVersion: stable arch: x64 From 187d276973923fa7acb533145a59aca4a6b04a2b Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 26 Dec 2017 20:32:37 +0100 Subject: [PATCH 08/11] update dparse --- dub.json | 2 +- libdparse | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index b57b3ed..0305278 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "StdLoggerDisableWarning" ], "dependencies" : { - "libdparse" : "~>0.7.2-alpha.3", + "libdparse" : "~>0.7.2-alpha.5", "dsymbol" : "~>0.2.6", "inifiled" : ">=1.0.2", "emsi_containers" : "~>0.5.3", diff --git a/libdparse b/libdparse index a2b492d..1b0df8c 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit a2b492d8c7a84881657de85939d9c6b14f867d5b +Subproject commit 1b0df8cb838adfb73889faaea524d6d6a473a5df From 1a3d0a08288968640d56b1762ef6e6edcd76abf4 Mon Sep 17 00:00:00 2001 From: skl131313 Date: Wed, 17 Jan 2018 21:18:11 -0500 Subject: [PATCH 09/11] Update LDC download url to use new format. --- appveyor.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2be4e70..4a17926 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,9 +16,9 @@ environment: #- DC: ldc #DVersion: beta #arch: x86 - #- DC: ldc - #DVersion: beta - #arch: x64 + - DC: ldc + DVersion: beta + arch: x64 #- DC: ldc #DVersion: stable #arch: x86 @@ -58,10 +58,10 @@ install: $version = $env:DVersion; if($version -eq "stable") { $latest = (Invoke-WebRequest "https://ldc-developers.github.io/LATEST").toString().replace("`n","").replace("`r",""); - $url = "https://github.com/ldc-developers/ldc/releases/download/v$($latest)/ldc2-$($latest)-win64-msvc.zip"; + $url = "https://github.com/ldc-developers/ldc/releases/download/v$($latest)/ldc2-$($latest)-windows-x64.7z"; }elseif($version -eq "beta") { $latest = (Invoke-WebRequest "https://ldc-developers.github.io/LATEST_BETA").toString().replace("`n","").replace("`r",""); - $url = "https://github.com/ldc-developers/ldc/releases/download/v$($latest)/ldc2-$($latest)-win64-msvc.zip"; + $url = "https://github.com/ldc-developers/ldc/releases/download/v$($latest)/ldc2-$($latest)-windows-x64.7z"; } else { $latest = $version; $url = "https://github.com/ldc-developers/ldc/releases/download/v$($version)/ldc2-$($version)-win64-msvc.zip"; @@ -87,10 +87,10 @@ install: echo "downloading ..."; $url = ResolveLatestLDC; echo $url; - Invoke-WebRequest $url -OutFile "c:\ldc.zip"; + Invoke-WebRequest $url -OutFile "c:\ldc.7z"; echo "finished."; pushd c:\\; - 7z x ldc.zip > $null; + 7z x ldc.7z > $null; popd; } } From 221953518c1d3d944933d0032a729507877a5f42 Mon Sep 17 00:00:00 2001 From: skl131313 Date: Wed, 17 Jan 2018 22:01:18 -0500 Subject: [PATCH 10/11] Fix environment path to LDC. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4a17926..1efddc5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -66,7 +66,7 @@ install: $latest = $version; $url = "https://github.com/ldc-developers/ldc/releases/download/v$($version)/ldc2-$($version)-win64-msvc.zip"; } - $env:PATH += ";C:\ldc2-$($latest)-win64-msvc\bin"; + $env:PATH += ";C:\ldc2-$($latest)-windows-x64\bin"; $env:DC = "ldc2"; return $url; } From df012e9028662f56670be6446176cd99c1752580 Mon Sep 17 00:00:00 2001 From: RazvanN7 Date: Thu, 25 Jan 2018 12:52:24 +0200 Subject: [PATCH 11/11] Make visiting alias public --- src/outliner.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/outliner.d b/src/outliner.d index 7aa9525..8233b6d 100644 --- a/src/outliner.d +++ b/src/outliner.d @@ -13,6 +13,8 @@ import std.conv; class Outliner : ASTVisitor { + alias visit = ASTVisitor.visit; + this(File output) { this.output = output; @@ -172,7 +174,5 @@ private: int indentLevel; - alias visit = ASTVisitor.visit; - File output; }