Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to maven central. #121

Merged
merged 8 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
---
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
prerelease: true
template: |
# What's Changed

$CHANGES
categories:
- title: Breaking
label: breaking
- title: New
label: enhancement
- title: Bug Fixes
label: bug
- title: Maintenance
label: maintenance
- title: Documentation
label: documentation
- title: Dependency Updates
label: dependencies

- title: "Breaking"
label: "breaking"
- title: "New"
label: "enhancement"
- title: "Bug Fixes"
label: "bug"
- title: "Maintenance"
label: "maintenance"
- title: "Documentation"
label: "documentation"
- title: "Dependency Updates"
label: "dependencies"
version-resolver:
major:
labels:
- breaking
- "breaking"
minor:
labels:
- enhancement
- "enhancement"
patch:
labels:
- bug
- maintenance
- documentation
- dependencies
- security

- "bug"
- "maintenance"
- "documentation"
- "dependencies"
- "security"
exclude-labels:
- skip-changelog
- "skip-changelog"
60 changes: 27 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
name: Build

on:
---
name: "Build"
"on":
pull_request:
branches: [ master ]

branches:
- "master"
jobs:
build:
name: Build
runs-on: ubuntu-latest
name: "Build"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '8'

- uses: arduino/setup-protoc@v1

- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-

- uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradlew-

- run: |
chmod +x gradlew
./gradlew build
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "adopt"
java-version: "11"
- uses: "actions/cache@v4"
with:
path: "~/.gradle/caches"
key: "${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}"
restore-keys: |
${{ runner.os }}-gradle-
- uses: "actions/cache@v4"
with:
path: "~/.gradle/wrapper"
key: "${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}"
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
chmod +x gradlew
./gradlew build
24 changes: 12 additions & 12 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Update Changelog

on:
---
name: "Update Changelog"
"on":
push:
branches: [ master ]

branches:
- "master"
jobs:
changelog:
name: Update Changelog
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'skip-snapshot') }}
name: "Update Changelog"
runs-on: "ubuntu-latest"
if: "${{ !contains(github.event.head_commit.message, 'skip-snapshot') }}"
steps:
- uses: release-drafter/release-drafter@master
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: "release-drafter/release-drafter@master"
id: "release"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: "Release"
"on":
release:
types:
- "released"
jobs:
build:
name: "Release"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "adopt"
java-version: "11"
- uses: "actions/cache@v4"
with:
path: "~/.gradle/caches"
key: "${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}"
restore-keys: |
${{ runner.os }}-gradle-
- uses: "actions/cache@v4"
with:
path: "~/.gradle/wrapper"
key: "${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}"
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
[[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
chmod +x gradlew
./gradlew -Psign-required=true publish -Pversion="${{ github.event.release.tag_name }}" -PmavenCentralUsername="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PmavenCentralPassword="${{ secrets.MAVEN_CENTRAL_PASSWORD }}" -PsigningInMemoryKey="${{ secrets.GPG_PRIVATE_KEY_ARMORED }}" -PsigningInMemoryKeyPassword="${{ secrets.GPG_PASSPHRASE }}"
24 changes: 0 additions & 24 deletions .run/build.run.xml

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# agones4j
[![](https://jitpack.io/v/infumia/agones4j.svg)](https://jitpack.io/#infumia/agones4j)
[![Maven Central Version](https://img.shields.io/maven-central/v/net.infumia/agones4j)](https://central.sonatype.com/artifact/net.infumia/agones4j/)
## How to Use (Developers)
### Code
```groovy
repositories {
maven("https://jitpack.io/")
mavenCentral()
}

dependencies {
// https://mvnrepository.com/artifact/io.grpc/grpc-stub/latest
implementation "io.grpc:grpc-stub:1.47.0"
implementation "io.grpc:grpc-protobuf:1.47.0"
implementation "io.grpc:grpc-netty:1.47.0"
implementation "com.github.infumia:agones4j:VERSION"
// Base module
implementation "net.infumia:agones4j:VERSION"
// Required, https://mvnrepository.com/artifact/io.grpc/grpc-stub/
implementation "io.grpc:grpc-stub:1.64.0"
implementation "io.grpc:grpc-protobuf:1.64.0"
// Required, https://github.com/grpc/grpc-java/blob/master/gradle/libs.versions.toml#L46/
implementation "org.apache.tomcat:annotations-api:1.64.0"
}
```
```java
Expand Down
124 changes: 12 additions & 112 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,118 +1,18 @@
import com.google.protobuf.gradle.id
import net.infumia.gradle.applyProtobuf
import net.infumia.gradle.publish
import net.infumia.gradle.spotless

plugins {
java
`java-library`
`maven-publish`
alias(libs.plugins.protobuf)
}

repositories {
mavenCentral()
}

dependencies {
compileOnlyApi(libs.protobuf)
compileOnlyApi(libs.grpc.protobuf)
compileOnlyApi(libs.grpc.stub)
compileOnlyApi(libs.annotationsapi)
}

sourceSets {
main {
java {
srcDirs("build/generated/source/proto/main/java")
}
resources {
srcDir("src/main/proto")
}
}
}
plugins { java }

protobuf {
protoc { artifact = libs.protoc.get().toString() }
publish()

plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}"
}
}
applyProtobuf()

generateProtoTasks {
all().forEach {
it.plugins {
id("grpc") {
outputSubDir = "java"
}
}
}
}
}

tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
}

javadoc {
options.encoding = Charsets.UTF_8.name()
(options as StandardJavadocDocletOptions).tags("todo")
exclude("**/allocation/**")
exclude("**/agones/**")
exclude("**/com/google/api/**")
exclude("**/grpc/**")
}

val javadocJar by creating(Jar::class) {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(javadoc)
}
spotless()

val sourcesJar by creating(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(sourceSets["main"].allSource)
}

processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = project.group.toString()
artifactId = "agones4j"
version = project.version.toString()
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set("Agones4J")
description.set("Java wrapper for Agones client SDK.")
url.set("https://infumia.com.tr/")
licenses {
license {
name.set("MIT License")
url.set("https://mit-license.org/license.txt")
}
}
developers {
developer {
id.set("portlek")
name.set("Hasan Demirtaş")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/infumia/agones4j.git")
developerConnection.set("scm:git:ssh://github.com/infumia/agones4j.git")
url.set("https://github.com/infumia/agones4j")
}
}
}
}
dependencies {
compileOnly(libs.protobuf)
compileOnly(libs.grpc.protobuf)
compileOnly(libs.grpc.stub)
compileOnly(libs.annotationsapi)
}
18 changes: 18 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins { `kotlin-dsl` }

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
// TODO: portlek, remove once
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 is fixed
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))

implementation(libs.nexus.plugin)
implementation(libs.spotless.plugin)
implementation(libs.protobuf.plugin)
}

kotlin { jvmToolchain(11) }
3 changes: 3 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencyResolutionManagement {
versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }
}
Loading