start second (or third?) reborn

This commit is contained in:
InsanusMokrassar 2024-02-16 13:40:47 +06:00
parent ff973e63fc
commit e98a484c4d
72 changed files with 173 additions and 200 deletions

View File

@ -23,6 +23,7 @@ allprojects {
mavenCentral() mavenCentral()
google() google()
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" } maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
} }
} }

View File

@ -1,31 +1,6 @@
apply plugin: 'com.getkeepsafe.dexcount' apply plugin: 'com.getkeepsafe.dexcount'
android { android {
ext {
jvmKotlinFolderFile = {
String sep = File.separator
return new File("${project.projectDir}${sep}src${sep}jvmMain${sep}kotlin")
}
enableIncludingJvmCodeInAndroidPart = {
File jvmKotlinFolder = jvmKotlinFolderFile()
if (jvmKotlinFolder.exists()) {
android.sourceSets.main.java.srcDirs += jvmKotlinFolder.path
}
}
disableIncludingJvmCodeInAndroidPart = {
File jvmKotlinFolder = jvmKotlinFolderFile()
String[] oldDirs = android.sourceSets.main.java.srcDirs
android.sourceSets.main.java.srcDirs = []
for (oldDir in oldDirs) {
if (oldDir != jvmKotlinFolder.path) {
android.sourceSets.main.java.srcDirs += oldDir
}
}
}
}
compileSdkVersion libs.versions.android.props.compileSdk.get().toInteger() compileSdkVersion libs.versions.android.props.compileSdk.get().toInteger()
buildToolsVersion libs.versions.android.props.buildTools.get() buildToolsVersion libs.versions.android.props.buildTools.get()
@ -34,6 +9,7 @@ android {
targetSdkVersion libs.versions.android.props.compileSdk.get().toInteger() targetSdkVersion libs.versions.android.props.compileSdk.get().toInteger()
versionCode "${android_code_version}".toInteger() versionCode "${android_code_version}".toInteger()
versionName "$version" versionName "$version"
namespace "${project.group}.${project.name}"
} }
buildTypes { buildTypes {
release { release {
@ -51,18 +27,7 @@ android {
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_17
} }
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
sourceSets {
String sep = File.separator
main.java.srcDirs += "src${sep}main${sep}kotlin"
}
enableIncludingJvmCodeInAndroidPart()
} }

View File

@ -13,21 +13,6 @@ allprojects {
projectByName(name) projectByName(name)
} }
allTargetsConfiguration = { ->
kotlin {
targets.all {
compilations.all {
kotlinOptions {
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"
]
}
}
}
}
}
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle" mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
mppJavaProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJavaProject.gradle" mppJavaProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJavaProject.gradle"
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle" mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle"

View File

@ -1,7 +1,6 @@
package dev.inmo.postssystem.features.auth.client package dev.inmo.postssystem.features.auth.client
import dev.inmo.micro_utils.common.Either import dev.inmo.micro_utils.common.Either
import dev.inmo.micro_utils.ktor.client.UnifiedRequester
import dev.inmo.postssystem.features.auth.common.AuthKey import dev.inmo.postssystem.features.auth.common.AuthKey
import dev.inmo.postssystem.features.auth.common.AuthTokenInfo import dev.inmo.postssystem.features.auth.common.AuthTokenInfo
import dev.inmo.postssystem.features.common.common.AdditionalModules import dev.inmo.postssystem.features.common.common.AdditionalModules
@ -27,7 +26,6 @@ fun createAuthorizedFeaturesDIModule(
installClientAuthenticator(serverUrl, get(), get(AuthorizedQualifiers.CredsQualifier), onAuthKeyUpdated, onUserRetrieved, onAuthKeyInvalidated) installClientAuthenticator(serverUrl, get(), get(AuthorizedQualifiers.CredsQualifier), onAuthKeyUpdated, onUserRetrieved, onAuthKeyInvalidated)
} }
} }
single { UnifiedRequester(get(), get()) }
single { StatusFeatureClient(get(AuthorizedQualifiers.ServerUrlQualifier), get()) } single { StatusFeatureClient(get(AuthorizedQualifiers.ServerUrlQualifier), get()) }
AdditionalModules.Authorized.modules.forEach { AdditionalModules.Authorized.modules.forEach {

View File

@ -2,14 +2,14 @@ package dev.inmo.postssystem.features.auth.client
import dev.inmo.postssystem.features.auth.common.* import dev.inmo.postssystem.features.auth.common.*
import dev.inmo.postssystem.features.users.common.User import dev.inmo.postssystem.features.users.common.User
import dev.inmo.micro_utils.ktor.client.UnifiedRequester import dev.inmo.micro_utils.ktor.client.bodyOrNull
import dev.inmo.micro_utils.ktor.common.buildStandardUrl import dev.inmo.micro_utils.ktor.common.buildStandardUrl
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.request.HttpRequestBuilder import io.ktor.client.request.*
import kotlinx.serialization.builtins.nullable import kotlinx.serialization.builtins.nullable
class ClientAuthFeature( class ClientAuthFeature(
private val requester: UnifiedRequester, private val client: HttpClient,
baseUrl: String baseUrl: String
) : AuthFeature { ) : AuthFeature {
private val rootUrl = buildStandardUrl(baseUrl.dropLastWhile { it == '/' }, authRootPathPart) private val rootUrl = buildStandardUrl(baseUrl.dropLastWhile { it == '/' }, authRootPathPart)
@ -26,28 +26,23 @@ class ClientAuthFeature(
authGetMePathPart authGetMePathPart
) )
constructor(client: HttpClient, rootUrl: String): this( override suspend fun auth(creds: AuthCreds): AuthTokenInfo? = client.post(
UnifiedRequester(client), fullAuthPath
rootUrl ) {
) setBody(creds)
}.bodyOrNull()
override suspend fun auth(creds: AuthCreds): AuthTokenInfo? = requester.unipost( override suspend fun refresh(refresh: RefreshToken): AuthTokenInfo? = client.post(
fullAuthPath, fullRefreshPath
AuthCreds.serializer() to creds, ) {
AuthTokenInfo.serializer().nullable setBody(refresh)
) }.bodyOrNull()
override suspend fun refresh(refresh: RefreshToken): AuthTokenInfo? = requester.unipost( override suspend fun getMe(authToken: AuthToken): User? = client.post(
fullRefreshPath, fullGetMePath
RefreshToken.serializer() to refresh, ) {
AuthTokenInfo.serializer().nullable setBody(authToken)
) }.bodyOrNull()
override suspend fun getMe(authToken: AuthToken): User? = requester.unipost(
fullGetMePath,
AuthToken.serializer() to authToken,
User.serializer().nullable
)
fun isAuthRequest(builder: HttpRequestBuilder): Boolean = builder.url.buildString().let { fun isAuthRequest(builder: HttpRequestBuilder): Boolean = builder.url.buildString().let {
it == fullAuthPath || it == fullRefreshPath it == fullAuthPath || it == fullRefreshPath

View File

@ -37,7 +37,7 @@ fun HttpClientConfig<*>.installClientAuthenticator(
}.onSecond { }.onSecond {
currentRefreshToken = it.refresh currentRefreshToken = it.refresh
} }
val creds = initialAuthKey.t1 as? AuthCreds val creds = initialAuthKey.t1OrNull as? AuthCreds
var userRefreshJob: Job? = null var userRefreshJob: Job? = null
install("Auth Token Refresher") { install("Auth Token Refresher") {

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.auth.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.auth.common"/>

View File

@ -1,6 +1,6 @@
package dev.inmo.postssystem.features.auth.server.tokens package dev.inmo.postssystem.features.auth.server.tokens
import com.soywiz.klock.DateTime import korlibs.time.DateTime
import dev.inmo.postssystem.features.auth.common.AuthToken import dev.inmo.postssystem.features.auth.common.AuthToken
import dev.inmo.postssystem.features.auth.common.RefreshToken import dev.inmo.postssystem.features.auth.common.RefreshToken
import dev.inmo.postssystem.features.users.common.UserId import dev.inmo.postssystem.features.users.common.UserId

View File

@ -1,7 +1,7 @@
package dev.inmo.postssystem.features.auth.server.tokens package dev.inmo.postssystem.features.auth.server.tokens
import com.soywiz.klock.DateTime import korlibs.time.DateTime
import com.soywiz.klock.milliseconds import korlibs.time.milliseconds
import dev.inmo.postssystem.features.auth.common.* import dev.inmo.postssystem.features.auth.common.*
import dev.inmo.postssystem.features.common.common.Milliseconds import dev.inmo.postssystem.features.common.common.Milliseconds
import dev.inmo.postssystem.features.users.common.* import dev.inmo.postssystem.features.users.common.*

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.client.template.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.client.template.common"/>

View File

@ -1,8 +1,8 @@
package dev.inmo.postssystem.features.common.common.ui package dev.inmo.postssystem.features.common.common.ui
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import com.soywiz.klock.DateTime import korlibs.time.DateTime
import com.soywiz.klock.ISO8601 import korlibs.time.ISO8601
import org.jetbrains.compose.web.dom.Text import org.jetbrains.compose.web.dom.Text
object DateTimeView { object DateTimeView {

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.common.client"/>

View File

@ -1,6 +1,6 @@
package dev.inmo.postssystem.features.common.common package dev.inmo.postssystem.features.common.common
import com.soywiz.klock.DateTime import korlibs.time.DateTime
import kotlinx.serialization.KSerializer import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer import kotlinx.serialization.Serializer
import kotlinx.serialization.builtins.serializer import kotlinx.serialization.builtins.serializer

View File

@ -1,6 +1,7 @@
package dev.inmo.postssystem.features.common.common package dev.inmo.postssystem.features.common.common
import org.koin.core.definition.Definition import org.koin.core.definition.Definition
import org.koin.core.definition.KoinDefinition
import org.koin.core.instance.InstanceFactory import org.koin.core.instance.InstanceFactory
import org.koin.core.module.Module import org.koin.core.module.Module
import org.koin.core.qualifier.Qualifier import org.koin.core.qualifier.Qualifier
@ -11,6 +12,6 @@ inline fun <reified T : Any> Module.singleWithBinds(
qualifier: Qualifier? = null, qualifier: Qualifier? = null,
createdAtStart: Boolean = false, createdAtStart: Boolean = false,
noinline definition: Definition<T> noinline definition: Definition<T>
): Pair<Module, InstanceFactory<*>> { ): KoinDefinition<*> {
return single(qualifier, createdAtStart, definition) binds (T::class.allSuperclasses.toTypedArray()) return single(qualifier, createdAtStart, definition) binds (T::class.allSuperclasses.toTypedArray())
} }

View File

@ -0,0 +1,10 @@
package dev.inmo.postssystem.features.common.common
import dev.inmo.micro_utils.common.MPPFile
import dev.inmo.micro_utils.common.filename
import dev.inmo.micro_utils.mime_types.*
actual val MPPFile.mimeType: MimeType
get() {
return getMimeTypeOrAny(filename.extension)
}

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.common.common"/>

View File

@ -0,0 +1,11 @@
package dev.inmo.postssystem.features.common.common
import dev.inmo.micro_utils.common.MPPFile
import dev.inmo.micro_utils.common.filename
import dev.inmo.micro_utils.mime_types.MimeType
import dev.inmo.micro_utils.mime_types.getMimeTypeOrAny
actual val MPPFile.mimeType: MimeType
get() {
return getMimeTypeOrAny(filename.extension)
}

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.content.binary.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.content.binary.common"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.content.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.content.common"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.content.content.text.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.content.content.text.common"/>

View File

@ -2,28 +2,28 @@ package dev.inmo.postssystem.features.files.client
import dev.inmo.postssystem.features.files.common.* import dev.inmo.postssystem.features.files.common.*
import dev.inmo.postssystem.features.files.common.storage.ReadFilesStorage import dev.inmo.postssystem.features.files.common.storage.ReadFilesStorage
import dev.inmo.micro_utils.ktor.client.UnifiedRequester import dev.inmo.micro_utils.ktor.client.bodyOrNull
import dev.inmo.micro_utils.ktor.common.buildStandardUrl import dev.inmo.micro_utils.ktor.common.buildStandardUrl
import dev.inmo.micro_utils.repos.ReadCRUDRepo import dev.inmo.micro_utils.repos.ReadCRUDRepo
import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadStandardCrudRepo import dev.inmo.micro_utils.repos.ktor.client.crud.KtorReadCRUDRepoClient
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.request.post import io.ktor.client.request.*
import io.ktor.client.request.setBody
import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.readBytes import io.ktor.client.statement.readBytes
import io.ktor.http.ContentType
import io.ktor.http.encodeURLQueryComponent
import kotlinx.serialization.BinaryFormat import kotlinx.serialization.BinaryFormat
import kotlinx.serialization.builtins.nullable import kotlinx.serialization.builtins.nullable
class ClientReadFilesStorage( class ClientReadFilesStorage(
baseUrl: String, baseUrl: String,
private val client: HttpClient, private val client: HttpClient,
private val serialFormat: BinaryFormat private val serialFormat: BinaryFormat,
) : ReadFilesStorage, ReadCRUDRepo<MetaFileInfoStorageWrapper, FileId> by KtorReadStandardCrudRepo( contentType: ContentType
) : ReadFilesStorage, ReadCRUDRepo<MetaFileInfoStorageWrapper, FileId> by KtorReadCRUDRepoClient<MetaFileInfoStorageWrapper, FileId>(
buildStandardUrl(baseUrl, filesRootPathPart), buildStandardUrl(baseUrl, filesRootPathPart),
UnifiedRequester(client, serialFormat), client,
MetaFileInfoStorageWrapper.serializer(), contentType,
MetaFileInfoStorageWrapper.serializer().nullable, { it.string.encodeURLQueryComponent() }
FileId.serializer()
) { ) {
private val fullFilesPath = buildStandardUrl(baseUrl, filesRootPathPart) private val fullFilesPath = buildStandardUrl(baseUrl, filesRootPathPart)
private val fullFilesGetBytesPath = buildStandardUrl( private val fullFilesGetBytesPath = buildStandardUrl(
@ -37,12 +37,11 @@ class ClientReadFilesStorage(
override suspend fun getFullFileInfo( override suspend fun getFullFileInfo(
id: FileId id: FileId
): FullFileInfoStorageWrapper? = unifiedRequester.uniget( ): FullFileInfoStorageWrapper? = client.get(
buildStandardUrl( buildStandardUrl(
fullFilesPath, fullFilesPath,
filesGetFullFileInfoPathPart, filesGetFullFileInfoPathPart,
filesFileIdParameter to unifiedRequester.encodeUrlQueryValue(FileId.serializer(), id) filesFileIdParameter to id.string.encodeURLQueryComponent()
),
FullFileInfoStorageWrapper.serializer().nullable
) )
).bodyOrNull()
} }

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.files.client"/>

View File

@ -61,4 +61,8 @@ class DiskReadFilesStorage(
} }
) )
} }
override suspend fun getIdsByPagination(pagination: Pagination): PaginationResult<FileId> {
return metasKeyValueRepo.keys(pagination)
}
} }

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.files.common"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.posts.client"/>

View File

@ -1,6 +1,6 @@
package dev.inmo.postssystem.features.posts.common package dev.inmo.postssystem.features.posts.common
import com.soywiz.klock.DateTime import korlibs.time.DateTime
import dev.inmo.postssystem.features.common.common.DateTimeSerializer import dev.inmo.postssystem.features.common.common.DateTimeSerializer
import dev.inmo.postssystem.features.content.common.Content import dev.inmo.postssystem.features.content.common.Content
import dev.inmo.postssystem.features.content.common.ContentId import dev.inmo.postssystem.features.content.common.ContentId

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.posts.common"/>

View File

@ -1,6 +1,6 @@
package dev.inmo.postssystem.features.posts.server package dev.inmo.postssystem.features.posts.server
import com.soywiz.klock.DateTime import korlibs.time.DateTime
import dev.inmo.micro_utils.repos.exposed.* import dev.inmo.micro_utils.repos.exposed.*
import dev.inmo.postssystem.features.content.common.ContentId import dev.inmo.postssystem.features.content.common.ContentId
import dev.inmo.postssystem.features.posts.common.* import dev.inmo.postssystem.features.posts.common.*

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.publication.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.publication.common"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.roles.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.roles.common"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.roles.manager.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.roles.manager.common"/>

View File

@ -2,11 +2,9 @@ package dev.inmo.postssystem.features.status.client
import dev.inmo.postssystem.features.status.common.statusAuthorisedPathPart import dev.inmo.postssystem.features.status.common.statusAuthorisedPathPart
import dev.inmo.postssystem.features.status.common.statusRootPart import dev.inmo.postssystem.features.status.common.statusRootPart
import dev.inmo.micro_utils.ktor.client.UnifiedRequester
import dev.inmo.micro_utils.ktor.common.buildStandardUrl import dev.inmo.micro_utils.ktor.common.buildStandardUrl
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.request.get import io.ktor.client.request.get
import io.ktor.client.statement.HttpResponse
import io.ktor.http.HttpStatusCode import io.ktor.http.HttpStatusCode
class StatusFeatureClient( class StatusFeatureClient(

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.status.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.status.common"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.template.client"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.template.common"/>

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.users.client"/>

View File

@ -21,7 +21,3 @@ kotlin {
} }
} }
} }
android {
disableIncludingJvmCodeInAndroidPart()
}

View File

@ -31,7 +31,7 @@ sealed class User : NewUser {
} }
@Serializable @Serializable
data class DefaultUser( data class RegisteredUser(
override val id: UserId, override val id: UserId,
override val firstName: String, override val firstName: String,
override val lastName: String, override val lastName: String,

View File

@ -3,8 +3,7 @@ package dev.inmo.postssystem.features.users.common
import dev.inmo.micro_utils.repos.exposed.AbstractExposedCRUDRepo import dev.inmo.micro_utils.repos.exposed.AbstractExposedCRUDRepo
import dev.inmo.micro_utils.repos.exposed.initTable import dev.inmo.micro_utils.repos.exposed.initTable
import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.statements.InsertStatement import org.jetbrains.exposed.sql.statements.*
import org.jetbrains.exposed.sql.statements.UpdateStatement
class ExposedUsersStorage(override val database: Database) : UsersStorage, AbstractExposedCRUDRepo<User, UserId, NewUser>( class ExposedUsersStorage(override val database: Database) : UsersStorage, AbstractExposedCRUDRepo<User, UserId, NewUser>(
tableName = "Users" tableName = "Users"
@ -15,11 +14,12 @@ class ExposedUsersStorage(override val database: Database) : UsersStorage, Abstr
private val lastNameColumn = text("lastName") private val lastNameColumn = text("lastName")
override val primaryKey: PrimaryKey = PrimaryKey(userIdColumn) override val primaryKey: PrimaryKey = PrimaryKey(userIdColumn)
override val selectById: ISqlExpressionBuilder.(UserId) -> Op<Boolean> = { userIdColumn.eq(it.long) }
override val ResultRow.asId: UserId
get() = UserId(get(userIdColumn))
override val selectByIds: SqlExpressionBuilder.(List<UserId>) -> Op<Boolean> = { userIdColumn.inList(it.map { it.long }) }
override val selectById: SqlExpressionBuilder.(UserId) -> Op<Boolean> = { userIdColumn.eq(it.long) }
override val ResultRow.asObject: User override val ResultRow.asObject: User
get() = DefaultUser( get() = RegisteredUser(
get(userIdColumn).userId, get(userIdColumn).userId,
get(firstNameColumn), get(firstNameColumn),
get(lastNameColumn), get(lastNameColumn),
@ -36,13 +36,13 @@ class ExposedUsersStorage(override val database: Database) : UsersStorage, Abstr
it[lastNameColumn] = value.lastName it[lastNameColumn] = value.lastName
} }
override fun update(id: UserId, value: NewUser, it: UpdateStatement) { override fun update(id: UserId?, value: NewUser, it: UpdateBuilder<Int>) {
it[usernameColumn] = value.username.string it[usernameColumn] = value.username.string
it[firstNameColumn] = value.firstName it[firstNameColumn] = value.firstName
it[lastNameColumn] = value.lastName it[lastNameColumn] = value.lastName
} }
override fun InsertStatement<Number>.asObject(value: NewUser): User = DefaultUser( override fun InsertStatement<Number>.asObject(value: NewUser): User = RegisteredUser(
get(userIdColumn).userId, get(userIdColumn).userId,
get(firstNameColumn), get(firstNameColumn),
get(lastNameColumn), get(lastNameColumn),

View File

@ -1 +0,0 @@
<manifest package="dev.inmo.postssystem.features.users.common"/>

View File

@ -1,39 +1,42 @@
[versions] [versions]
kotlin = "1.6.21" kotlin = "1.9.22"
kotlin-serialization = "1.3.3" kotlin-serialization = "1.6.2"
jsuikit = "0.1.7" kotlin-coroutines = "1.7.3"
compose = "1.2.0-alpha01-dev709" jsuikit = "0.7.4"
microutils = "0.11.1" compose = "1.5.12"
tgbotapi = "2.0.2" microutils = "0.20.34"
ktor = "2.0.2" tgbotapi = "10.0.1"
klock = "2.7.0" ktor = "2.3.8"
koin = "3.2.0" korlibs = "5.3.1"
exposed = "0.38.2" koin = "3.5.3"
exposed = "0.47.0"
psql = "42.3.6" psql = "42.3.6"
scrimage = "4.0.31" scrimage = "4.1.1"
dokka = "1.6.21" dokka = "1.9.10"
logback = "1.2.10" logback = "1.2.10"
uuid = "0.4.1" uuid = "0.8.2"
android-junit = "4.12" android-junit = "4.12"
android-test-junit = "1.1.2" android-test-junit = "1.1.2"
android-espresso-core = "3.3.0" android-espresso-core = "3.3.0"
gh-release = "2.3.7" gh-release = "2.5.1"
android-gradle = "7.0.4" android-gradle = "8.2.2"
dexcount = "3.1.0" dexcount = "3.1.0"
android-coreKtx = "1.7.0" android-coreKtx = "1.12.0"
android-recyclerView = "1.2.1" android-recyclerView = "1.2.1"
android-appCompat = "1.4.1" android-appCompat = "1.4.1"
android-fragment = "1.6.2"
android-compose-material3 = "1.1.2"
android-espresso = "3.3.0" android-espresso = "3.3.0"
android-test = "1.1.2" android-test = "1.1.2"
android-props-minSdk = "19" android-props-minSdk = "21"
android-props-compileSdk = "32" android-props-compileSdk = "34"
android-props-buildTools = "32.0.0" android-props-buildTools = "34.0.0"
[libraries] [libraries]
@ -42,6 +45,10 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref =
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization" } kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization" }
kotlin-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlin-serialization" } kotlin-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlin-serialization" }
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlin-coroutines" }
kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlin-coroutines" }
jsuikit = { module = "dev.inmo:kjsuikit", version.ref = "jsuikit" } jsuikit = { module = "dev.inmo:kjsuikit", version.ref = "jsuikit" }
postgresql = { module = "org.postgresql:postgresql", version.ref = "psql" } postgresql = { module = "org.postgresql:postgresql", version.ref = "psql" }
@ -81,12 +88,18 @@ microutils-serialization-typedserializer = { module = "dev.inmo:micro_utils.seri
tgbotapi = { module = "dev.inmo:tgbotapi", version.ref = "tgbotapi" } tgbotapi = { module = "dev.inmo:tgbotapi", version.ref = "tgbotapi" }
klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "klock" } klock = { module = "com.soywiz.korge:korlibs-time", version.ref = "korlibs" }
krypto = { module = "com.soywiz.korge:korlibs-crypto", version.ref = "korlibs" }
scrimage = { module = "com.sksamuel.scrimage:scrimage-core", version.ref = "scrimage" } scrimage = { module = "com.sksamuel.scrimage:scrimage-core", version.ref = "scrimage" }
androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "android-test-junit" } android-coreKtx = { module = "androidx.core:core-ktx", version.ref = "android-coreKtx" }
androidx-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "android-espresso-core" } android-recyclerView = { module = "androidx.recyclerview:recyclerview", version.ref = "android-recyclerView" }
android-appCompat-resources = { module = "androidx.appcompat:appcompat-resources", version.ref = "android-appCompat" }
android-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "android-compose-material3" }
android-fragment = { module = "androidx.fragment:fragment", version.ref = "android-fragment" }
android-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "android-espresso" }
android-test-junit = { module = "androidx.test.ext:junit", version.ref = "android-test" }
# classpaths # classpaths

View File

@ -1,4 +1,4 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@ -1,11 +1,16 @@
project.version = "$version" project.version = "$version"
project.group = "$group" project.group = "$group"
// apply from: "$publishGradlePath" apply from: "$publishGradlePath"
kotlin { kotlin {
android { androidTarget {
publishAllLibraryVariants() publishAllLibraryVariants()
compilations.all {
kotlinOptions {
jvmTarget = "17"
}
}
} }
sourceSets { sourceSets {
@ -18,18 +23,15 @@ kotlin {
dependencies { dependencies {
implementation kotlin('test-common') implementation kotlin('test-common')
implementation kotlin('test-annotations-common') implementation kotlin('test-annotations-common')
} implementation libs.kt.coroutines.test
}
androidTest {
dependencies {
implementation kotlin('test-junit')
implementation libs.androidx.test.junit
implementation libs.androidx.espresso
} }
} }
} }
allTargetsConfiguration()
} }
apply from: "$defaultAndroidSettingsPresetPath" apply from: "$defaultAndroidSettingsPresetPath"
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

View File

@ -4,7 +4,13 @@ project.group = "$group"
apply from: "$publishGradlePath" apply from: "$publishGradlePath"
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "17"
}
}
}
sourceSets { sourceSets {
commonMain { commonMain {
@ -16,6 +22,7 @@ kotlin {
dependencies { dependencies {
implementation kotlin('test-common') implementation kotlin('test-common')
implementation kotlin('test-annotations-common') implementation kotlin('test-annotations-common')
implementation libs.kotlin.coroutines.test
} }
} }
@ -25,11 +32,9 @@ kotlin {
} }
} }
} }
allTargetsConfiguration()
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_17
} }

View File

@ -13,12 +13,14 @@ kotlin {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib') implementation kotlin('stdlib')
api libs.kotlin.serialization
} }
} }
commonTest { commonTest {
dependencies { dependencies {
implementation kotlin('test-common') implementation kotlin('test-common')
implementation kotlin('test-annotations-common') implementation kotlin('test-annotations-common')
implementation libs.kotlin.coroutines.test
} }
} }
jsTest { jsTest {
@ -28,6 +30,9 @@ kotlin {
} }
} }
} }
}
allTargetsConfiguration()
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
} }

View File

@ -4,19 +4,30 @@ project.group = "$group"
apply from: "$publishGradlePath" apply from: "$publishGradlePath"
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "17"
}
}
}
js (IR) { js (IR) {
browser() browser()
nodejs() nodejs()
} }
android { androidTarget {
publishAllLibraryVariants() publishAllLibraryVariants()
compilations.all {
kotlinOptions {
jvmTarget = "17"
}
}
} }
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation libs.kotlin.std implementation kotlin('stdlib')
api libs.kotlin.serialization api libs.kotlin.serialization
} }
} }
@ -24,6 +35,7 @@ kotlin {
dependencies { dependencies {
implementation kotlin('test-common') implementation kotlin('test-common')
implementation kotlin('test-annotations-common') implementation kotlin('test-annotations-common')
implementation libs.kotlin.coroutines.test
} }
} }
jvmTest { jvmTest {
@ -37,21 +49,21 @@ kotlin {
implementation kotlin('test-junit') implementation kotlin('test-junit')
} }
} }
androidTest { androidUnitTest {
dependencies { dependencies {
implementation kotlin('test-junit') implementation kotlin('test-junit')
implementation libs.androidx.test.junit implementation libs.android.test.junit
implementation libs.androidx.espresso implementation libs.android.espresso
}
} }
} }
allTargetsConfiguration() androidMain.dependsOn jvmMain
}
} }
apply from: "$defaultAndroidSettingsPresetPath" apply from: "$defaultAndroidSettingsPresetPath"
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_17
} }

View File

@ -1,7 +1,7 @@
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
task javadocsJar(type: Jar) { task javadocsJar(type: Jar) {
classifier = 'javadoc' archiveClassifier = 'javadoc'
} }
publishing { publishing {
@ -49,12 +49,15 @@ publishing {
maven { maven {
name = "GitHubPackages" name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/PostsSystem/core") url = uri("https://maven.pkg.github.com/PostsSystem/core")
credentials { credentials {
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
} }
} }
} }
} }
} }
} }

View File

@ -83,5 +83,3 @@ includes.each { originalName ->
project.projectDir = new File(projectDirectory) project.projectDir = new File(projectDirectory)
println(project) println(project)
} }
enableFeaturePreview("VERSION_CATALOGS")