-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from briancorbinxyz/feature/packaging
Feature/packaging
- Loading branch information
Showing
105 changed files
with
2,240 additions
and
839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import java.io.File | ||
|
||
plugins { | ||
id("buildlogic.java-library-conventions") | ||
} | ||
|
||
val libPath = "native/src/main/rust/target/debug" | ||
val osName = System.getProperty("os.name").lowercase() | ||
val osArch = System.getProperty("os.arch").lowercase() | ||
|
||
val libSuffix = when { | ||
osName.contains("win") -> "windows-$osArch" | ||
osName.contains("mac") -> "macos-$osArch" | ||
osName.contains("nux") -> "linux-$osArch" | ||
else -> throw GradleException("Unsupported OS") | ||
} | ||
|
||
dependencies { | ||
// Native Library (Rust) | ||
implementation(project(":native")) | ||
//testRuntimeOnly("org.xxdc.oss.example:tictactoe-native-$libSuffix:1.1.0") | ||
|
||
// JDK9: Platform Logging (Third-Party) | ||
// -> JDK API -> SLF4J -> Logback | ||
testRuntimeOnly("ch.qos.logback:logback-classic:1.5.6") | ||
testRuntimeOnly("org.slf4j:slf4j-api:2.0.13") | ||
testRuntimeOnly("org.slf4j:slf4j-jdk-platform-logging:2.0.13") | ||
|
||
|
||
// JDK23: JMH (Third-Party) Not required, added for benchmarking | ||
// https://github.com/openjdk/jmh | ||
testImplementation("org.openjdk.jmh:jmh-core:1.37") | ||
testAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:1.37") | ||
} | ||
|
||
// Run JMH benchmark | ||
// ./gradlew jmh | ||
tasks.register<JavaExec>("jmh") { | ||
mainClass.set("org.openjdk.jmh.Main") | ||
classpath = sourceSets["test"].runtimeClasspath | ||
args = listOf("org.xxdc.oss.example.interop.benchmark.PlayerIdsBenchmark") | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
// https://docs.gradle.org/current/userguide/publishing_maven.html | ||
publishing { | ||
repositories { | ||
// Publish to GitHub Packages | ||
// https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-gradle | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/briancorbinxyz/overengineering-tictactoe") | ||
credentials { | ||
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") | ||
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>("maven") { | ||
groupId = "org.xxdc.oss.example" | ||
artifactId = "tictactoe-api" | ||
from(components["java"]) | ||
pom { | ||
name.set("tictactoe") | ||
description.set("An Over-Engineered Tic Tac Toe Game API") | ||
url.set("https://github.com/briancorbinxyz/overengineering-tictactoe") | ||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://opensource.org/licenses/MIT") | ||
} | ||
developers { | ||
developer { | ||
id.set("briancorbinxyz") | ||
name.set("Brian Corbin") | ||
email.set("mail@briancorbin.xyz") | ||
} | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/briancorbinxyz/overengineering-tictactoe.git") | ||
developerConnection.set("scm:git:ssh://github.com/briancorbinxyz/overengineering-tictactoe.git") | ||
url.set("https://github.com/briancorbinxyz/overengineering-tictactoe") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.withType<Test>().all { | ||
// JDK22: Foreign Function Interface (FFI) | ||
// Resolves Warning: | ||
// WARNING: A restricted method in java.lang.foreign.SymbolLookup has been called | ||
// WARNING: java.lang.foreign.SymbolLookup::libraryLookup has been called by org.xxdc.oss.example.GameBoardNativeImpl in an unnamed module | ||
// WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module | ||
// WARNING: Restricted methods will be blocked in a future release unless native access is enabled | ||
jvmArgs = listOf("--enable-native-access=ALL-UNNAMED", "-XX:+UseZGC") | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.