forked from TCGdex/java-sdk
Compare commits
19 Commits
master
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
4e386e0020 | |||
3bbb439d86 | |||
c6a8325eba | |||
0c38358bc4 | |||
150acada74 | |||
58e02cc460 | |||
b207560670 | |||
89e706f692 | |||
7af1fa8880 | |||
8b6bbd603d | |||
4b88b09a7f | |||
981351da73 | |||
d881859750 | |||
a215226c36 | |||
26289a7256 | |||
13e719d1fb | |||
7c7ca1742b
|
|||
238c215d35
|
|||
2ca33328d0 |
36
.github/workflows/build.yml
vendored
36
.github/workflows/build.yml
vendored
@ -5,30 +5,40 @@
|
||||
# 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
|
||||
|
||||
name: Java CI with Gradle
|
||||
name: Build & test the project
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches:
|
||||
- '*'
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
# follows https://en.wikipedia.org/wiki/Java_version_history#Release_table
|
||||
java-versions: ['8', '11', '17', '21']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java ${{ matrix.java-versions }}
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
java-version: ${{ matrix.java-versions }}
|
||||
distribution: 'temurin'
|
||||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
||||
cache: 'gradle'
|
||||
|
||||
- name: Build & Test
|
||||
uses: gradle/gradle-build-action@v3
|
||||
with:
|
||||
arguments: build
|
||||
arguments: build test
|
||||
|
25
.github/workflows/publish.yml
vendored
25
.github/workflows/publish.yml
vendored
@ -8,38 +8,37 @@
|
||||
name: Gradle Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
java-version: '8' # use the lowest version from https://en.wikipedia.org/wiki/Java_version_history#Release_table
|
||||
distribution: 'temurin'
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
||||
- name: Build the project
|
||||
uses: gradle/gradle-build-action@v3
|
||||
with:
|
||||
arguments: build
|
||||
|
||||
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
|
||||
# the publishing section of your build.gradle
|
||||
- name: Publish to GitHub Packages
|
||||
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
||||
uses: gradle/gradle-build-action@v3
|
||||
with:
|
||||
arguments: publish
|
||||
env:
|
||||
USERNAME: ${{ github.actor }}
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||
|
@ -1,16 +1,44 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
|
||||
kotlin("jvm") version "1.6.21"
|
||||
id("org.jetbrains.dokka") version "1.6.21"
|
||||
kotlin("jvm") version "2.1.10"
|
||||
id("org.jetbrains.dokka") version "2.0.0"
|
||||
|
||||
// Apply the java-library plugin for API and implementation separation.
|
||||
`java-library`
|
||||
`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"
|
||||
group = System.getenv("group") ?: "net.tcgdex"
|
||||
version = System.getenv("version") ?: "2.0.0"
|
||||
|
||||
group = finalGroup
|
||||
version = finalVersion
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@ -21,7 +49,7 @@ dependencies {
|
||||
// Use the Kotlin JDK 8 standard library.
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
// Gson
|
||||
implementation("com.google.code.gson:gson:2.9.0")
|
||||
implementation("com.google.code.gson:gson:2.13.1")
|
||||
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
@ -33,19 +61,17 @@ tasks.test {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tasks {
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_1_8)
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
// Javadocs
|
||||
@ -56,9 +82,9 @@ val javadocJar = tasks.named<Jar>("javadocJar") {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
// groupId = group
|
||||
groupId = finalGroup
|
||||
artifactId = artifact
|
||||
// version = ver
|
||||
version = finalVersion
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -66,7 +66,7 @@ data class Card internal constructor(
|
||||
/**
|
||||
* 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
|
||||
|
Reference in New Issue
Block a user