Skip to content

Commit

Permalink
refactor: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Skythrew committed Oct 12, 2024
1 parent 9aaef4d commit f0ad07a
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 96 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins {
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
}
149 changes: 70 additions & 79 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,103 +1,94 @@
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import com.vanniktech.maven.publish.SonatypeHost

val libraryName = "Pawnote"

version = "0.0.0"

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
id("com.vanniktech.maven.publish") version "0.29.0"
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
id("com.vanniktech.maven.publish") version "0.29.0"
}

kotlin {
jvm()
androidTarget {
publishLibraryVariants("release")
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
jvm()
androidTarget {
publishLibraryVariants("release")
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions { jvmTarget.set(JvmTarget.JVM_1_8) }
}

sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.okhttp)

implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.serialization.core)

implementation(libs.kotlinx.datetime)
}
}

sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.okhttp)

implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.serialization.core)

implementation(libs.kotlinx.datetime)
}
}
val commonTest by getting {
dependencies {
implementation(libs.kotlin.test)
}
}
val jvmMain by getting {
dependencies {
implementation(libs.ktor.client.okhttp)
implementation(libs.kotlin.test)
}
}
val androidMain by getting {
dependsOn(jvmMain)
dependencies {
implementation(libs.ktor.client.okhttp)
}
}
val commonTest by getting { dependencies { implementation(libs.kotlin.test) } }
val jvmMain by getting {
dependencies {
implementation(libs.ktor.client.okhttp)
implementation(libs.kotlin.test)
}
}
val androidMain by getting {
dependsOn(jvmMain)
dependencies { implementation(libs.ktor.client.okhttp) }
}
}
}

val groupName = "ink.literate"
val idLibraryName = libraryName.lowercase()

group = groupName

android {
namespace = groupName
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
minSdk = libs.versions.android.minSdk.get().toInt()
}
namespace = groupName
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig { minSdk = libs.versions.android.minSdk.get().toInt() }
}


mavenPublishing {
coordinates(groupName, idLibraryName, version.toString())

pom {
name = libraryName
description = "A purrfect API wrapper for PRONOTE."
inceptionYear = "2024"

url = "https://docs.literate.ink/$idLibraryName"

licenses {
license {
name.set("GPL-3.0-or-later")
url.set("https://www.gnu.org/licenses/gpl-3.0.txt")
distribution.set("https://www.gnu.org/licenses/gpl-3.0.txt")
}
}

developers {
developer {
organization = "LiterateInk"
organizationUrl = "https://literate.ink"
}
}

scm {
url = "https://github.com/LiterateInk/$libraryName"
connection = "scm:git:https://github.com/LiterateInk/$libraryName.git"
developerConnection = "scm:git:https://github.com/LiterateInk/$libraryName.git"
}
coordinates(groupName, idLibraryName, version.toString())

pom {
name = libraryName
description = "A purrfect API wrapper for PRONOTE."
inceptionYear = "2024"

url = "https://docs.literate.ink/$idLibraryName"

licenses {
license {
name.set("GPL-3.0-or-later")
url.set("https://www.gnu.org/licenses/gpl-3.0.txt")
distribution.set("https://www.gnu.org/licenses/gpl-3.0.txt")
}
}

developers {
developer {
organization = "LiterateInk"
organizationUrl = "https://literate.ink"
}
}

scm {
url = "https://github.com/LiterateInk/$libraryName"
connection = "scm:git:https://github.com/LiterateInk/$libraryName.git"
developerConnection = "scm:git:https://github.com/LiterateInk/$libraryName.git"
}
}

publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()
}
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject

suspend fun geolocation(
position: Position,
httpClient: HttpClient = HttpClient()
position: Position,
httpClient: HttpClient = HttpClient()
): List<GeolocatedInstance> {
val res =
httpClient.submitForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ data class SessionInfoParams(
)

suspend fun sessionInformation(
options: SessionInfoParams,
httpClient: HttpClient = HttpClient { followRedirects = false }
options: SessionInfoParams,
httpClient: HttpClient = HttpClient { followRedirects = false }
): SessionInformation {
val url = Url(options.base + "/" + encodeAccountKindToPath(options.kind))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ fun decodeInstance(instance: JsonObject): Instance {
},
casURL = casURL,
casToken = casToken)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ class ResponseFNTest {

assertEquals(Json.encodeToString(rawData), response.data)
}
}
}
19 changes: 10 additions & 9 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
repositories {
google()
mavenCentral()
}
}

rootProject.name = "pawnote"

include(":library")

0 comments on commit f0ad07a

Please sign in to comment.