diff --git a/aoclient_v1.yml b/aoclient_v1.yml index 390965d..a7eb723 100644 --- a/aoclient_v1.yml +++ b/aoclient_v1.yml @@ -1,7 +1,7 @@ openapi: '3.0.2' info: title: AoC API - version: '1.0' + version: '1.1' servers: - url: https://aoc.home.tarilaus.net/v1 @@ -9,6 +9,8 @@ servers: paths: /solve/{year}/{day}: get: + tags: + - "Solve" operationId: solvePuzzle summary: Solve puzzle description: Solves the puzzle for a given day and year diff --git a/api/build.gradle b/api/build.gradle new file mode 100644 index 0000000..0901da2 --- /dev/null +++ b/api/build.gradle @@ -0,0 +1,73 @@ +plugins { + id "org.openapi.generator" version "6.2.0" +} + +group = 'de.fettlaus' +version = '0.1.0' + +apply plugin: 'base' +apply plugin: 'maven-publish' +apply plugin: 'java' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() +} + +sourceSets { + main.java.srcDirs = ["$buildDir/generated/src/main/java"] +} + +openApiGenerate { + generatorName = "java" + inputSpec = "$rootDir/aoclient_v1.yml".toString() + outputDir = "$buildDir/generated".toString() + apiPackage = "de.fettlaus.aoclient.api" + invokerPackage = "de.fettlaus.aoclient.invoker" + modelPackage = "de.fettlaus.aoclient.model" + groupId = "de.fettlaus" + id = "aoclient" + version = "0.0.1" + configOptions = [ + dateLibrary: "java8" + ] +} + +compileJava.dependsOn tasks.openApiGenerate + +dependencies { + implementation 'io.swagger:swagger-annotations:1.6.5' + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation 'com.squareup.okhttp3:okhttp:4.9.3' + implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3' + implementation 'com.google.code.gson:gson:2.9.0' + implementation 'io.gsonfire:gson-fire:1.8.5' + implementation 'javax.ws.rs:jsr311-api:1.1.1' + implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' + implementation 'org.openapitools:jackson-databind-nullable:0.2.3' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' + implementation "jakarta.annotation:jakarta.annotation-api:1.3.5" +} + +publishing { + repositories { + maven { + url = 'https://git.fettlaus.de/api/packages/fettlaus/maven' + name = 'gitea' + authentication { + header(HttpHeaderAuthentication) + } + credentials(HttpHeaderCredentials) + } + } + + publications { + maven(MavenPublication) { + artifactId = 'aoclient' + from components.java + } + } +} \ No newline at end of file diff --git a/gen/build.gradle b/gen/build.gradle deleted file mode 100644 index b1815e0..0000000 --- a/gen/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id "org.openapi.generator" version "6.2.0" -} - -apply plugin:'base' - -repositories { - // Use Maven Central for resolving dependencies. - mavenCentral() -} - -openApiGenerate { - generatorName = "java" - inputSpec = "$rootDir/aoclient_v1.yml".toString() - outputDir = "$buildDir/generated".toString() - apiPackage = "de.fettlaus.aoclient.api" - invokerPackage = "de.fettlaus.aoclient.invoker" - modelPackage = "de.fettlaus.aoclient.model" - groupId = "de.fettlaus" - id = "aoclient" - version = "0.0.1" - configOptions = [ - dateLibrary: "java8" - ] -} - -project(":api") { - dependencies { - project(":gen") - } - - publishing { - repositories { - maven { - url = 'https://git.fettlaus.de/api/packages/fettlaus/maven' - name = 'gitea' - authentication { - header(HttpHeaderAuthentication) - } - credentials(HttpHeaderCredentials) - } - } - } -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c68..1673a70 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-milestone-2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..f127cfd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index 4b6cfdc..3851dc1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ rootProject.name = 'AoClientGen' -include 'gen' + include 'api' -project(':api').projectDir = new File(settingsDir, 'build/generated') \ No newline at end of file +project(":api").name = "aoclient" \ No newline at end of file