@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
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem  ijserver 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=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%..

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and IJSERVER_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\lib\ijserver-0.2.17-base.jar;%APP_HOME%\lib\jackson-module-kotlin-2.19.0.jar;%APP_HOME%\lib\langchain4j-ollama-0.35.0.jar;%APP_HOME%\lib\refactoring-miner-3.0.10.jar;%APP_HOME%\lib\github-api-1.135.jar;%APP_HOME%\lib\langchain4j-voyage-ai-0.35.0.jar;%APP_HOME%\lib\converter-jackson-2.9.0.jar;%APP_HOME%\lib\jackson-databind-2.19.0.jar;%APP_HOME%\lib\jackson-annotations-2.19.0.jar;%APP_HOME%\lib\jackson-core-2.19.0.jar;%APP_HOME%\lib\junit-jupiter-params-5.8.1.jar;%APP_HOME%\lib\junit-jupiter-engine-5.8.1.jar;%APP_HOME%\lib\junit-jupiter-api-5.8.1.jar;%APP_HOME%\lib\junit-platform-engine-1.8.1.jar;%APP_HOME%\lib\junit-platform-commons-1.8.1.jar;%APP_HOME%\lib\junit-jupiter-5.8.1.jar;%APP_HOME%\lib\api-gateway-client-jvm-0.3.99.jar;%APP_HOME%\lib\ktor-server-host-common-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-server-content-negotiation-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-server-netty-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-server-config-yaml-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-server-core-jvm-3.0.3.jar;%APP_HOME%\lib\code-agents-ideformer-daemon-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\code-agents-ideformer-client-jvm-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\code-agents-core-jvm-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\code-agents-tools-registry-jvm-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\code-agents-core-tools-jvm-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\ktor-serialization-kotlinx-json-jvm-3.0.3.jar;%APP_HOME%\lib\code-agents-ideformer-executable-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\kotlin-stdlib-jdk7-2.1.20.jar;%APP_HOME%\lib\api-gateway-api-jvm-0.3.99.jar;%APP_HOME%\lib\model-ner-jvm-0.3.99.jar;%APP_HOME%\lib\model-nmt-jvm-0.3.99.jar;%APP_HOME%\lib\model-nlc-jvm-0.3.99.jar;%APP_HOME%\lib\model-feedback-jvm-0.3.99.jar;%APP_HOME%\lib\auth-model-jvm-0.3.99.jar;%APP_HOME%\lib\auth-product-model-jvm-0.3.99.jar;%APP_HOME%\lib\model-gec-jvm-0.3.99.jar;%APP_HOME%\lib\model-def-jvm-0.3.99.jar;%APP_HOME%\lib\model-syn-jvm-0.3.99.jar;%APP_HOME%\lib\model-tree-jvm-0.3.99.jar;%APP_HOME%\lib\model-qa-jvm-0.3.99.jar;%APP_HOME%\lib\model-task-jvm-0.3.99.jar;%APP_HOME%\lib\model-sum-jvm-0.3.99.jar;%APP_HOME%\lib\model-tone-formality-jvm-0.3.99.jar;%APP_HOME%\lib\user-strg-model-jvm-0.3.99.jar;%APP_HOME%\lib\user-cfg-model-jvm-0.3.99.jar;%APP_HOME%\lib\utils-jwt-jvm-0.3.99.jar;%APP_HOME%\lib\utils-json-jvm-0.3.99.jar;%APP_HOME%\lib\client-cbor-jvm-0.3.99.jar;%APP_HOME%\lib\utils-cbor-jvm-0.3.99.jar;%APP_HOME%\lib\ktor-serialization-kotlinx-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-client-content-negotiation-jvm-3.0.3.jar;%APP_HOME%\lib\client-ktor-jvm-0.4.12.jar;%APP_HOME%\lib\utils-ktor-jvm-0.4.12.jar;%APP_HOME%\lib\ktor-client-cio-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-client-logging-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-client-core-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-websocket-serialization-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-serialization-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-events-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-http-cio-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-websockets-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-network-tls-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-sse-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-http-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-network-jvm-3.0.3.jar;%APP_HOME%\lib\ktor-utils-jvm-3.0.3.jar;%APP_HOME%\lib\client-attribute-jvm-0.3.99.jar;%APP_HOME%\lib\client-common-jvm-0.4.12.jar;%APP_HOME%\lib\model-llm-jvm-0.4.12.jar;%APP_HOME%\lib\model-quota-jvm-0.4.12.jar;%APP_HOME%\lib\model-license-jvm-0.4.12.jar;%APP_HOME%\lib\model-auth-jvm-0.4.12.jar;%APP_HOME%\lib\model-cloud-jvm-0.4.12.jar;%APP_HOME%\lib\nlp-tokenizer-jvm-0.3.99.jar;%APP_HOME%\lib\model-ab-testing-jvm-0.3.99.jar;%APP_HOME%\lib\model-bdg-jvm-0.4.12.jar;%APP_HOME%\lib\model-nlp-jvm-0.4.12.jar;%APP_HOME%\lib\nlp-langs-jvm-0.4.12.jar;%APP_HOME%\lib\nlp-patterns-jvm-0.3.99.jar;%APP_HOME%\lib\nlp-common-jvm-0.4.12.jar;%APP_HOME%\lib\model-emb-jvm-0.4.12.jar;%APP_HOME%\lib\model-text-jvm-0.4.12.jar;%APP_HOME%\lib\utils-common-jvm-0.4.12.jar;%APP_HOME%\lib\yamlkt-jvm-0.13.0.jar;%APP_HOME%\lib\model-jet-jvm-0.3.99.jar;%APP_HOME%\lib\kotlinx-serialization-cbor-jvm-1.8.0.jar;%APP_HOME%\lib\kotlinx-serialization-json-io-jvm-1.8.0.jar;%APP_HOME%\lib\kotlinx-serialization-core-jvm-1.8.0.jar;%APP_HOME%\lib\kotlinx-serialization-json-jvm-1.8.0.jar;%APP_HOME%\lib\code-exec-jvm-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\kotlinx-coroutines-slf4j-1.9.0.jar;%APP_HOME%\lib\ktor-io-jvm-3.0.3.jar;%APP_HOME%\lib\kotlinx-coroutines-core-jvm-1.9.0.jar;%APP_HOME%\lib\code-exec-model-jvm-1.0.0-beta.25+0.4.12.jar;%APP_HOME%\lib\kotlinx-cli-jvm-0.3.6.jar;%APP_HOME%\lib\langchain4j-open-ai-0.33.0.jar;%APP_HOME%\lib\openai4j-0.17.0.jar;%APP_HOME%\lib\converter-gson-2.9.0.jar;%APP_HOME%\lib\retrofit-2.9.0.jar;%APP_HOME%\lib\okhttp-sse-4.12.0.jar;%APP_HOME%\lib\okhttp-4.12.0.jar;%APP_HOME%\lib\okio-jvm-3.6.0.jar;%APP_HOME%\lib\swagger-annotations-jvm-0.3.99.jar;%APP_HOME%\lib\kotlin-reflect-2.1.10.jar;%APP_HOME%\lib\model-common-jvm-0.4.12.jar;%APP_HOME%\lib\kotlinx-io-core-jvm-0.5.4.jar;%APP_HOME%\lib\kotlinx-io-bytestring-jvm-0.5.4.jar;%APP_HOME%\lib\kotlin-stdlib-2.1.20.jar;%APP_HOME%\lib\kotlin-stdlib-jdk8-2.1.20.jar;%APP_HOME%\lib\langchain4j-0.33.0.jar;%APP_HOME%\lib\org.eclipse.jgit-7.2.1.202505142326-r.jar;%APP_HOME%\lib\javaparser-symbol-solver-core-3.26.2.jar;%APP_HOME%\lib\slf4j-simple-2.0.16.jar;%APP_HOME%\lib\spark-core-2.9.4.jar;%APP_HOME%\lib\langchain4j-core-0.35.0.jar;%APP_HOME%\lib\slf4j-api-2.0.16.jar;%APP_HOME%\lib\gen.jdt-3.0.0.jar;%APP_HOME%\lib\org.eclipse.jdt.core-3.39.0.jar;%APP_HOME%\lib\commons-text-1.12.0.jar;%APP_HOME%\lib\java-diff-utils-4.15.jar;%APP_HOME%\lib\core-3.0.0.jar;%APP_HOME%\lib\jcommander-1.85.jar;%APP_HOME%\lib\jsoup-1.18.2.jar;%APP_HOME%\lib\fastutil-8.5.15.jar;%APP_HOME%\lib\rendersnake-1.9.0.jar;%APP_HOME%\lib\opennlp-tools-1.9.4.jar;%APP_HOME%\lib\jtokkit-1.1.0.jar;%APP_HOME%\lib\JavaEWAH-1.2.3.jar;%APP_HOME%\lib\simmetrics-core-3.2.3.jar;%APP_HOME%\lib\commons-codec-1.18.0.jar;%APP_HOME%\lib\javaparser-core-3.26.2.jar;%APP_HOME%\lib\javassist-3.30.2-GA.jar;%APP_HOME%\lib\guava-33.3.0-jre.jar;%APP_HOME%\lib\config-1.4.3.jar;%APP_HOME%\lib\jansi-2.4.1.jar;%APP_HOME%\lib\netty-codec-http2-4.1.116.Final.jar;%APP_HOME%\lib\alpn-api-1.1.3.v20160715.jar;%APP_HOME%\lib\netty-transport-native-kqueue-4.1.116.Final.jar;%APP_HOME%\lib\netty-transport-native-epoll-4.1.116.Final.jar;%APP_HOME%\lib\opentest4j-1.2.0.jar;%APP_HOME%\lib\annotations-23.0.0.jar;%APP_HOME%\lib\org.eclipse.core.resources-3.21.0.jar;%APP_HOME%\lib\org.eclipse.core.filesystem-1.11.0.jar;%APP_HOME%\lib\org.eclipse.text-3.14.100.jar;%APP_HOME%\lib\org.eclipse.core.expressions-3.9.400.jar;%APP_HOME%\lib\org.eclipse.core.runtime-3.31.100.jar;%APP_HOME%\lib\ecj-3.39.0.jar;%APP_HOME%\lib\commons-lang3-3.14.0.jar;%APP_HOME%\lib\commons-io-2.8.0.jar;%APP_HOME%\lib\classindex-3.10.jar;%APP_HOME%\lib\gson-2.10.1.jar;%APP_HOME%\lib\jgrapht-core-1.5.1.jar;%APP_HOME%\lib\jetty-webapp-9.4.48.v20220622.jar;%APP_HOME%\lib\websocket-server-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-servlet-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-security-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-server-9.4.48.v20220622.jar;%APP_HOME%\lib\websocket-servlet-9.4.48.v20220622.jar;%APP_HOME%\lib\junit-4.8.2.jar;%APP_HOME%\lib\spring-webmvc-4.1.6.RELEASE.jar;%APP_HOME%\lib\jtidy-r938.jar;%APP_HOME%\lib\guice-3.0.jar;%APP_HOME%\lib\javax.inject-1.jar;%APP_HOME%\lib\failureaccess-1.0.2.jar;%APP_HOME%\lib\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;%APP_HOME%\lib\jsr305-3.0.2.jar;%APP_HOME%\lib\checker-qual-3.43.0.jar;%APP_HOME%\lib\error_prone_annotations-2.28.0.jar;%APP_HOME%\lib\netty-codec-http-4.1.116.Final.jar;%APP_HOME%\lib\netty-handler-4.1.116.Final.jar;%APP_HOME%\lib\netty-codec-4.1.116.Final.jar;%APP_HOME%\lib\netty-transport-classes-kqueue-4.1.116.Final.jar;%APP_HOME%\lib\netty-transport-classes-epoll-4.1.116.Final.jar;%APP_HOME%\lib\netty-transport-native-unix-common-4.1.116.Final.jar;%APP_HOME%\lib\netty-transport-4.1.116.Final.jar;%APP_HOME%\lib\netty-buffer-4.1.116.Final.jar;%APP_HOME%\lib\netty-resolver-4.1.116.Final.jar;%APP_HOME%\lib\netty-common-4.1.116.Final.jar;%APP_HOME%\lib\jna-platform-5.14.0.jar;%APP_HOME%\lib\jna-5.14.0.jar;%APP_HOME%\lib\org.eclipse.core.jobs-3.15.300.jar;%APP_HOME%\lib\org.eclipse.core.contenttype-3.9.400.jar;%APP_HOME%\lib\org.eclipse.equinox.app-1.7.100.jar;%APP_HOME%\lib\org.eclipse.equinox.registry-3.12.100.jar;%APP_HOME%\lib\org.eclipse.equinox.preferences-3.11.100.jar;%APP_HOME%\lib\org.eclipse.core.commands-3.12.100.jar;%APP_HOME%\lib\org.eclipse.equinox.common-3.19.100.jar;%APP_HOME%\lib\org.eclipse.osgi-3.21.0.jar;%APP_HOME%\lib\jheaps-0.13.jar;%APP_HOME%\lib\javax.servlet-api-3.1.0.jar;%APP_HOME%\lib\websocket-client-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-client-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-http-9.4.48.v20220622.jar;%APP_HOME%\lib\websocket-common-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-io-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-xml-9.4.48.v20220622.jar;%APP_HOME%\lib\websocket-api-9.4.48.v20220622.jar;%APP_HOME%\lib\spring-web-4.1.6.RELEASE.jar;%APP_HOME%\lib\spring-context-4.1.6.RELEASE.jar;%APP_HOME%\lib\spring-aop-4.1.6.RELEASE.jar;%APP_HOME%\lib\spring-beans-4.1.6.RELEASE.jar;%APP_HOME%\lib\spring-expression-4.1.6.RELEASE.jar;%APP_HOME%\lib\spring-core-4.1.6.RELEASE.jar;%APP_HOME%\lib\aopalliance-1.0.jar;%APP_HOME%\lib\cglib-2.2.1-v20090111.jar;%APP_HOME%\lib\fastutil-core-8.5.11.jar;%APP_HOME%\lib\org.osgi.service.prefs-1.1.2.jar;%APP_HOME%\lib\jetty-util-ajax-9.4.48.v20220622.jar;%APP_HOME%\lib\jetty-util-9.4.48.v20220622.jar;%APP_HOME%\lib\commons-logging-1.2.jar;%APP_HOME%\lib\asm-3.1.jar;%APP_HOME%\lib\osgi.annotation-8.0.1.jar


@rem Execute ijserver
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %IJSERVER_OPTS%  -classpath "%CLASSPATH%" org.boulderse.ijserver.cli.CLIKt %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable IJSERVER_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%IJSERVER_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
