Skip to content

Commit

Permalink
Switched build scripts to Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
BomBardyGamer committed Jul 28, 2023
1 parent 4918625 commit ed60fa0
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 93 deletions.
90 changes: 0 additions & 90 deletions build.gradle

This file was deleted.

107 changes: 107 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import com.google.protobuf.gradle.*

plugins {
`java-library`
`maven-publish`

// gRPC
id("com.google.protobuf") version "0.8.18"
}

group = "dev.emortal.api.agonessdk"
version = "1.0-SNAPSHOT"

val grpcVersion = "1.50.2"
val protobufVersion = "3.21.7"
val protocVersion = protobufVersion

repositories {
mavenCentral()
}

dependencies {
// gRPC
api("io.grpc:grpc-protobuf:$grpcVersion")
api("io.grpc:grpc-stub:$grpcVersion")
api("io.grpc:grpc-netty:$grpcVersion")

api("javax.annotation:javax.annotation-api:1.3.2")
implementation("org.slf4j:slf4j-api:2.0.3")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:$protocVersion"
}
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
}
}
generateProtoTasks {
all().forEach {
it.plugins {
id("grpc") {}
}
}
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(20))
}
}

tasks {
test {
useJUnitPlatform()
}
}

publishing {
repositories {
maven {
name = "development"
url = uri("https://repo.emortal.dev/snapshots")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_SECRET")
}
}
maven {
name = "release"
url = uri("https://repo.emortal.dev/releases")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_SECRET")
}
}
}

publications {
create<MavenPublication>("maven") {
groupId = "dev.emortal.api"
artifactId = "agones-sdk"

val commitHash = System.getenv("COMMIT_HASH_SHORT")
val releaseVersion = System.getenv("RELEASE_VERSION")
version = commitHash ?: releaseVersion ?: "local"

from(components["java"])
}
}
}

// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code.
sourceSets {
main {
java {
srcDirs("build/generated/source/proto/main/grpc")
srcDirs("build/generated/source/proto/main/java")
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 0 additions & 2 deletions settings.gradle

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "agones-java-grpc-sdk"

0 comments on commit ed60fa0

Please sign in to comment.