Skip to content

Commit

Permalink
Creating Zip & new MSBuild-helper with -notamd64 option 3F/vsSoluti…
Browse files Browse the repository at this point in the history
…onBuildEvent#38

also fixes `-unpack` & `-msbuild` commands for gnt.bat when using double quotes
  • Loading branch information
3F committed Dec 8, 2016
1 parent 905c118 commit 9c152ca
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 27 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ obj
.vs
/packages
/minified/gnt-min.core
/minified/gnt.core
/minified/gnt.core*
.nupkg
/embedded/gnt.bat
/embedded/gnt.bat
/embedded/gnt.core*
21 changes: 19 additions & 2 deletions .vssbe
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[File scall(\"packing.bat\", \"\", 400)]"
"#[IO writeLine(STDOUT):#[File sout(\"packing.bat\", \"\", 400)]]"
]
}
}
Expand All @@ -69,7 +69,7 @@
" \"minified/gnt.core\", ",
" \"caller/gnt.bat\"",
" }, ",
" \"$(odir)versions/02. caller/\", true)]",
" \"$(odir)versions/02. wrapper/\", true)]",
"",
"#[IO copy.file({ \"README.md\", \"changelog.txt\" }, \"$(odir)doc/\", true)]",
" ",
Expand All @@ -80,6 +80,23 @@
" \"$(odir)\", true)]"
]
}
},
{
"Enabled": true,
"Name": "ActZip",
"Caption": "Create Zip archive",
"SupportMSBuild": true,
"SupportSBEScripts": true,
"IgnoreIfBuildFailed": true,
"BuildType": "Common",
"Confirmation": false,
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[7z pack.directory(\"$(dbin)raw\", \"$(dbin)GetNuTool.zip\")]"
]
}
}
]
}
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# GetNuTool
# [GetNuTool](https://github.com/3F/GetNuTool)

The lightweight non-binary NuGet Client as a portable & embeddable tool for work with NuGet packages via basic MSBuild
(it does not require any additional extensions).

[![Build status](https://ci.appveyor.com/api/projects/status/rv65lbks5frc4k52/branch/master?svg=true)](https://ci.appveyor.com/project/3Fs/getnutool/branch/master)
[![release-src](https://img.shields.io/github/release/3F/GetNuTool.svg)](https://github.com/3F/GetNuTool/releases/latest)
[![License](https://img.shields.io/badge/License-MIT-74A5C2.svg)](https://github.com/3F/GetNuTool/blob/master/LICENSE)
[![Build status](https://ci.appveyor.com/api/projects/status/rv65lbks5frc4k52/branch/master?svg=true)](https://ci.appveyor.com/project/3Fs/getnutool/branch/master) [![release-src](https://img.shields.io/github/release/3F/GetNuTool.svg)](https://github.com/3F/GetNuTool/releases/latest) [![License](https://img.shields.io/badge/License-MIT-74A5C2.svg)](https://github.com/3F/GetNuTool/blob/master/LICENSE)

```bash
> gnt # Executable version - full logic inside single script
Expand Down Expand Up @@ -176,7 +174,7 @@ debug | false (by default), true | `v1.3+` To display additional information

```bash
> msbuild gnt.core
> msbuild gnt.core /p:ngpackages="7z.Libs/15.12.0;vsSBE.CI.MSBuild/1.5.1:../packages/CI.MSBuild"
> msbuild gnt.core /p:ngpackages="7z.Libs/16.04.0;vsSBE.CI.MSBuild/1.6.12010:../packages/CI.MSBuild"
```

```bash
Expand All @@ -186,7 +184,7 @@ debug | false (by default), true | `v1.3+` To display additional information

#### Paths to MSBuild Tools

*Use our msbuild-searcher and have fun. But just a note where to find the MSBuild tools by default:*
*Use our [msbuild-helper](https://github.com/3F/GetNuTool/blob/master/msbuild.bat) and have fun. But just a note where to find the MSBuild tools by default:*

* All available versions on your machine: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions`

Expand Down
11 changes: 9 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
set msbuild=msbuild.bat


call %msbuild% gnt.core /p:ngconfig="packages.config" /nologo /v:m /m:4
call "packages\vsSBE.CI.MSBuild\bin\CI.MSBuild" "gnt.sln" /v:m /m:4
call %msbuild% gnt.core /p:ngconfig="packages.config" /nologo /v:m /m:4 || goto err
call %msbuild% -notamd64 "gnt.sln" /l:"packages\vsSBE.CI.MSBuild\bin\CI.MSBuild.dll" /v:m /m:4

goto exit

:err

echo. Build failed. 1>&2

:exit
6 changes: 3 additions & 3 deletions caller/gnt.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ for %%v in (14.0, 12.0, 15.0, 4.0, 3.5, 2.0) do (
for /F "usebackq tokens=2* skip=2" %%a in (
`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath 2^> nul`
) do if exist %%b (
set msbuild="%%bmsbuild.exe"
set msbuild="%%b\msbuild.exe"
goto found
)
)

echo MSBuild Tools was not found. Please use it manually like: ` "full_path_to_msbuild.exe" %gntcore% arguments` 1>&2
echo MSBuild was not found, try: ` "full_path_to_msbuild.exe" %gntcore% arguments` 1>&2

goto exit

:found

echo MSBuild Tools: %msbuild%

%msbuild% gnt.core /nologo /v:m /m:4 %*
%msbuild% %gntcore% /nologo /v:m /m:4 %*
REM /noconlog

:exit
12 changes: 11 additions & 1 deletion compress.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
@echo off

msbuild minified/.compressor /p:core="../gnt.core" /p:output="gnt.core" /nologo /v:m /m:4 %*
set msbuild=msbuild.bat

call %msbuild% minified/.compressor /p:core="../gnt.core" /p:output="gnt.core" /nologo /v:m /m:4 %* || goto err

goto exit

:err

echo. Build failed. 1>&2

:exit
3 changes: 1 addition & 2 deletions embedded/.packer
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
<TaskCoreDllPath Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll')">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll</TaskCoreDllPath>
<TaskCoreDllPath Condition="'$(TaskCoreDllPath)' == '' and Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll')">$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll</TaskCoreDllPath>
</PropertyGroup>

<!-- Prepares list for downloader below -->

<UsingTask
TaskName="Packing"
TaskFactory="CodeTaskFactory"
Expand Down
10 changes: 7 additions & 3 deletions embedded/exec.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ set gntcore=gnt.core
set $tpl.corevar$="%temp%\%random%%random%%gntcore%"

set args=%*
if "%args:~0,7%"=="-unpack" goto unpack
if "%args:~0,8%"=="-msbuild" goto ufound
set a=%args:~0,30%
set a=%a:"=%

if "%a:~0,7%"=="-unpack" goto unpack
if "%a:~0,8%"=="-msbuild" goto ufound

for %%v in (14.0, 12.0, 15.0, 4.0, 3.5, 2.0) do (
for /F "usebackq tokens=2* skip=2" %%a in (
Expand Down Expand Up @@ -46,4 +49,5 @@ echo Generate minified version in %$tpl.corevar$% ...
<nul set /P ="">%$tpl.corevar$%
$gnt.core.logic$

:exit
:exit
exit /B 0
50 changes: 45 additions & 5 deletions msbuild.bat
Original file line number Diff line number Diff line change
@@ -1,23 +1,63 @@
@echo off
setlocal enableDelayedExpansion

:: The MSBuild-helper. Part of GetNuTool
:: https://github.com/3F/GetNuTool

:: arguments:
::
:: msbuild -notamd64 <args> - to select x86 instance instead of x64 if it's possible.
:: msbuild <args> - to select any available instance.
::

set args=%*
set notamd64=0

set a=%args:~0,30%
set a=%a:"=%

if "%a:~0,9%"=="-notamd64" (
call :popa %1
shift
set notamd64=1
)

for %%v in (14.0, 12.0, 15.0, 4.0, 3.5, 2.0) do (
for /F "usebackq tokens=2* skip=2" %%a in (
`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath 2^> nul`
) do if exist %%b (
set msbuild="%%b\msbuild.exe"

if NOT "%notamd64%" == "1" (
set msbuild=%%b\msbuild.exe
goto found
)

:: 7z & amd64\msbuild - https://github.com/3F/vsSolutionBuildEvent/issues/38
set _amd=..\msbuild.exe
if exist "%%b/!_amd!" (
set msbuild=%%b\!_amd!
) else (
set msbuild=%%b\msbuild.exe
)
goto found
)
)

echo MSBuild Tools was not found. Please use it manually like: ` "full_path_to_msbuild.exe" arguments ` 1>&2

echo MSBuild was not found, try: ` "full_path_to_msbuild.exe" arguments ` 1>&2
goto exit


:found

set msbuild="%msbuild%"

echo MSBuild Tools: %msbuild%

%msbuild% %*
%msbuild% %args%

:popa
call set args=%%args:%1^=%%
exit /B 0

:exit
:exit
exit /B 0
14 changes: 13 additions & 1 deletion packing.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
@echo off

compress & msbuild embedded/.packer /p:core="../minified/gnt.core" /p:output="gnt.bat" /nologo /v:m /m:4 %*
set msbuild=msbuild.bat

call compress || goto err
call %msbuild% embedded/.packer /p:core="../minified/gnt.core" /p:output="gnt.bat" /nologo /v:m /m:4 %* || goto err


goto exit

:err

echo. Build failed. 1>&2

:exit

0 comments on commit 9c152ca

Please sign in to comment.