mirror of
https://github.com/tcgdex/java-sdk.git
synced 2025-06-21 15:19:18 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
29a9c5ae79 | |||
e1bb2ad8dc |
28
.github/workflows/build.yml
vendored
28
.github/workflows/build.yml
vendored
@ -5,40 +5,34 @@
|
|||||||
# 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: Build & test the project
|
name: Java CI with Gradle
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ master ]
|
||||||
- '*'
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [ master ]
|
||||||
- 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:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v3
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Java ${{ matrix.java-versions }}
|
- name: Set up Java ${{ matrix.java-versions }}
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.java-versions }}
|
java-version: ${{ matrix.java-versions }}
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: 'gradle'
|
- name: Build with Gradle
|
||||||
|
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
||||||
- name: Build & Test
|
|
||||||
uses: gradle/gradle-build-action@v3
|
|
||||||
with:
|
with:
|
||||||
arguments: build test
|
arguments: build
|
||||||
|
25
.github/workflows/publish.yml
vendored
25
.github/workflows/publish.yml
vendored
@ -8,37 +8,38 @@
|
|||||||
name: Gradle Package
|
name: Gradle Package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
tags:
|
types: [created]
|
||||||
- v*
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v3
|
||||||
uses: actions/checkout@v4
|
- name: Set up JDK 11
|
||||||
- name: Set up JDK 8
|
uses: actions/setup-java@v3
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
with:
|
||||||
java-version: '8' # use the lowest version from https://en.wikipedia.org/wiki/Java_version_history#Release_table
|
java-version: '11'
|
||||||
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 the project
|
- name: Build with Gradle
|
||||||
uses: gradle/gradle-build-action@v3
|
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
||||||
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@v3
|
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
||||||
with:
|
with:
|
||||||
arguments: publish
|
arguments: publish
|
||||||
env:
|
env:
|
||||||
USERNAME: ${{ github.actor }}
|
USERNAME: ${{ github.actor }}
|
||||||
TOKEN: ${{ secrets.REPO_TOKEN }}
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -1,44 +1,16 @@
|
|||||||
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 "2.1.10"
|
kotlin("jvm") version "1.6.21"
|
||||||
id("org.jetbrains.dokka") version "2.0.0"
|
id("org.jetbrains.dokka") version "1.6.21"
|
||||||
|
|
||||||
// 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"
|
||||||
group = finalGroup
|
version = System.getenv("version") ?: "2.0.0"
|
||||||
version = finalVersion
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -49,7 +21,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.11.0")
|
implementation("com.google.code.gson:gson:2.9.0")
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
}
|
}
|
||||||
@ -61,17 +33,19 @@ tasks.test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
|
||||||
compilerOptions {
|
tasks {
|
||||||
jvmTarget.set(JvmTarget.JVM_1_8)
|
compileKotlin {
|
||||||
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
compileTestKotlin {
|
||||||
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withJavadocJar()
|
withJavadocJar()
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Javadocs
|
// Javadocs
|
||||||
@ -82,9 +56,9 @@ val javadocJar = tasks.named<Jar>("javadocJar") {
|
|||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
create<MavenPublication>("maven") {
|
create<MavenPublication>("maven") {
|
||||||
groupId = finalGroup
|
// groupId = group
|
||||||
artifactId = artifact
|
artifactId = artifact
|
||||||
version = finalVersion
|
// version = ver
|
||||||
|
|
||||||
from(components["java"])
|
from(components["java"])
|
||||||
|
|
||||||
@ -112,14 +86,4 @@ 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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
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-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-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 dexId: List<Int>?,
|
val dexIDs: List<Int>?,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HP of the pokemon
|
* HP of the pokemon
|
||||||
|
Reference in New Issue
Block a user