Skip to content

Commit

Permalink
chore: merge pull request #66 from Skythrew/kotlin
Browse files Browse the repository at this point in the history
Clean everything up (Kotlin implementation)
  • Loading branch information
Vexcited authored Oct 12, 2024
2 parents c260d32 + f0ad07a commit eb6c6a6
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 264 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)
}
146 changes: 69 additions & 77 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,102 +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 {
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 @@ -17,7 +17,7 @@ fun decodeInstance(instance: JsonObject): Instance {
return Instance(
name = instance["nomEtab"]!!.jsonPrimitive.content,
version = instance["version"]!!.jsonArray.map { version -> version.jsonPrimitive.int },
date = LocalDateTime.parse(instance["date"]!!.jsonPrimitive.content),
date = LocalDateTime.parse(instance["date"]!!.jsonPrimitive.content.dropLast(1)),
accounts =
instance["espaces"]!!.jsonArray.map { account ->
InstanceAccount(
Expand Down

This file was deleted.

18 changes: 0 additions & 18 deletions library/src/commonTest/kotlin/ink/literate/pawnote/api/Instance.kt

This file was deleted.

46 changes: 0 additions & 46 deletions library/src/commonTest/kotlin/ink/literate/pawnote/api/identify.kt

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ResponseFNTest {
id = sessionId,
accountKind = AccountKind.STUDENT,
aesIV = "09666dfddd5bbdacc8bb446df87530303130",
aesKey = "09666dfddd5bbdacc8bb446df87530303130",
aesKey = "",
skipCompression = true,
skipEncryption = true,
demo = true,
Expand Down
28 changes: 0 additions & 28 deletions library/src/commonTest/kotlin/ink/literate/pawnote/login.kt

This file was deleted.

Loading

0 comments on commit eb6c6a6

Please sign in to comment.