forked from datagrok-ai/public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grok_connect.cmd
74 lines (65 loc) · 1.97 KB
/
grok_connect.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
:: Builds "GrokConnect" server or runs as shell application
::
:: Requirements:
:: * jdk 8 (https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
:: * maven 3+ (https://maven.apache.org/install.html)
::
:: Parameters:
:: * mode: test/run/shell
::
::
:: "shell" mode:
::
:: Template:
:: grok_connect_shell.cmd <mode> <args>
::
:: where:
:: * mode - run/build
:: * args:
:: -q, --query <arg> Query JSON file path
:: -o, --output <arg> Output CSV file path (optional, if is not specified CSV will be printed into console)
::
:: see query json example in "query_example.json"
::
:: Examples:
:: grok_connect.cmd shell build -q examples\query.json -o output.csv
:: grok_connect.cmd shell build -q examples\query.json
:: grok_connect.cmd shell -q examples\query.json
::
@echo off
set GROK_CONNECT_DIR=grok_connect
set GROK_CONNECT=grok_connect-1.0.3.jar
set TARGET_DIR=%GROK_CONNECT_DIR%\target
if "%1" == "shell" (
set REST_ARGS=%*
call set REST_ARGS=%%REST_ARGS:*%1=%%
if "%2" == "build" (
del /s /q %TARGET_DIR%
mvn -Dmaven.test.skip=true package
call set REST_ARGS=%%REST_ARGS:*%2=%%
)
java -Xmx4g -classpath %GROK_CONNECT_DIR%\lib\*;%TARGET_DIR%\%GROK_CONNECT% grok_connect.GrokConnectShell %REST_ARGS%
) else (
:: Remove target
del /s /q %TARGET_DIR%
if "%1" == "test" (
:: Get dart test dependencies
cd ..\ddt
call pub get
cd ..\grok_shared
call pub get
cd ..\ddt\bin\serialization_test
call pub get
cd ..\..\..\public\connectors
:: Build project
call mvn package
) else (
:: Build project
mvn -Dmaven.test.skip=true package
)
:: Run connector server with shared libraries
if "%1" == "run" (
call java -Xmx4g -classpath %GROK_CONNECT_DIR%\lib\*;%TARGET_DIR%\%GROK_CONNECT% grok_connect.GrokConnect
pause
)
)