18 Commits

Author SHA1 Message Date
3bbb439d86 build: bump jvm from 2.1.0 to 2.1.10 (#46)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-27 15:34:59 +01:00
c6a8325eba build: bump org.jetbrains.dokka from 1.9.20 to 2.0.0 (#45)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-22 01:26:46 +01:00
0c38358bc4 build: bump jvm from 2.0.21 to 2.1.0 (#44)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-28 00:37:31 +01:00
150acada74 build: bump jvm from 2.0.20 to 2.0.21 (#43) 2024-10-13 19:38:00 +02:00
58e02cc460 build: bump jvm from 2.0.0 to 2.0.20 (#40)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 16:12:47 +02:00
b207560670 fix: Fixing property name (#42) 2024-09-05 16:08:06 +02:00
89e706f692 chore: Enable caching (#41) 2024-08-30 11:10:22 +02:00
7af1fa8880 chore: Upgrade from jvm 1 to jvm 2 (#38) 2024-06-26 17:23:46 +02:00
8b6bbd603d build: bump actions/checkout from 3 to 4 (#37)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:19:57 +02:00
4b88b09a7f build: bump actions/setup-java from 3 to 4 (#36)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 17:07:55 +02:00
981351da73 build: bump gradle/gradle-build-action from 2 to 3 (#35)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 16:17:32 +02:00
d881859750 build: bump org.jetbrains.dokka from 1.6.21 to 1.9.20 (#34)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 15:56:25 +02:00
a215226c36 build: bump com.google.code.gson:gson from 2.9.0 to 2.11.0 (#32)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-26 15:50:22 +02:00
26289a7256 fix: run CI/CD on PRs 2024-06-26 15:43:47 +02:00
13e719d1fb feat: Auto publish to Github Packages on tag (#31) 2023-12-28 03:32:33 +01:00
7c7ca1742b chore: Add the ability to publish to Github packages
Signed-off-by: Avior <github@avior.me>
2023-12-28 03:03:40 +01:00
238c215d35 fix: Upgrade Gradle version
Signed-off-by: Avior <github@avior.me>
2023-12-28 02:40:04 +01:00
2ca33328d0 chore: update tests to test current versions of Java 2023-12-28 02:31:46 +01:00
5 changed files with 82 additions and 41 deletions

View File

@ -5,34 +5,40 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle name: Build & test the project
on: on:
push: push:
branches: [ master ] branches:
- '*'
tags:
- v*
pull_request: pull_request:
branches: [ master ] branches:
- master
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
# follows https://en.wikipedia.org/wiki/Java_version_history#Release_table # follows https://en.wikipedia.org/wiki/Java_version_history#Release_table
java-versions: ['8', '11', '17', '21'] java-versions: ['8', '11', '17', '21']
steps: steps:
- uses: actions/checkout@v3 - name: Checkout
uses: actions/checkout@v4
- name: Set up Java ${{ matrix.java-versions }} - name: Set up Java ${{ matrix.java-versions }}
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: ${{ matrix.java-versions }} java-version: ${{ matrix.java-versions }}
distribution: 'temurin' distribution: 'temurin'
- name: Build with Gradle cache: 'gradle'
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
- name: Build & Test
uses: gradle/gradle-build-action@v3
with: with:
arguments: build arguments: build test

View File

@ -8,38 +8,37 @@
name: Gradle Package name: Gradle Package
on: on:
release: push:
types: [created] tags:
- v*
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps: steps:
- uses: actions/checkout@v3 - name: Checkout
- name: Set up JDK 11 uses: actions/checkout@v4
uses: actions/setup-java@v3 - name: Set up JDK 8
uses: actions/setup-java@v4
with: with:
java-version: '11' java-version: '8' # use the lowest version from https://en.wikipedia.org/wiki/Java_version_history#Release_table
distribution: 'temurin' distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle - name: Build the project
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701 uses: gradle/gradle-build-action@v3
with: with:
arguments: build arguments: build
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in # The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle # the publishing section of your build.gradle
- name: Publish to GitHub Packages - name: Publish to GitHub Packages
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701 uses: gradle/gradle-build-action@v3
with: with:
arguments: publish arguments: publish
env: env:
USERNAME: ${{ github.actor }} USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }} TOKEN: ${{ secrets.REPO_TOKEN }}

View File

@ -1,16 +1,44 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
kotlin("jvm") version "1.6.21" kotlin("jvm") version "2.1.10"
id("org.jetbrains.dokka") version "1.6.21" id("org.jetbrains.dokka") version "2.0.0"
// Apply the java-library plugin for API and implementation separation. // Apply the java-library plugin for API and implementation separation.
`java-library` `java-library`
`maven-publish` `maven-publish`
} }
// from: https://discuss.kotlinlang.org/t/use-git-hash-as-version-number-in-build-gradle-kts/19818/8
fun String.runCommand(
workingDir: File = File("."),
timeoutAmount: Long = 60,
timeoutUnit: TimeUnit = TimeUnit.SECONDS
): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`])[^'\"`]*\\1)*[^'\"`]*$)".toRegex()))
.directory(workingDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start()
.apply { waitFor(timeoutAmount, timeoutUnit) }
.run {
val error = errorStream.bufferedReader().readText().trim()
if (error.isNotEmpty()) {
return@run ""
}
inputStream.bufferedReader().readText().trim()
}
val branch = "git rev-parse --abbrev-ref HEAD".runCommand(workingDir = rootDir)
val tag = "git tag -l --points-at HEAD".runCommand(workingDir = rootDir)
val commitId = "git rev-parse HEAD".runCommand(workingDir = rootDir)
val finalVersion = System.getenv("version") ?: tag.drop(1) ?: "2.0.0"
val finalGroup = System.getenv("group") ?: "net.tcgdex"
val artifact = System.getenv("artifact") ?: "sdk" val artifact = System.getenv("artifact") ?: "sdk"
group = System.getenv("group") ?: "net.tcgdex"
version = System.getenv("version") ?: "2.0.0" group = finalGroup
version = finalVersion
repositories { repositories {
mavenCentral() mavenCentral()
@ -21,7 +49,7 @@ dependencies {
// Use the Kotlin JDK 8 standard library. // Use the Kotlin JDK 8 standard library.
implementation(kotlin("stdlib-jdk8")) implementation(kotlin("stdlib-jdk8"))
// Gson // Gson
implementation("com.google.code.gson:gson:2.9.0") implementation("com.google.code.gson:gson:2.11.0")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
} }
@ -33,19 +61,17 @@ tasks.test {
} }
} }
kotlin {
tasks { compilerOptions {
compileKotlin { jvmTarget.set(JvmTarget.JVM_1_8)
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
} }
} }
java { java {
withJavadocJar() withJavadocJar()
withSourcesJar() withSourcesJar()
targetCompatibility = JavaVersion.VERSION_1_8
} }
// Javadocs // Javadocs
@ -56,9 +82,9 @@ val javadocJar = tasks.named<Jar>("javadocJar") {
publishing { publishing {
publications { publications {
create<MavenPublication>("maven") { create<MavenPublication>("maven") {
// groupId = group groupId = finalGroup
artifactId = artifact artifactId = artifact
// version = ver version = finalVersion
from(components["java"]) from(components["java"])
@ -86,4 +112,14 @@ publishing {
} }
} }
} }
repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/tcgdex/java-sdk")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
}
}
}
} }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -66,7 +66,7 @@ data class Card internal constructor(
/** /**
* the Pokémon Pokédex IDs (multiple if multiple pokémon appears on the card) * the Pokémon Pokédex IDs (multiple if multiple pokémon appears on the card)
*/ */
val dexIDs: List<Int>?, val dexId: List<Int>?,
/** /**
* HP of the pokemon * HP of the pokemon