-
Notifications
You must be signed in to change notification settings - Fork 5
/
dev-build-native.bat
72 lines (58 loc) · 2.87 KB
/
dev-build-native.bat
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@echo off
REM this bat file is a convenience script for local development. It is meant to build an entire
REM local native nuget package for use while testing/local dev. It's frequently necessary to add
REM functions around the C SDK for helping dotnet with something that's better done in C or for
REM testing the blitting of types when structs change. This script should build both x86 and x64
REM for windows, and produce a nuget package ONLY usable by windows for development.
REM
REM After executing, there should be a nuget package located at local-nuget-packages named after
REM the year.month.day.hourminute.nupkg and should look something like these:
REM
REM local-nuget-packages\OpenZiti.NET.native.2022.11.1.14.nupkg
REM local-nuget-packages\OpenZiti.NET.native.2022.11.1.946.nupkg
REM
set CODE_ROOT=%~dp0
set NATIVE_ROOT=%CODE_ROOT%ZitiNativeApiForDotnetCore
set LOCAL_NUGET_PACKAGES=%CODE_ROOT%local-nuget-packages
del /s %NATIVE_ROOT%\build-win\win32\library\Debug\ziti4dotnet.*
del /s %NATIVE_ROOT%\build-win\win64\library\Debug\ziti4dotnet.*
del /s %NATIVE_ROOT%\build-win\win32\library\Release\ziti4dotnet.*
del /s %NATIVE_ROOT%\build-win\win64\library\Release\ziti4dotnet.*
echo REMOVED OLD DLLS
call %NATIVE_ROOT%\msvc-build.bat
del /s /q %CODE_ROOT%runtimes
call :make_dummy %CODE_ROOT%runtimes\osx-x64\native\libziti4dotnet.dylib
call :make_dummy %CODE_ROOT%runtimes\ios-arm64\native\libziti4dotnet.dylib
call :make_dummy %CODE_ROOT%runtimes\osx-arm64\native\libziti4dotnet.dylib
call :make_dummy %CODE_ROOT%runtimes\linux-arm64\native\libziti4dotnet.so
call :make_dummy %CODE_ROOT%runtimes\linux-arm\native\libziti4dotnet.so
call :make_dummy %CODE_ROOT%runtimes\linux-x64\native\libziti4dotnet.so
call :make_dummy %CODE_ROOT%runtimes\win-x86\native\ziti4dotnet.dll
call :make_dummy %CODE_ROOT%runtimes\win-x64\native\ziti4dotnet.dll
copy /y %NATIVE_ROOT%\build-win\win32\library\Debug\ziti4dotnet.* %CODE_ROOT%runtimes\win-x86\native
copy /y %NATIVE_ROOT%\build-win\win64\library\Debug\ziti4dotnet.* %CODE_ROOT%runtimes\win-x64\native
if not exist %LOCAL_NUGET_PACKAGES% mkdir %LOCAL_NUGET_PACKAGES%
set yearstr=%date:~10,4%
set daystr=%date:~7,2%
set monthstr=%date:~4,2%
SET HOUR=%TIME:~0,2%
IF "%HOUR:~0,1%" == " " SET HOUR=0%HOUR:~1,1%
set timenow=%TIME: =0%
set minstr=%timenow:~3,2%
set datestr=%date:~10,4%-%date:~7,2%-%date:~4,2%
echo %datestr% %yearstr% %monthstr% %daystr% %HOUR% %minstr%
nuget pack -version %yearstr%.%monthstr%.%daystr%.%HOUR%%minstr% -OutputDirectory %LOCAL_NUGET_PACKAGES% %CODE_ROOT%native-package.nuspec
goto end
:make_dummy
setlocal enabledelayedexpansion
set FilePath=%1
for %%A in (%FilePath%) do set DirectoryPath=%%~dpA
if exist "%FilePath%" (
echo %FilePath% already exists. NOT overwriting.
) else (
mkdir %DirectoryPath%
echo "dummy" > %FilePath%
)
endlocal
goto :EOF
:end