Skip to content

Commit

Permalink
add a batch version for the dependency reporting (#126)
Browse files Browse the repository at this point in the history
This commit adds a Windows alternative to the dependency_report.sh.

(cherry picked from commit e4d8536)
  • Loading branch information
bpintea committed Mar 19, 2019
1 parent 52378d5 commit c7594ee
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions devtools/3rd_party/dependency_report.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@echo off
rem
rem Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
rem or more contributor license agreements. Licensed under the Elastic License;
rem you may not use this file except in compliance with the Elastic License.
rem

rem
rem Create a CSV file listing the information about our 3rd party dependencies
rem that is required for the stack-wide list.
rem
rem Usage:
rem dependency_report.bat --csv <output_file>
rem
rem The format is that defined in https://github.com/elastic/release-manager/issues/207,
rem i.e. a CSV file with the following fields:
rem
rem name,version,revision,url,license,copyright
rem
rem The way this script works, each component must have its own CSV file with
rem those fields, and this script simply combines them into a single CSV file.
rem Because of this, the field order is important - in each per-component CSV
rem file the fields must be in the order shown above.

setlocal EnableExtensions EnableDelayedExpansion

if /i [%1] == [--csv] (
set OUTPUT_FILE=%2
)

if [%OUTPUT_FILE%] == [] (
echo Usage: %~0 --csv ^<output_file^>
exit /b 1
)

cd %~dp0

rem IMPORTANT: this assumes all the *INFO.csv files have the following header:
rem
rem name,version,revision,url,license,copyright

set FIRST=yes
for %%i in (licenses\*INFO.csv) do (
if [!FIRST!] == [yes] (
set FIRST=no
rem "|| rem": set errorlevel
type %~dp0\%%i > %OUTPUT_FILE% || rem
if ERRORLEVEL 1 (
exit /b 1
)
) else (
findstr /v "^name," %~dp0\%%i >> %OUTPUT_FILE%
)
)

endlocal


0 comments on commit c7594ee

Please sign in to comment.