Skip to content

Commit

Permalink
All module using version catalog, and able to run publishToMavenLocal…
Browse files Browse the repository at this point in the history
… on all modules.
  • Loading branch information
shanelk committed May 7, 2024
1 parent 3772aa1 commit 0722b66
Show file tree
Hide file tree
Showing 25 changed files with 343 additions and 347 deletions.
69 changes: 11 additions & 58 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,63 +1,16 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import com.sun.xml.fastinfoset.sax.Properties
import org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension

plugins {
alias(serverlibs.plugins.dokka) apply false
alias(serverlibs.plugins.kotlinJvm) apply false
alias(serverlibs.plugins.kotlinMultiplatform) apply false
alias(serverlibs.plugins.androidApp) apply false
alias(serverlibs.plugins.androidLibrary) apply false
alias(serverlibs.plugins.graalVmNative) apply false
alias(serverlibs.plugins.shadow) apply false
}

buildscript {
val kotlinVersion:String by extra
repositories {
// mavenLocal()
// maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven(url = "https://s01.oss.sonatype.org/content/repositories/releases/")
google()
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
classpath("com.lightningkite:deploy-helpers:0.0.7")
classpath("com.android.tools.build:gradle:7.4.2")
classpath("org.owasp:dependency-check-gradle:9.1.0")
classpath("com.github.ben-manes:gradle-versions-plugin:0.51.0")
}
}
val localProps = project.rootProject.file("local.properties").takeIf { it.exists() }?.inputStream()?.use { stream ->
java.util.Properties().apply { load(stream) }
}
allprojects {
apply(plugin = "org.owasp.dependencycheck")
apply(plugin = "com.github.ben-manes.versions")
configure<DependencyCheckExtension> {
localProps?.getProperty("nvdApiKey")?.let {
nvd.apiKey = it
}
classpath(serverlibs.deployHelpers)
classpath(serverlibs.proguard)
}
group = "com.lightningkite.lightningserver"
repositories {
mavenLocal()
// maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven(url = "https://s01.oss.sonatype.org/content/repositories/releases/")
google()
mavenCentral()

}
tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.EXCLUDE }
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
}
apply(plugin = "org.owasp.dependencycheck")
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
20 changes: 7 additions & 13 deletions client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ import com.lightningkite.deployhelpers.mit
import com.lightningkite.deployhelpers.standardPublishing

plugins {
kotlin("multiplatform")
id("com.google.devtools.ksp")
kotlin("plugin.serialization")
id("com.android.library")
id("org.jetbrains.dokka")
alias(serverlibs.plugins.kotlinMultiplatform)
alias(serverlibs.plugins.androidLibrary)
alias(serverlibs.plugins.ksp)
alias(serverlibs.plugins.serialization)
alias(serverlibs.plugins.dokka)
id("signing")
`maven-publish`
}

repositories {
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

val kotlinVersion: String by project
kotlin {
targetHierarchy.default()
androidTarget {
Expand All @@ -36,13 +31,12 @@ kotlin {
iosX64()
iosArm64()
iosSimulatorArm64()
// androidTarget()

sourceSets {
val commonMain by getting {
dependencies {
api(project(":shared"))
api("com.lightningkite.kiteui:library:main-SNAPSHOT")
api(serverlibs.kiteUI)
}
kotlin {
srcDir(file("build/generated/ksp/common/commonMain/kotlin"))
Expand Down Expand Up @@ -109,6 +103,6 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
coreLibraryDesugaring(serverlibs.androidDesugaring)
}
}
34 changes: 9 additions & 25 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,16 @@ import org.gradle.api.internal.file.archive.ZipFileTree
import proguard.gradle.ProGuardTask

plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("com.google.devtools.ksp")
alias(serverlibs.plugins.kotlinJvm)
alias(serverlibs.plugins.serialization)
alias(serverlibs.plugins.ksp)
application
id("org.graalvm.buildtools.native") version "0.9.24"
id("com.github.johnrengelman.shadow") version "7.1.0"
}

buildscript {
dependencies {
classpath("com.guardsquare:proguard-gradle:7.3.2")
}
alias(serverlibs.plugins.graalVmNative)
alias(serverlibs.plugins.shadow)
}

group = "com.lightningkite.lightningserver"

repositories {
mavenLocal()
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven(url = "https://s01.oss.sonatype.org/content/repositories/releases/")
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") }
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap") }
mavenCentral()
}

val ktorVersion:String by project
dependencies {
api(project(":server-aws"))
api(project(":server-azure"))
Expand All @@ -42,8 +26,8 @@ dependencies {
api(project(":server-sentry"))
api(project(":server-sftp"))
ksp(project(":processor"))
implementation("com.lightningkite:kotliner-cli:1.0.3")
implementation("io.ktor:ktor-server-call-logging:$ktorVersion")
implementation(serverlibs.kotlinerCli)
implementation(serverlibs.ktorCallLogging)
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}

Expand Down Expand Up @@ -82,6 +66,6 @@ tasks.create("proguardTest", ProGuardTask::class) {
// this.libraryjars("${System.getProperty("java.home")}/lib/rt.jar".also { println("rt jar is ${it}") })
this.libraryjars(configurations.runtimeClasspath)
this.configuration("src/main/proguard.pro")
// this.keep("name: 'com.lightningkite.lightningserver.demo.**'")
// this.keep("com.lightningkite.lightningserver.demo.AwsHandler")
// this.keepnames("com.lightningkite.lightningserver.demo.**")
// this.keepnames("com.lightningkite.lightningserver.demo.AwsHandler")
}
3 changes: 3 additions & 0 deletions demo/src/main/proguard.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
-keep class io.ktor.** { *; }
-keep class kotlinx.coroutines.** { *; }

-keepnames com.lightningkite.lightningserver.demo.**
-keepnames com.lightningkite.lightningserver.demo.AwsHandler

-dontwarn jakarta.**
-dontwarn org.osgi.**
-dontwarn javax.**
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kspVersion=1.9.23-1.0.19
kotlinVersion=1.9.23
kotlinXSerialization=1.6.3
coroutines=1.8.0
ktorVersion=2.3.9
ktorVersion=2.3.9
130 changes: 130 additions & 0 deletions gradle/serverlibs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
[versions]
kotlin="1.9.23"
coroutines="1.8.0"
dokka="1.9.20"
ksp="1.9.23-1.0.20"
agp="8.2.0"
graalVmNative="0.9.24"
shadow="7.1.0"

ktor="2.3.9"
logBackClassic ="1.5.3"
kotlinHtmlJvm="0.11.0"
oneTimePass="2.4.0"
serializationLibs="1.6.3"
serializationXmlUtil="0.86.3"
xmlUtilJvm="0.86.3"
bson="5.0.1"
kbson="0.5.0"
kaml="0.58.0"
bouncyCastle="1.77"
angusMail="2.0.3"
javaJwt="4.4.0"
awssdk="2.17.232"
awsVersion="2.25.24"
dynamodb="2.23.4"
orgCrac="0.1.3"
lambdaJavaCore="1.2.3"
lambdaJavaEvents="3.11.4"
lambdaJavaLog4j2="1.6.0"
exposed="0.49.0"
azureFunctions="3.1.0"
azureStorage="12.25.3"
firebaseAdmin="9.2.0"
memcached="2.4.8"
embedMongo="4.12.3"
mongoDriver="5.0.1"
postgresql="42.7.3"
embeddedPostgres="2.0.6"
lettuce="6.3.2.RELEASE"
guava="33.0.0-jre"
hierynomusSshj="0.38.0"
embeddedRedis="0.8.3"
sentry="7.6.0"
sentry9="1.7.30"
kiteUI="main-SNAPSHOT"
androidDesugaring="2.0.4"
proguard="7.3.2"
kotlinerCli="1.0.3"

[libraries]
kotlinCompiler={module="org.jetbrains.kotlin:kotlin-compiler", version.ref="kotlin"}
serialization={module="org.jetbrains.kotlin:kotlin-serialization", version.ref="kotlin"}
kotlinTest={module="org.jetbrains.kotlin:kotlin-test-junit", version.ref="kotlin"}
ksp={module="com.google.devtools.ksp:symbol-processing-api", version.ref="ksp"}
ktorContentNegotiation={module="io.ktor:ktor-client-content-negotiation", version.ref="ktor"}
ktorJson={module="io.ktor:ktor-serialization-kotlinx-json", version.ref="ktor"}
ktorWebsockets={module="io.ktor:ktor-server-websockets-jvm", version.ref="ktor"}
ktorCore={module="io.ktor:ktor-server-core-jvm", version.ref="ktor"}
ktorCioJvm={module="io.ktor:ktor-server-cio-jvm", version.ref="ktor"}
ktorClientCio={module="io.ktor:ktor-client-cio", version.ref="ktor"}
ktorNetty={module="io.ktor:ktor-server-netty-jvm", version.ref="ktor"}
ktorCors={module="io.ktor:ktor-server-cors-jvm", version.ref="ktor"}
ktorTestHost={module="io.ktor:ktor-server-test-host-jvm", version.ref="ktor"}
ktorCallLogging={module="io.ktor:ktor-server-call-logging", version.ref="ktor"}
coroutinesCore={module="org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
logBackClassic={module="ch.qos.logback:logback-classic", version.ref= "logBackClassic" }
kotlinHtmlJvm={module="org.jetbrains.kotlinx:kotlinx-html-jvm", version.ref="kotlinHtmlJvm"}
oneTimePass = {module="dev.turingcomplete:kotlin-onetimepassword", version.ref="oneTimePass"}
serializationProperties={module="org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref="serializationLibs"}
serializationCbor={module="org.jetbrains.kotlinx:kotlinx-serialization-cbor", version.ref="serializationLibs"}
kotlinJvmHtml={module="org.jetbrains.kotlinx:kotlinx-html-jvm", version.ref="kotlinHtmlJvm"}
mongoBson={module="org.mongodb:bson", version.ref="bson"}
kBson={module="com.github.jershell:kbson", version.ref="kbson"}
xmlUtilJvm={module="io.github.pdvrieze.xmlutil:serialization-jvm", version.ref="xmlUtilJvm"}
kaml={module="com.charleskorn.kaml:kaml", version.ref="kaml"}
kotlinStdLib={module="org.jetbrains.kotlin:kotlin-stdlib", version.ref="kotlin"}
kotlinReflect={module="org.jetbrains.kotlin:kotlin-reflect", version.ref="kotlin"}
bouncyCastleBcprov ={module="org.bouncycastle:bcprov-jdk18on", version.ref="bouncyCastle"}
bouncyCastleBcpkix={module="org.bouncycastle:bcpkix-jdk18on", version.ref="bouncyCastle"}
angusMail={module="org.eclipse.angus:angus-mail", version.ref="angusMail"}
javaJwt={module="com.auth0:java-jwt", version.ref="javaJwt"}
deployHelpers={module="com.lightningkite:deploy-helpers", version="0.0.7"}
coroutinesReactive={module="org.jetbrains.kotlinx:kotlinx-coroutines-reactive", version.ref="coroutines"}
coroutinesJdk={module="org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref="coroutines"}
awssdk={module="software.amazon.awssdk:s3", version.ref="awssdk"}
dynamodb={module="software.amazon.awssdk:dynamodb", version.ref="dynamodb"}
awsS3={module="software.amazon.awssdk:s3", version.ref="awsVersion"}
awsLambda={module="software.amazon.awssdk:lambda", version.ref="awsVersion"}
awsSes={module="software.amazon.awssdk:ses", version.ref="awsVersion"}
awsRds={module="software.amazon.awssdk:rds", version.ref="awsVersion"}
awsApiGateway={module="software.amazon.awssdk:apigatewaymanagementapi", version.ref="awsVersion"}
awsCloudWatch={module="software.amazon.awssdk:cloudwatch", version.ref="awsVersion"}
orgCrac={module="io.github.crac:org-crac", version.ref="orgCrac"}
lambdaJavaCore={module="com.amazonaws:aws-lambda-java-core", version.ref="lambdaJavaCore"}
lambdaJavaEvents={module="com.amazonaws:aws-lambda-java-events", version.ref="lambdaJavaEvents"}
lambdaJavaLog4j2={module="com.amazonaws:aws-lambda-java-log4j2", version.ref="lambdaJavaLog4j2"}
exposedCore={module="org.jetbrains.exposed:exposed-core", version.ref="exposed"}
exposedJavaTime={module="org.jetbrains.exposed:exposed-java-time", version.ref="exposed"}
exposedJdbc={module="org.jetbrains.exposed:exposed-jdbc", version.ref="exposed"}
azureFunctions={module="com.microsoft.azure.functions:azure-functions-java-library", version.ref="azureFunctions"}
azureStorage={module="com.azure:azure-storage-blob", version.ref="azureStorage"}
firebaseAdmin={module="com.google.firebase:firebase-admin", version.ref="firebaseAdmin"}
memcached={module="com.googlecode.xmemcached:xmemcached", version.ref="memcached"}
embedMongo={module="de.flapdoodle.embed:de.flapdoodle.embed.mongo", version.ref="embedMongo"}
mongoDriver={module="org.mongodb:mongodb-driver-kotlin-coroutine", version.ref="mongoDriver"}
postgresql={module="org.postgresql:postgresql", version.ref="postgresql"}
embeddedPostgres={module="io.zonky.test:embedded-postgres", version.ref="embeddedPostgres"}
lettuce={module="io.lettuce:lettuce-core", version.ref="lettuce"}
embeddedRedis={module="org.signal:embedded-redis", version.ref="embeddedRedis"}
guava={module="com.google.guava:guava", version.ref="guava"}
hierynomusSshj={module="com.hierynomus:sshj", version.ref="hierynomusSshj"}
sentry={module="io.sentry:sentry", version.ref="sentry"}
sentry9={module="io.sentry:sentry", version.ref="sentry9"}
sentry9Logback={module="io.sentry:sentry-logback", version.ref="sentry9"}
kiteUI={module="com.lightningkite.kiteui:library", version.ref="kiteUI"}
androidDesugaring={module="com.android.tools:desugar_jdk_libs", version.ref="androidDesugaring"}
proguard={module="com.guardsquare:proguard-gradle", version.ref="proguard"}
kotlinerCli={module="com.lightningkite:kotliner-cli", version.ref="kotlinerCli"}


[plugins]
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
androidApp = {id="com.android.application", version.ref = "agp"}
androidLibrary = { id="com.android.library", version.ref = "agp"}
dokka={id="org.jetbrains.dokka", version.ref="dokka"}
ksp={id="com.google.devtools.ksp", version.ref="ksp"}
serialization={id="org.jetbrains.kotlin.plugin.serialization", version.ref="kotlin"}
graalVmNative={id="org.graalvm.buildtools.native", version.ref="graalVmNative"}
shadow={id="com.github.johnrengelman.shadow", version.ref="shadow"}
15 changes: 6 additions & 9 deletions processor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import com.lightningkite.deployhelpers.developer
import com.lightningkite.deployhelpers.github
import com.lightningkite.deployhelpers.mit
import com.lightningkite.deployhelpers.standardPublishing
import java.util.Properties
import com.lightningkite.deployhelpers.*

plugins {
kotlin("jvm")
id("org.jetbrains.dokka")
alias(serverlibs.plugins.kotlinJvm)
alias(serverlibs.plugins.dokka)
id("signing")
`maven-publish`
}


val kotlinVersion:String by project
val kspVersion:String by project

dependencies {
implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion")
implementation("org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion")
implementation(serverlibs.ksp)
implementation(serverlibs.kotlinCompiler)
}

standardPublishing {
Expand Down
Loading

0 comments on commit 0722b66

Please sign in to comment.