forked from TCGdex/java-sdk
Compare commits
18 Commits
dependabot
...
master
Author | SHA1 | Date | |
---|---|---|---|
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
|
# 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:
|
||||||
|
matrix:
|
||||||
|
# follows https://en.wikipedia.org/wiki/Java_version_history#Release_table
|
||||||
|
java-versions: ['8', '11', '17', '21']
|
||||||
|
|
||||||
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 Java ${{ matrix.java-versions }}
|
||||||
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
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
|
||||||
|
25
.github/workflows/publish.yml
vendored
25
.github/workflows/publish.yml
vendored
@ -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 }}
|
||||||
|
@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
|
||||||
|
@ -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
|
||||||
|
Reference in New Issue
Block a user