Commit 398f7934 authored by Michael Vrána's avatar Michael Vrána

Migrated to ActiveMQ

parent 28f7dd7b
Pipeline #78019 failed with stages
in 4 minutes
......@@ -40,4 +40,9 @@ yarn-error.log*
/exports
/docs
/.idea
\ No newline at end of file
/.idea
# server
server/build
server/activemq-data
server/.gradle
\ No newline at end of file
......@@ -73,6 +73,9 @@
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
"variant": "cpp",
"bit": "cpp",
"unordered_set": "cpp",
"shared_mutex": "cpp"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6"/>
<Project>
<Option title="algorithms_JSON_generator"/>
<Option makefile_is_custom="1"/>
<Option compiler="gcc"/>
<Option virtualFolders="CMake Files\;CMake Files\algorithmsJSONGenerator\;CMake Files\cmake\;CMake Files\worker\;CMake Files\workerTest\;"/>
<Build>
<Target title="all">
<Option working_dir="/home/michael/projects/webui-client/algorithmsJSONGenerator"/>
<Option type="4"/>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 all"/>
<CompileFile command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="algorithms_JSON_generator">
<Option output="/home/michael/projects/webui-client/algorithmsJSONGenerator/algorithms_JSON_generator" prefix_auto="0" extension_auto="0"/>
<Option working_dir="/home/michael/projects/webui-client/algorithmsJSONGenerator"/>
<Option object_output="./"/>
<Option type="1"/>
<Option compiler="gcc"/>
<Compiler>
<Add directory="/home/michael/projects/webui-client/worker"/>
<Add directory="/usr/include/algorithms-library"/>
</Compiler>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 algorithms_JSON_generator"/>
<CompileFile command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="algorithms_JSON_generator/fast">
<Option output="/home/michael/projects/webui-client/algorithmsJSONGenerator/algorithms_JSON_generator" prefix_auto="0" extension_auto="0"/>
<Option working_dir="/home/michael/projects/webui-client/algorithmsJSONGenerator"/>
<Option object_output="./"/>
<Option type="1"/>
<Option compiler="gcc"/>
<Compiler>
<Add directory="/home/michael/projects/webui-client/worker"/>
<Add directory="/usr/include/algorithms-library"/>
</Compiler>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 algorithms_JSON_generator/fast"/>
<CompileFile command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/michael/projects/webui-client/algorithmsJSONGenerator/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
</Build>
<Unit filename="/home/michael/projects/webui-client/algorithmsJSONGenerator/main.cpp">
<Option target="algorithms_JSON_generator"/>
</Unit>
<Unit filename="/home/michael/projects/webui-client/CMakeLists.txt">
<Option virtualFolder="CMake Files\"/>
</Unit>
<Unit filename="/home/michael/projects/webui-client/algorithmsJSONGenerator/CMakeLists.txt">
<Option virtualFolder="CMake Files\algorithmsJSONGenerator\"/>
</Unit>
<Unit filename="/home/michael/projects/webui-client/cmake/FindACTIVEMQ-CPP.cmake">
<Option virtualFolder="CMake Files\cmake\"/>
</Unit>
<Unit filename="/home/michael/projects/webui-client/cmake/FindALT.cmake">
<Option virtualFolder="CMake Files\cmake\"/>
</Unit>
<Unit filename="/home/michael/projects/webui-client/cmake/FindJSONCPP.cmake">
<Option virtualFolder="CMake Files\cmake\"/>
</Unit>
<Unit filename="/home/michael/projects/webui-client/worker/CMakeLists.txt">
<Option virtualFolder="CMake Files\worker\"/>
</Unit>
<Unit filename="/home/michael/projects/webui-client/workerTest/CMakeLists.txt">
<Option virtualFolder="CMake Files\workerTest\"/>
</Unit>
</Project>
</CodeBlocks_project_file>
import { Dealer } from 'zeromq'
type onReceiveCallback = (data: object) => void
const timeout = 120000
export class Broker {
private nextId: number = 0
private readonly dealer = new Dealer()
private readonly callbackMap = new Map<string, onReceiveCallback>()
run = async (port: number | string) => {
await this.dealer.bind(`tcp://*:${port}`)
this.listenForResponses()
}
send = async (obj: object): Promise<object> => {
const taskId = this.getNextTaskId()
await this.dealer.send([null, taskId, JSON.stringify(obj)])
return new Promise<object>((resolve, reject) => {
this.callbackMap.set(taskId, resolve)
setTimeout(() => {
this.callbackMap.delete(taskId)
reject(new Error('Evaluation timeout'))
}, timeout)
})
}
close = () => this.dealer.close()
private getNextTaskId = (): string => {
if (this.nextId > Number.MAX_SAFE_INTEGER)
this.nextId = Number.MIN_SAFE_INTEGER
return (this.nextId++).toString()
}
private listenForResponses = async () => {
for await (const [_, taskIdBuff, responseBuff] of this.dealer) {
const taskId = taskIdBuff.toString()
const response = JSON.parse(responseBuff.toString())
const callback = this.callbackMap.get(taskId)
this.callbackMap.delete(taskId)
if (!callback)
throw new Error(
`Could not find callback for taskId: ${taskId}`
)
callback(response)
}
}
}
import express from 'express'
import bodyParser from 'body-parser'
import { Broker } from './Broker'
const PORT = process.env.PORT || 3001
const DEALER_PORT = process.env.REQ_SOCK_PORT || 3002
const broker = new Broker()
const server = express()
server.use((_, res, next) => {
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3000')
next()
})
server.post('/', bodyParser.json({ type: '*/*' }))
server.post('/', async (req, res) => {
try {
const response = await broker.send(req.body)
res.send(response)
} catch (e) {
res.status(500).send({
error: e.message ?? e
})
}
})
process.on('SIGINT', () => {
console.log('Closing sockets')
broker.close()
process.exit(0)
})
broker.run(DEALER_PORT).then(() => {
console.log(`Dealer socket bound to port ${DEALER_PORT}`)
server.listen(PORT, () => {
console.log(`Server listening on port ${PORT}`)
})
})
This diff is collapsed.
{
"name": "alib_web_broker",
"version": "0.0.1",
"description": "Master MQ server for alib webui backend",
"main": "index.js",
"scripts": {
"start": "ts-node index.ts",
"dev": "nodemon index.ts",
"build": "tsc"
},
"repository": {
"type": "git",
"url": "https://gitlab.fit.cvut.cz/algorithms-library-toolkit/webui-client"
},
"author": "Michael Vrána",
"license": "",
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"zeromq": "^6.0.0-beta.6"
},
"devDependencies": {
"@types/express": "^4.17.4",
"nodemon": "^2.0.2",
"ts-node": "^8.8.1",
"typescript": "^3.8.3"
}
}
{
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"moduleResolution": "node",
"baseUrl": ".",
// "lib": [], /* Specify library files to be included in the compilation. */
"allowJs": false, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./build", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
"removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
"resolveJsonModule": true,
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"exclude": ["node_modules"]
}
set(ENV{PKG_CONFIG_PATH} "/usr/local/lib/pkgconfig")
find_package(PkgConfig REQUIRED)
pkg_check_modules(ACTIVEMQ-CPP REQUIRED activemq-cpp)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ACTIVEMQ-CPP DEFAULT_MSG
ACTIVEMQ-CPP_INCLUDE_DIRS
ACTIVEMQ-CPP_LIBRARIES
)
mark_as_advanced(
ACTIVEMQ-CPP_INCLUDE_DIRS
ACTIVEMQ-CPP_LIBRARIES
)
\ No newline at end of file
find_path(ZMQ_INCLUDE_DIR zmq.h)
find_library(ZMQ_LIBRARIES libzmq.so)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ZMQ DEFAULT_MSG
ZMQ_INCLUDE_DIR ZMQ_LIBRARIES)
if(NOT ZMQ_FOUND)
message(FATAL_ERROR "libzmq missing" )
endif(NOT ZMQ_FOUND)
mark_as_advanced(
ZMQ_INCLUDE_DIR
ZMQ_LIBRARIES
)
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
plugins {
kotlin("jvm") version "1.3.72"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
jcenter()
}
val ktor_version = "1.3.2"
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("io.ktor:ktor-server-core:$ktor_version")
implementation("io.ktor:ktor-server-netty:$ktor_version")
implementation(group = "org.apache.activemq", name = "activemq-all", version = "5.15.2")
implementation("com.beust:klaxon:5.0.1")
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}
\ No newline at end of file
kotlin.code.style=official
\ No newline at end of file
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome