Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/icpc/live-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
lperovskaya committed Feb 27, 2024
2 parents 0ffd026 + ce4dc2b commit 3cb28ea
Show file tree
Hide file tree
Showing 50 changed files with 2,946 additions and 551 deletions.
114 changes: 3 additions & 111 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,116 +1,8 @@
import com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
// versions are set in dependencies block for build.gradle.kts
// apply false brings the plugins into the Gradle script classpath (see import above)
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.shadow) apply false
}

tasks {
register<Task>("doc") {
dependsOn(project(":cds").tasks.named("dokkaHtmlMultiModule"))
}

// If you invoke a gen task, :schema-generator:gen will be invoked. It's defined in :schema-generator project
// since that project is already aware of global location for schema testing purposes.
}

subprojects {
group = "org.icpclive"
version = rootProject.findProperty("build_version")!!


plugins.withType<MavenPublishPlugin> {
afterEvaluate {
configure<PublishingExtension> {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/icpc/live-v3")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("mavenJava${this@subprojects.name}") {
pom {
name = "ICPC live contest data system parser"
description = "Parser for a various programming competition contest systems"
url = "https://github.com/icpc/live-v3"
licenses {
license {
name = "The MIT License"
url = "http://opensource.org/licenses/MIT"
}
}
scm {
connection.set("scm:git:git://github.com/icpc/live-v3.git")
developerConnection.set("scm:git:ssh://github.com/icpc/live-v3.git")
url.set("https://github.com/icpc/live-v3")
}
}
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
from(components["java"])
groupId = "org.icpclive"
version = rootProject.findProperty("build_version")!!.toString()
artifactId = "org.icpclive.cds.${this@subprojects.name}"
}
}
}
}
}

plugins.withType<JavaPlugin> {
configure<JavaPluginExtension> {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

tasks.named<Jar>("jar") {
archiveClassifier = "just"
}

tasks.named<Test>("test") {
useJUnitPlatform()
}
register<Task>("gen") {
dependsOn(project("schema-generator").tasks.named("gen"))
}

// Technically, Ktor pulls this too, but reconfigures...
plugins.withType<ShadowJavaPlugin> {
tasks.register<Sync>("release") {
destinationDir = rootDir.resolve("artifacts/")
preserve { include("*") }
from(tasks.named("shadowJar"))
}
tasks.named<ShadowJar>("shadowJar") {
mergeServiceFiles()

archiveClassifier = null
}
}

tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions {
compilerOptions {
freeCompilerArgs.add("-Xjvm-default=all")
optIn = listOf("kotlinx.serialization.ExperimentalSerializationApi")
}
allWarningsAsErrors = true
}
}
}
}
}
13 changes: 13 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

plugins {
`kotlin-dsl`
}

dependencies {
implementation(libs.gradleplugin.kotlin.jvm)
implementation(libs.gradleplugin.kotlin.serialization)
implementation(libs.gradleplugin.shadow)
implementation(libs.gradleplugin.dokka)
implementation(libs.gradleplugin.bcv)
implementation(libs.gradleplugin.ksp)
}
15 changes: 15 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencyResolutionManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "convention-plugins"

23 changes: 23 additions & 0 deletions buildSrc/src/main/kotlin/live.app-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import org.gradle.api.tasks.Sync
import org.gradle.kotlin.dsl.application
import org.gradle.kotlin.dsl.register

plugins {
application
id("live.kotlin-conventions")
id("com.github.johnrengelman.shadow")
}

tasks {
register<Sync>("release") {
destinationDir = rootDir.resolve("artifacts/")
preserve { include("*") }
from(tasks.named("shadowJar"))
}

shadowJar {
mergeServiceFiles()

archiveClassifier = null
}
}
16 changes: 16 additions & 0 deletions buildSrc/src/main/kotlin/live.cds-plugin-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import org.gradle.api.artifacts.VersionCatalogsExtension

val catalogs = extensions.getByType<VersionCatalogsExtension>()


plugins {
id("live.library-conventions")
id("live.ksp-conventions")
}

dependencies {
api(project(":cds:core"))
implementation(catalogs.named("libs").findLibrary("kotlinx-datetime").get())
implementation(catalogs.named("libs").findLibrary("kotlinx-serialization-json").get())
testImplementation(project(":cds:tests"))
}
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/live.common-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
group = "org.icpclive"
version = rootProject.findProperty("build_version")!!
36 changes: 36 additions & 0 deletions buildSrc/src/main/kotlin/live.kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
java
kotlin("jvm")
id("live.common-conventions")
id("org.jetbrains.kotlin.plugin.serialization")
}

val catalogs = extensions.getByType<VersionCatalogsExtension>()

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

tasks.named<Jar>("jar") {
archiveClassifier = "just"
}

tasks.named<Test>("test") {
useJUnitPlatform()
}

kotlin {
compilerOptions {
allWarningsAsErrors = true
compilerOptions {
freeCompilerArgs.add("-Xjvm-default=all")
optIn = listOf("kotlinx.serialization.ExperimentalSerializationApi")
}
}
}

dependencies {
testImplementation(catalogs.named("libs").findLibrary("kotlin-junit").get())
}
9 changes: 9 additions & 0 deletions buildSrc/src/main/kotlin/live.ksp-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id("live.kotlin-conventions")
id("com.google.devtools.ksp")
}

dependencies {
compileOnly(project(":ksp"))
ksp(project(":ksp"))
}
77 changes: 77 additions & 0 deletions buildSrc/src/main/kotlin/live.library-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import java.net.*

plugins {
id("live.kotlin-conventions")
id("org.jetbrains.dokka")
id("org.jetbrains.kotlinx.binary-compatibility-validator")
`java-library`
`maven-publish`
}

kotlin {
explicitApi()
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/icpc/live-v3")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
val libName = name
create<MavenPublication>("mavenJava${libName}") {
pom {
name = "ICPC live contest data system parser"
description = "Parser for a various programming competition contest systems"
url = "https://github.com/icpc/live-v3"
licenses {
license {
name = "The MIT License"
url = "http://opensource.org/licenses/MIT"
}
}
scm {
connection.set("scm:git:git://github.com/icpc/live-v3.git")
developerConnection.set("scm:git:ssh://github.com/icpc/live-v3.git")
url.set("https://github.com/icpc/live-v3")
}
}
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
from(components["java"])
groupId = "org.icpclive"
version = rootProject.findProperty("build_version")!!.toString()
artifactId = "org.icpclive.cds.${libName}"
}
}
}

tasks {
withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
perPackageOption {
matchingRegex.set(".*")
reportUndocumented.set(true)
sourceLink {
val projectDir = "https://github.com/icpc/live-v3/tree/main/"
localDirectory.set(rootProject.projectDir)
remoteUrl.set(URI(projectDir).toURL())
remoteLineSuffix.set("#L")
}
}
}
}
}
15 changes: 8 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@ graphql-ktor-client = { version.ref = "graphql", group = "com.expediagroup", nam

ksp = { version.ref = "ksp", group = "com.google.devtools.ksp", name = "symbol-processing-api" }

gradleplugin-kotlin-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
gradleplugin-shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow-plugin" }
gradleplugin-dokka = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka"}
gradleplugin-bcv = { group = "org.jetbrains.kotlinx.binary-compatibility-validator", name = "org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin", version.ref = "bcv" }
gradleplugin-ksp = { group = "com.google.devtools.ksp", name = "symbol-processing-gradle-plugin", version.ref = "ksp"}
gradleplugin-kotlin-serialization = { group = "org.jetbrains.kotlin.plugin.serialization", name = "org.jetbrains.kotlin.plugin.serialization.gradle.plugin", version.ref = "kotlin" }

[plugins]

node = { id = "com.github.node-gradle.node", version.ref = "node-plugin" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow-plugin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
protobuf = { id = "com.google.protobuf", version.ref = "protobuf-plugin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
graphql = { id = "com.expediagroup.graphql", version.ref = "graphql"}
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"}
bcv = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "bcv" }
graphql = { id = "com.expediagroup.graphql", version.ref = "graphql"}
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ val simpleProjects = listOf(
"backend-api",
"cds",
"cds:core",
"cds:plugins",
"cds:tests",
"cds:ktor",
"cds:cli",
Expand Down
5 changes: 1 addition & 4 deletions src/backend-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
plugins {
`java-library`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
id("live.kotlin-conventions")
}

dependencies {
api(libs.kotlinx.serialization.json)
api(libs.kotlinx.datetime)
api(projects.cds.utils)
api(projects.cds.core)
testImplementation(libs.kotlin.junit)
}
8 changes: 1 addition & 7 deletions src/backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import org.gradle.kotlin.dsl.run as runTask

plugins {
application
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.shadow)
id("live.app-conventions")
}

base {
Expand Down Expand Up @@ -60,7 +57,4 @@ dependencies {
implementation(libs.ktor.server.statusPages)
implementation(libs.ktor.server.websockets)
implementation(libs.logback)

testImplementation(libs.kotlin.junit)
testImplementation(libs.ktor.server.tests)
}
Loading

0 comments on commit 3cb28ea

Please sign in to comment.