KloudflareApi/build.gradle.kts

131 lines
4.1 KiB
Plaintext
Raw Normal View History

/*
* Copyright 2021 dorkbox, llc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2019-06-24 16:42:03 +02:00
2020-09-19 22:09:35 +02:00
///////////////////////////////
////// PUBLISH TO SONATYPE / MAVEN CENTRAL
////// TESTING : (to local maven repo) <'publish and release' - 'publishToMavenLocal'>
////// RELEASE : (to sonatype/maven central), <'publish and release' - 'publishToSonatypeAndRelease'>
///////////////////////////////
2019-06-24 16:42:03 +02:00
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS // always show the stacktrace!
gradle.startParameter.warningMode = WarningMode.All
2019-06-24 16:42:03 +02:00
plugins {
2023-08-21 02:55:18 +02:00
id("com.dorkbox.GradleUtils") version "3.17"
id("com.dorkbox.Licensing") version "2.26"
id("com.dorkbox.VersionUpdate") version "2.8"
id("com.dorkbox.GradlePublish") version "1.18"
2019-06-24 16:42:03 +02:00
// this allows us to drop generated moshi JSON code directly into bytecode using kotlin-ir (faster and better than KSP or KAPT).
// https://github.com/ZacSweers/MoshiX
// There are several issues with KSP.
// 1) It runs on every compile (it's not cached)
// 2) It is not possible to (at last I don't know) how to run this via IntelliJ compiles (it's only via Gradle)
2023-08-21 02:55:18 +02:00
id("dev.zacsweers.moshix") version "0.24.0"
2023-08-21 02:55:18 +02:00
kotlin("jvm") version "1.9.0"
2019-06-24 16:42:03 +02:00
}
object Extras {
// set for the project
2019-06-25 21:11:16 +02:00
const val description = "Cloudflare API v4 for Kotlin"
2019-06-24 16:42:03 +02:00
const val group = "com.dorkbox"
2023-08-21 02:55:18 +02:00
const val version = "2.1"
2019-06-24 16:42:03 +02:00
// set as project.ext
const val name = "KloudflareAPI"
const val id = "KloudflareAPI"
const val vendor = "Dorkbox LLC"
2020-09-19 22:09:35 +02:00
const val vendorUrl = "https://dorkbox.com"
2019-06-24 16:42:03 +02:00
const val url = "https://git.dorkbox.com/dorkbox/KloudflareAPI"
}
///////////////////////////////
///// assign 'Extras'
///////////////////////////////
GradleUtils.load("$projectDir/../../gradle.properties", Extras)
GradleUtils.defaults()
GradleUtils.compileConfiguration(JavaVersion.VERSION_11)
2019-06-24 16:42:03 +02:00
licensing {
license(License.APACHE_2) {
author(Extras.vendor)
url(Extras.url)
note(Extras.description)
}
}
tasks.jar.get().apply {
manifest {
2019-07-28 16:37:56 +02:00
// https://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html
attributes["Name"] = Extras.name
attributes["Specification-Title"] = Extras.name
attributes["Specification-Version"] = Extras.version
attributes["Specification-Vendor"] = Extras.vendor
attributes["Implementation-Title"] = "${Extras.group}.${Extras.id}"
2023-08-21 02:55:18 +02:00
attributes["Implementation-Version"] = GradleUtils.now()
2019-07-28 16:37:56 +02:00
attributes["Implementation-Vendor"] = Extras.vendor
attributes["Automatic-Module-Name"] = Extras.id
2019-06-24 16:42:03 +02:00
}
}
dependencies {
2023-08-21 02:59:54 +02:00
api(kotlin("reflect"))
2019-06-24 16:42:03 +02:00
2023-08-21 02:55:18 +02:00
val moshiVer = "1.15.0"
val okHttpVer = "4.11.0"
val retroVer = "2.9.0"
2019-06-24 16:42:03 +02:00
2022-11-27 21:31:06 +01:00
api("com.squareup.okhttp3:okhttp:$okHttpVer")
api("com.squareup.okhttp3:logging-interceptor:$okHttpVer") // Log Network Calls
2019-06-24 16:42:03 +02:00
// For serialization. THESE ARE NOT TRANSITIVE because it screws up the kotlin version
2022-11-27 21:31:06 +01:00
api("com.squareup.retrofit2:retrofit:$retroVer")
api("com.squareup.retrofit2:converter-moshi:$retroVer")
2022-11-27 21:31:06 +01:00
api("com.squareup.moshi:moshi:$moshiVer")
api("com.squareup.moshi:moshi-kotlin:$moshiVer")
2022-11-27 21:31:06 +01:00
api("com.dorkbox:Updates:1.1")
2019-07-28 16:37:56 +02:00
}
2020-09-19 22:09:35 +02:00
publishToSonatype {
groupId = Extras.group
artifactId = Extras.id
version = Extras.version
2020-09-19 22:09:35 +02:00
name = Extras.name
description = Extras.description
url = Extras.url
2020-09-19 22:09:35 +02:00
vendor = Extras.vendor
vendorUrl = Extras.vendorUrl
2019-06-24 16:42:03 +02:00
2020-09-19 22:09:35 +02:00
issueManagement {
url = "${Extras.url}/issues"
nickname = "Gitea Issues"
2019-07-28 16:37:56 +02:00
}
2019-06-24 16:42:03 +02:00
2020-09-19 22:09:35 +02:00
developer {
id = "dorkbox"
name = Extras.vendor
email = "email@dorkbox.com"
2019-07-28 16:37:56 +02:00
}
2019-06-24 16:42:03 +02:00
}