forked from knowhow/F18_knowhow
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_zip.cmd
106 lines (70 loc) · 2.84 KB
/
build_zip.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@echo off
REM get architecture x64, x32
set NODE_PROG=console.log( process.arch === "x64" ? "x64" : "x86");
echo %NODE_PROG% | node > tmpFile
set /p BUILD_ARCH= < tmpFile
del tmpFile
set CURRENT_DIR=%~dp0
set F18_PACKAGE=F18-windows-%BUILD_ARCH%
set F18_PACKAGE=F18-windows-%BUILD_ARCH%
set CURL=curl.exe
set NODE_PROG=const json=require('./package.json') ; console.log(json.f18)
echo %NODE_PROG% | node > tmpFile
set /p F18_VERSION= < tmpFile
del tmpFile
REM http://download.bring.out.ba/F18/F18-windows-x64_4.23.30.zip
set ZIP_FILE=%F18_PACKAGE%_%F18_VERSION%.zip
REM set HARBOUR_ROOT=c:\dev\harbour\%BUILD_ARCH%\harbour
echo USERPROFILE=%USERPROFILE%
set HARBOUR_ROOT=%USERPROFILE%\harbour\%BUILD_ARCH%\harbour
if [%HARBOUR_ROOT%] EQU [] (
REM x64
IF [%BUILD_ARCH%] EQU [x64] set HARBOUR_ROOT=\users\%USERNAME%\ah\%BUILD_ARCH%\harbour
REM x86
IF [%BUILD_ARCH%] NEQ [x64] set HARBOUR_ROOT=\users\%USERNAME%\ah\%BUILD_ARCH%\harbour
)
echo ==== HARBOUR_ROOT=%HARBOUR_ROOT% ====
REM x64
REM IF [%BUILD_ARCH%] EQU [x64] move .build\win32-x64\user-setup\eShellSetup.exe eShellSetup-x64-%F18_VERSION%.exe
REM x86
REM IF [%BUILD_ARCH%] NEQ [x64] move .build\win32-ia32\user-setup\eShellSetup.exe eShellSetup-x86-%F18_VERSION%.exe
echo "============ package: %F18_PACKAGE% ======= package_ver: %F18_VERSION% ============="
REM set ZIPACMD=\users\%USERNAME%\harbour\tools\win32\7z a -tzip
set FILES=F18-klijent.exe curl.exe psql.exe pg_dump.exe pg_restore.exe libpq.dll zlib1.dll libiconv.dll libxml2.dll
REM x64
IF [%BUILD_ARCH%] EQU [x64] set FILES=%FILES% libcrypto-1_1-x64.dll
IF [%BUILD_ARCH%] EQU [x64] set FILES=%FILES% libssl-1_1-x64.dll
REM x86
IF [%BUILD_ARCH%] NEQ [x64] set FILES=%FILES% libcrypto-1_1.dll
IF [%BUILD_ARCH%] NEQ [x64] set FILES=%FILES% libssl-1_1.dll
IF NOT EXIST %CURRENT_DIR%tmp\nul (
echo mkdir %CURRENT_DIR%tmp ...
mkdir tmp
echo mkdir tmp end ...
) else (
echo delete tmp\ tmp\tmpzip ...
del /Q tmp\*.*
del /Q tmp\tmpzip\*.*
)
echo == COPY %HARBOUR_ROOT%\bin\*.* TO tmp\ ====
copy %HARBOUR_ROOT%\bin\*.* tmp\
copy /y F18-klijent.exe tmp\
cd tmp
echo ZIP=%ZIP_FILE% FILES=%FILES%
echo CMD=%ZIPACMD% ..\%ZIP_FILE% %FILES%
REM %ZIPACMD% ..\%ZIP_FILE% %FILES%
REM public static void CreateFromDirectory (string sourceDirectoryName, string destinationArchiveFileName);
REM public System.IO.Compression.ZipArchiveEntry CreateEntry (string entryName);
mkdir tmpzip
echo moving files to tmp\tmpzip
powershell -Command "& { \"$ENV:FILES\".split() | foreach { move $_ tmpzip } }"
echo back from tmp\tmpzip
cd ..
echo curdir=%CD%
IF EXIST %ZIP_FILE% del %ZIP_FILE%
powershell -Command "& {Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]:: CreateFromDirectory(\"tmp\\tmpzip\",\"$ENV:ZIP_FILE\")}"
echo dir %ZIP_FILE%
dir %ZIP_FILE%
IF NOT EXIST %ZIP_FILE% EXIT /B 10001
:end
echo kraj build_zip