Skip to content

Commit

Permalink
new build via vssbe native scripting + updated description in Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
3F committed Dec 4, 2016
1 parent ab56c43 commit 1b0518e
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 45 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ obj
*.suo
.vs
/packages
/compact/gnt-compact.core
/compact/gnt-min.core
/compact/gnt.core
/minified/gnt-min.core
/minified/gnt.core
.nupkg
/wrapper/gnt.bat
/embedded/gnt.bat
85 changes: 85 additions & 0 deletions .vssbe
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"Header": {
"_": [
" This requires vsSolutionBuildEvent engine.",
" Free plugin for Visual Studio or MSBuild Tools:",
" * https://github.com/3F/vsSolutionBuildEvent",
" * https://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/",
" Feedback: github.com/3F or [email protected]"
],
"Compatibility": "0.9"
},
"PreBuild": [
{
"Enabled": true,
"Name": "ActDir",
"Caption": "Prepare output directory",
"SupportMSBuild": true,
"SupportSBEScripts": true,
"IgnoreIfBuildFailed": false,
"BuildType": "Common",
"Confirmation": false,
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[$(dbin = \"bin/Release/\")]",
"",
"$(odir = \"$(dbin)raw/\")",
"",
"#[IO delete.directory(\"$(dbin)\", true)]",
"#[IO copy.directory(\"\", \"$(dbin)\", true)]"
]
}
},
{
"Enabled": true,
"Name": "ActBuild",
"Caption": "Building",
"SupportMSBuild": true,
"SupportSBEScripts": true,
"BuildType": "Common",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[File scall(\"packing.bat\", \"\", 400)]"
]
}
}
],
"PostBuild": [
{
"Enabled": true,
"Name": "ActBin",
"Caption": "Binaries & tools ...",
"SupportMSBuild": true,
"SupportSBEScripts": true,
"IgnoreIfBuildFailed": true,
"BuildType": "Common",
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command__": [
"#[IO copy.file(\"gnt.core\", \"$(odir)core/gnt.core\", true)]",
"#[IO copy.file(\"minified/gnt.core\", \"$(odir)core-minified/gnt.core\", true)]",
"#[IO copy.file(\"embedded/gnt.bat\", \"$(odir)versions/01. executable/gnt.bat\", true)]",
"",
"#[IO copy.file({",
" \"minified/gnt.core\", ",
" \"caller/gnt.bat\"",
" }, ",
" \"$(odir)versions/02. caller/\", true)]",
"",
"#[IO copy.file({ \"README.md\", \"changelog.txt\" }, \"$(odir)doc/\", true)]",
" ",
"#[IO copy.file({",
" \"msbuild.bat\",",
" \"LICENSE\"",
" },",
" \"$(odir)\", true)]"
]
}
}
]
}
106 changes: 68 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,76 @@
# GetNuTool

The lightweight non-binary tool for work with NuGet packages via basic MSBuild Tools (without additional extensions etc.)
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)

```bash
> gnt
> msbuild.exe gnt.core
> gnt # Executable version - full logic inside single script .bat/.cmd
> msbuild gnt.core # Full & Compact versions to execute via MSBuild
[NuGet gnt.raw("/t:pack /p:ngin=\"7z.Libs\"")] # Compiled variant via vssbe
```

**Download:** [/releases](https://github.com/3F/GetNuTool/releases) ( [latest](https://github.com/3F/GetNuTool/releases/latest) )
[just try](https://github.com/3F/GetNuTool/releases/download/v1.5/gnt.bat) this:
```bash
gnt /p:ngpackages="Conari;regXwild" # To get `Conari` & `regXwild` packages
gnt /t:pack /p:ngin="bin\DllExport" # To create new NuGet package from `bin\DllExport` files
gnt /p:ngpackages="LunaRoad/1.4.1" # To get `LunaRoad` package v1.4.1
msbuild gnt.core /p:ngconfig="packages.config" # Use `packages.config`
```

* Available: *Full version, Compact version, Compiled variant, Executable version*
**Download:** [/releases](https://github.com/3F/GetNuTool/releases) ( [latest](https://github.com/3F/GetNuTool/releases/latest) ) - *Full version, Minified version, Compiled variant, Executable version*

Demo project: [![](https://img.shields.io/badge/build143-passing-brightgreen.svg?style=flat)](https://ci.appveyor.com/project/3Fs/vssolutionbuildevent/build/build-143) [GetNuTool v1.3 `get` & `pack` commands in use](https://ci.appveyor.com/project/3Fs/vssolutionbuildevent/build/build-143)
* Demo project: [GetNuTool v1.5 `get` & `pack` commands in use](https://ci.appveyor.com/project/3Fs/vssolutionbuildevent/build/build-178)

## License

The [MIT License (MIT)](https://github.com/3F/GetNuTool/blob/master/LICENSE)

## Main features
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=entry%2ereg%40gmail%2ecom&lc=US&item_name=3F%2dOpenSource%20%5b%20github%2ecom%2f3F&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)

* Getting the all selected `.nupkg` packages from NuGet server from user list with formats below.
* Two formats: list from `.config` files or direct from string.
* Extracting the all data from `.nupkg` into path by default or specific for each package.
* +Custom naming for each package with ignoring for already downloaded packages.
* Dependencies are not considered! get it manually as other packages above.
* [NuGet events](http://docs.nuget.org/create/Creating-and-Publishing-a-Package#automatically-running-powershell-scripts-during-package-installation-and-removal) *(Init.ps1, Install.ps1, Uninstall.ps1)* currently are not considered. Call it manually from `/tools`.
* Packing packages as `.nupkg` by using `.nuspec`

### For what
## Why GetNuTool ?

Primarily this to providing tools for service of your projects and libraries, the build processes, debugging, etc. For all that should be used as a tool for all projects (solution-level) or for each.

* The best examples:
* [vsSBE.CI.MSBuild](https://www.nuget.org/packages/vsSBE.CI.MSBuild/)
* [7z.Libs](https://www.nuget.org/packages/7z.Libs/)
* [ILAsm](https://www.nuget.org/packages/ILAsm/)

**But!** How about to consider it like a more lightweight powerful nuget client for getting packages or for new packaging. No, seriously, we already use it for many projects like:

* [Conari](https://github.com/3F/Conari)
* [DllExport](https://github.com/3F/DllExport)
* [vsSolutionBuildEvent](https://github.com/3F/vsSolutionBuildEvent)
* [LunaRoad](https://github.com/3F/LunaRoad)
* [vsCommandEvent](https://github.com/3F/vsCommandEvent)
* [regXwild](https://github.com/3F/regXwild)
* ...

Mainly, it's not for adding libraries for your projects (see standard nuget clients). This to providing tools for additional maintenance of your projects and libraries, building processes, debugging, and similar. For all that should be used as a tool for all projects (solution-level) or for each.
*Because it easy, and works well.*

#### Restoring packages inside Visual Studio IDE

The GetNuTool can't use events from Visual Studio **by default**. However, it can be combined with other our tool for complex work with **a lot of events** of VS IDE & MSBuild:
The GetNuTool can't use events from Visual Studio **by default**. However, it can be combined with other our tool for complex work with **lot of events** of VS IDE & MSBuild:

* [vsSolutionBuildEvent](http://vssbe.r-eg.net) - [0d1dbfd7-ed8a-40af-ae39-281bfeca2334](https://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/)
* [vsSolutionBuildEvent](https://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/) - https://github.com/3F/vsSolutionBuildEvent

So you can use this as you want, for example, automatically getting tool above for work with complex scripts with MSBuild Tool and Visual Studio as unified engine., etc.
So you can use this as you want, for example, automatically getting tool above for complex scripting in MSBuild & Visual Studio as unified engine., etc.

### Main features

* Getting the all selected `.nupkg` packages from NuGet server from user list with formats below.
* Two formats: list from `.config` files or direct from string.
* Extracting the all data from `.nupkg` into path by default or specific for each package.
* +Custom naming for each package with ignoring for already downloaded packages.
* Dependencies are not considered! get it manually as other packages above.
* [NuGet events](http://docs.nuget.org/create/Creating-and-Publishing-a-Package#automatically-running-powershell-scripts-during-package-installation-and-removal) *(Init.ps1, Install.ps1, Uninstall.ps1)* currently are not considered. Call it manually from `/tools`.
* Creating new (packing) NuGet packages as `.nupkg` by using `.nuspec`
* Wrapping of any package in one executable file, for example:
* CI.MSBuild **in one click** ~10 Kb: **[get.CIM.bat](https://github.com/3F/vsSolutionBuildEvent/releases/download/release_v0.12.10/get.CIM.bat)**
* Via our `.packer` can be easy embedded inside of any scripts.

## Commands

Expand All @@ -47,13 +80,13 @@ The `get` command is used by default. For getting & extracting packages. You can

Settings:

Property | Description
-----------|------------
ngconfig | Where to look the packages.config files.
ngserver | NuGet server.
ngpackages | List of packages. Uses first if defined, otherwise find packages.config
ngpath | Common path for all packages.
wpath |`v1.4+` To define working directory.
Property | Description | Default values
-----------|-------------------------------------------------------------------------|-----------------
ngconfig | Where to look the packages.config files. | v1.0+ `.nuget\packages.config`
ngserver | NuGet server. | v1.0+ `https://www.nuget.org/api/v2/package/`
ngpackages | List of packages. Use it first if defined, otherwise find via ngconfig | v1.0+ *empty*
ngpath | Common path for all packages. | v1.0+ `packages`
wpath |`v1.4+` To define working directory. | v1.4+ *The absolute path of the directory where the GetNuTool is located.*

Samples:

Expand Down Expand Up @@ -141,34 +174,31 @@ debug | false (by default), true | `v1.3+` To display additional information
```

```bash
> msbuild gnt.core /t:pack /p:ngin="D:\tmp\7z.Libs"
> msbuild gnt.core /t:pack /p:ngin="app\LunaRoad"
> msbuild gnt.core /t:pack /p:ngin="D:\tmp\7z.Libs" /p:ngout="newdir/"
```

#### Paths to MSBuild Tools

Use our MSBuild searcher - [msbuild](https://github.com/3F/GetNuTool/blob/master/msbuild.bat) for more convenience.

*but, just a note where to find the msbuild tool by default:*
*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`

for example:
```bash

"C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe"
"C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
```

+GAC_32, GAC_64, ...
```

## Compact version
## Compact & Minified versions

To build manually this version, you should use our compressor from [here](https://github.com/3F/GetNuTool/tree/master/compact) if needed.
To build this version you can use our compressor from [here](https://github.com/3F/GetNuTool/tree/master/minified).

Currently compact version ~4 Kb for `get` command and ~4 Kb for `pack` command, i.e. ~8 Kb in total.
Currently minified version ~4 Kb for `get` command and ~4 Kb for `pack` command, i.e. ~8 Kb in total.

```bash
> compress
Expand All @@ -192,19 +222,19 @@ The GetNuTool now is part of [NuGetComponent](http://vssbe.r-eg.net/doc/Scripts/

The `gnt.bat` is already contains `gnt.core` logic. It stored **inside script**.

To build manually this version, you should use our packer from [here](https://github.com/3F/GetNuTool/tree/master/wrapper) if needed.
To build manually this version, you should use our packer from [here](https://github.com/3F/GetNuTool/tree/master/embedded) if needed.

```bash
> packing
```

```bash
> msbuild wrapper/.packer /p:core="path to compact core" /p:output="output file"
> msbuild embedded/.packer /p:core="path to minified core" /p:output="output file"
```

Then you can use simply:

```bash
> gnt /p:ngpackages="vsSBE.CI.MSBuild"
> gnt /p:ngpackages="Conari"
```
**note:** you do not need the `gnt.core` or something else ! the final script provides all of what you need as non-binary tool ~10 Kb.
3 changes: 3 additions & 0 deletions bin/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
All final binaries will be here...

`> build`
8 changes: 8 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off

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

2 changes: 1 addition & 1 deletion compress.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off

msbuild compact/.compressor /p:core="../gnt.core" /p:output="gnt.core" /nologo /v:m /m:4
msbuild minified/.compressor /p:core="../gnt.core" /p:output="gnt.core" /nologo /v:m /m:4
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions gnt.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".gnt", ".gnt", "{D221D332-2A57-44F9-B866-F7C00C29032D}"
ProjectSection(SolutionItems) = preProject
gnt.core = gnt.core
EndProjectSection
EndProject
File renamed without changes.
2 changes: 1 addition & 1 deletion msbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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
)
)
Expand Down
4 changes: 4 additions & 0 deletions packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="vsSBE.CI.MSBuild" version="1.6.12010" output="vsSBE.CI.MSBuild" />
</packages>
2 changes: 1 addition & 1 deletion packing.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off

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

0 comments on commit 1b0518e

Please sign in to comment.