build.bat 5.25 KB
Newer Older
1

2
set ADDON_VERSION=59
Cédric Moreau's avatar
Cédric Moreau committed
3
4
set NW_VERSION=0.28.1
set NODEJS_VERSION=9.5.0
Cédric Moreau's avatar
Cédric Moreau committed
5

6
set NW_RELEASE=v%NW_VERSION%
Cédric Moreau's avatar
Cédric Moreau committed
7
8
set NW=nwjs-%NW_RELEASE%-win-x64
set NW_GZ=%NW%.zip
Cédric Moreau's avatar
Cédric Moreau committed
9
10
11
12

set NODE_RELEASE=v%NODEJS_VERSION%
set NODE=node-v%NODEJS_VERSION%-win-x64
set NODE_ZIP=node-v%NODEJS_VERSION%-win-x64.zip
13
14
15
set NODE_MSI=node-v%NODEJS_VERSION%-x64.msi

echo "Version courante de NodeJS : "
Cédric Moreau's avatar
Cédric Moreau committed
16
17
18
19
20
21
22
23
node -v

REM NPM
set PATH="C:\Users\vagrant\AppData\Roaming\npm";%PATH%
REM InnoSetup
set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%

cd C:\Users\vagrant
Cédric Moreau's avatar
Cédric Moreau committed
24
25
26
27
28
29
30

if not exist %NODE_ZIP% (
  echo "Telechargement de %NODE_ZIP%..."
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"https://nodejs.org/dist/%NODE_RELEASE%/%NODE_ZIP%\", \"%NODE_ZIP%\")"
  call 7z x %NODE_ZIP%
)

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if not exist %NODE_MSI% (
  echo "Telechargement de %NODE_MSI%..."
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"https://nodejs.org/dist/%NODE_RELEASE%/%NODE_MSI%\", \"%NODE_MSI%\")"
  powershell -Command "Start-Process msiexec.exe -Wait -ArgumentList '/I %cd%\%NODE_MSI% /quiet'"
)

powershell -Command "Start-Process msiexec.exe -Wait -ArgumentList '/I %cd%\%NODE_MSI% /quiet'"

if not exist %NW_GZ% (
  echo "Telechargement de %NW_GZ%..."
  powershell -Command "(New-Object System.Net.WebClient).DownloadFile(\"https://dl.nwjs.io/%NW_RELEASE%/%NW_GZ%\", \"%NW_GZ%\")"
  call 7z x %NW_GZ%
)

echo "Version courante de NodeJS : "
node -v

call npm install -g node-pre-gyp
call npm install -g nw-gyp

Cédric Moreau's avatar
Cédric Moreau committed
51
52
53
54
55
echo "Suppression des anciennes sources..."
rd /s /q duniter
rd /s /q duniter_release
rd /s /q %NW%
echo "Clonage de Duniter..."
56
57
mkdir duniter
xcopy C:\vagrant\duniter-source\* %cd%\duniter\* /s /e /Y
Cédric Moreau's avatar
Cédric Moreau committed
58
59
cd duniter

60
for /f "delims=" %%x in (C:\vagrant\duniter_tag.txt) do set DUNITER_TAG=%%x
Cédric Moreau's avatar
Cédric Moreau committed
61
62
echo %DUNITER_TAG%

63
git checkout %DUNITER_TAG%
Cédric Moreau's avatar
Cédric Moreau committed
64

Cédric Moreau's avatar
Cédric Moreau committed
65
call npm cache clean
66
call npm install
67
68
69
echo "Patch de leveldown..."
move %cd%\node_modules\leveldown\package.json %cd%\node_modules\leveldown\package.json.back /s /e /Y
move %cd%\release\resources\leveldown-fix.json %cd%\node_modules\leveldown\package.json /s /e /Y
Cédric Moreau's avatar
Cédric Moreau committed
70
REM call npm test
71
echo "Ajout du module 1/1 (duniter-ui)..."
72
call npm install duniter-ui@1.7.x --save --production
Cédric Moreau's avatar
Cédric Moreau committed
73
74
echo "Retrait des modules 'dev'..."
call npm prune --production
Cédric Moreau's avatar
Cédric Moreau committed
75

Cédric Moreau's avatar
Cédric Moreau committed
76
77
78
79
REM echo ">> VM: installing peerDependencies installer..."
REM call npm i --save-dev @team-griffin/install-self-peers
REM echo ">> VM: installing peerDependencies..."
REM call ./node_modules/.bin/install-self-peers --npm -- --production
80

Cédric Moreau's avatar
Cédric Moreau committed
81
82
83
84
set SRC=%cd%
echo %SRC%
cd node_modules/wotb
call npm install --build-from-source
85
86
87
88

REM PREPARE common.gypi
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure

Cédric Moreau's avatar
Cédric Moreau committed
89
90
91
92
93
94
95
96
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\wotb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\wotb.node /Y
cd ../naclb
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\naclb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\naclb.node /Y
97
98
99
100
cd ../leveldown
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
101
102
103
104
105
mkdir %cd%\lib
mkdir %cd%\lib\binding
mkdir %cd%\lib\binding\Release
mkdir %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64
copy %cd%\build\Release\leveldown.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\leveldown.node /Y
Cédric Moreau's avatar
Cédric Moreau committed
106
107
108
109
110
111
112
113
114
115
cd ../scryptb
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\scryptb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\scryptb.node /Y
cd ../sqlite3
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\node-webkit-%NW_RELEASE%-win32-x64\node_sqlite3.node %cd%\lib\binding\node-v%ADDON_VERSION%-win32-x64\node_sqlite3.node /Y
Cédric Moreau's avatar
Cédric Moreau committed
116
cd ../../..
Cédric Moreau's avatar
Cédric Moreau committed
117
mkdir duniter_release
Cédric Moreau's avatar
Cédric Moreau committed
118
mkdir duniter_release\nodejs
Cédric Moreau's avatar
Cédric Moreau committed
119
call 7z x %NW_GZ%
Cédric Moreau's avatar
Cédric Moreau committed
120
121
122
123
124
125
126
127
128
xcopy %NW%\* %cd%\duniter_release\ /s /e /Y
xcopy %SRC%\gui\* %cd%\duniter_release\ /s /e /Y
xcopy %SRC%\* %cd%\duniter_release\ /s /e /Y
xcopy %NODE%\* %cd%\duniter_release\nodejs\ /s /e /Y
cd duniter_release
powershell -Command "(Get-Content package.json) | foreach-object {$_ -replace '\"main\": \"index.js\",','\"main\": \"index.html\",' } | Set-Content package.json2"
move /y package.json2 package.json
cd ..
iscc C:\vagrant\duniter.iss /DROOT_PATH=%cd%\duniter_release
Cédric Moreau's avatar
Cédric Moreau committed
129
130
move %cd%\duniter_release\Duniter.exe C:\vagrant\duniter-desktop-%DUNITER_TAG%-windows-x64.exe
echo "Build done: binary available at duniter-desktop-%DUNITER_TAG%-windows-x64.exe"