-
Notifications
You must be signed in to change notification settings - Fork 4
/
Build-Package.cmd
54 lines (44 loc) · 1.47 KB
/
Build-Package.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@echo off
pushd %~dp0
SETLOCAL ENABLEDELAYEDEXPANSION
call Build-Release.cmd
: loop thru nuspec files and build the packages
for /R %%v in (*.nuspec) do (
set file=%%~npv.csproj
CALL :mkrel file
: build each package (use relative path name)
tools\nuget pack !file! -symbols -Properties Configuration=Release || goto fail
)
REM move *.nupkg ..\repo || goto fail
goto fin
:fail
echo ERROR!
echo EXITING...
goto fin
:mkrel
:MakeRelative file base -- makes a file name relative to a base path
:: -- file [in,out] - variable with file name to be converted, or file name itself for result in stdout
:: -- base [in,opt] - base path, leave blank for current directory
:$created 20060101 :$changed 20080219 :$categories Path
:$source http://www.dostips.com
SETLOCAL ENABLEDELAYEDEXPANSION
set src=%~1
if defined %1 set src=!%~1!
set bas=%~2
if not defined bas set bas=%cd%
for /f "tokens=*" %%a in ("%src%") do set src=%%~fa
for /f "tokens=*" %%a in ("%bas%") do set bas=%%~fa
set mat=&rem variable to store matching part of the name
set upp=&rem variable to reference a parent
for /f "tokens=*" %%a in ('echo.%bas:\=^&echo.%') do (
set sub=!sub!%%a\
call set tmp=%%src:!sub!=%%
if "!tmp!" NEQ "!src!" (set mat=!sub!)ELSE (set upp=!upp!..\)
)
set src=%upp%!src:%mat%=!
( ENDLOCAL & REM RETURN VALUES
IF defined %1 (SET %~1=%src%) ELSE ECHO.%src%
)
EXIT /b
:fin
popd