|
| 1 | +@echo off |
| 2 | +REM Copyright (c) 2017, Oracle and/or its affiliates. All Rights reserved |
| 3 | +REM |
| 4 | +REM ****************************************************************************** |
| 5 | +REM * |
| 6 | +REM * You may not use the identified files except in compliance with the Apache |
| 7 | +REM * License, Version 2.0 (the "License.") |
| 8 | +REM * |
| 9 | +REM * You may obtain a copy of the License at |
| 10 | +REM * http://www.apache.org/licenses/LICENSE-2.0. |
| 11 | +REM * |
| 12 | +REM * Unless required by applicable law or agreed to in writing, software |
| 13 | +REM * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 14 | +REM * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +REM * |
| 16 | +REM * See the License for the specific language governing permissions and |
| 17 | +REM * limitations under the License. |
| 18 | +REM * |
| 19 | +REM * NAME |
| 20 | +REM * MAKEPKG.BAT |
| 21 | +REM * |
| 22 | +REM * DESCRIPTION |
| 23 | +REM * Create/cleanup of binary package for the current node-oracledb binary. |
| 24 | +REM * |
| 25 | +REM ***************************************************************************** |
| 26 | + |
| 27 | +REM |
| 28 | +REM usage: MAKEPKG.BAT [<cmd>] |
| 29 | +REM : Possible values for <cmd> are: CLEANUP and CREATEBINARY |
| 30 | +REM |
| 31 | +REM expected to run this batch file from package sub-directory, |
| 32 | +REM where a fresh clone is created. |
| 33 | +REM |
| 34 | + |
| 35 | +REM expecting 1 parameter, make sure we have some arguments |
| 36 | +if "%1" == "" GOTO usage |
| 37 | + |
| 38 | +REM jump to appropriate sections based on <cmd> |
| 39 | +if "%1" == "CLEANUP" GOTO cleanup |
| 40 | +if "%1" == "CREATEBINARY" GOTO createbinary |
| 41 | +goto usage |
| 42 | + |
| 43 | +REM cleanup section, remove file(s) created by this batch file |
| 44 | +:cleanup |
| 45 | +echo "cleanup section" |
| 46 | +del ..\package-lock.json |
| 47 | +del SHASUMS256.txt oracledb-v*-node-*.gz |
| 48 | +goto exit |
| 49 | + |
| 50 | +REM compile, package to gz file |
| 51 | +:createbinary |
| 52 | +echo "createbinary section" |
| 53 | + |
| 54 | +REM Append SHA to LICENSE.MD |
| 55 | +git checkout ..\LICENSE.md |
| 56 | +setlocal enabledelayedexpansion |
| 57 | +REM compose a string with commands to execute one by one |
| 58 | + |
| 59 | +REM start with empty string |
| 60 | +set CONCAT_STR= |
| 61 | +REM capture SHA |
| 62 | +FOR /F "tokens=* USEBACKQ" %%F IN (`git --git-dir=..\.git rev-parse HEAD`) DO ( |
| 63 | +SET CONCAT_STR=%%F |
| 64 | +) |
| 65 | + |
| 66 | +set DATE_STR= |
| 67 | +FOR /F "tokens=* USEBACKQ" %%F IN (`DATE /T`) DO ( SET DATE_STR=%%F ) |
| 68 | + |
| 69 | +REM append output of other commands |
| 70 | +set CMD_STR="git --git-dir=..\odpi\.git rev-parse HEAD && node --version" |
| 71 | +for /f %%i in ('%CMD_STR%') do set "CONCAT_STR=!CONCAT_STR! %%i" |
| 72 | +set CONCAT_STR=!CONCAT_STR! !DATE_STR! |
| 73 | +echo !CONCAT_STR! >> ..\LICENSE.MD |
| 74 | + |
| 75 | +REM Compile node-oracledb |
| 76 | +cd .. |
| 77 | +CALL npm install |
| 78 | +echo "NODE oracledb compiled" |
| 79 | +cd package |
| 80 | +echo "==> Binary package created for Node.js " |
| 81 | + |
| 82 | +REM create compressed file |
| 83 | +node createpackage.js |
| 84 | +goto exit |
| 85 | + |
| 86 | +REM display usage string |
| 87 | +:usage |
| 88 | +echo "usage: MAKEPKG.BAT [<cmd>] |
| 89 | +goto exit |
| 90 | + |
| 91 | + |
| 92 | +REM Exit point |
| 93 | +:exit |
0 commit comments