add projectByName function
This commit is contained in:
parent
8bd6ef3d5f
commit
14a40bfef0
13
build.gradle
13
build.gradle
@ -13,6 +13,15 @@ repositories {
|
|||||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects.each {
|
allprojects {
|
||||||
println(it)
|
ext {
|
||||||
|
projectByName = { name ->
|
||||||
|
for (subproject in rootProject.subprojects) {
|
||||||
|
if (subproject.name == name) {
|
||||||
|
return subproject
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ kotlin {
|
|||||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||||
api "com.insanusmokrassar:postssystem.utils.repos:$core_version"
|
api "com.insanusmokrassar:postssystem.utils.repos:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":utils:repos:postssystem.utils.repos.common")
|
api projectByName("postssystem.utils.repos.common")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ dependencies {
|
|||||||
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
||||||
api "com.insanusmokrassar:postssystem.exposed.commons:$core_version"
|
api "com.insanusmokrassar:postssystem.exposed.commons:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":core:postssystem.core.api")
|
api projectByName("postssystem.core.api")
|
||||||
api project(":exposed:postssystem.exposed.commons")
|
api projectByName("postssystem.exposed.commons")
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
||||||
|
@ -42,8 +42,8 @@ kotlin {
|
|||||||
api "com.insanusmokrassar:postssystem.core.ktor.common:$core_version"
|
api "com.insanusmokrassar:postssystem.core.ktor.common:$core_version"
|
||||||
api "com.insanusmokrassar:postssystem.ktor.client:$core_version"
|
api "com.insanusmokrassar:postssystem.ktor.client:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":core:ktor:postssystem.core.ktor.common")
|
api projectByName("postssystem.core.ktor.common")
|
||||||
api project(":ktor:postssystem.ktor.client")
|
api projectByName("postssystem.ktor.client")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,35 @@
|
|||||||
package com.insanusmokrassar.postssystem.core.ktor.client.content
|
package com.insanusmokrassar.postssystem.core.ktor.client.content
|
||||||
|
|
||||||
//import com.insanusmokrassar.postssystem.core.content.ContentId
|
import com.insanusmokrassar.postssystem.core.content.ContentId
|
||||||
//import com.insanusmokrassar.postssystem.core.content.RegisteredContent
|
import com.insanusmokrassar.postssystem.core.content.RegisteredContent
|
||||||
//import com.insanusmokrassar.postssystem.core.content.api.ReadContentRepo
|
import com.insanusmokrassar.postssystem.core.content.api.ReadContentRepo
|
||||||
//import com.insanusmokrassar.postssystem.core.ktor.getContentByIdRoute
|
import com.insanusmokrassar.postssystem.core.ktor.*
|
||||||
//import com.insanusmokrassar.postssystem.core.ktor.getContentsIdsRoute
|
import com.insanusmokrassar.postssystem.ktor.standardKtorSerializer
|
||||||
//import com.insanusmokrassar.postssystem.utils.repos.pagination.Pagination
|
import com.insanusmokrassar.postssystem.utils.repos.pagination.Pagination
|
||||||
//import com.insanusmokrassar.postssystem.utils.repos.pagination.PaginationResult
|
import com.insanusmokrassar.postssystem.utils.repos.pagination.PaginationResult
|
||||||
//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 kotlinx.serialization.builtins.nullable
|
||||||
//import kotlinx.io.InputStream
|
|
||||||
//
|
class ReadContentRepoKtorClient(
|
||||||
//class ReadContentRepoKtorClient(
|
private val client: HttpClient,
|
||||||
// private val client: HttpClient,
|
private val baseUrl: String
|
||||||
// private val baseUrl: String
|
) : ReadContentRepo {
|
||||||
//) : ReadContentRepo {
|
override suspend fun getContentsIds(): Set<ContentId> = client.get<ByteArray>(
|
||||||
// override suspend fun getContentsIds(): Set<ContentId> = client.get<HttpResponse>(
|
"$baseUrl/$getContentsIdsRoute"
|
||||||
// "$baseUrl/$getContentsIdsRoute"
|
).let {
|
||||||
// ).content.let {
|
standardKtorSerializer.load(contentIdsSerializer, it)
|
||||||
// TODO()
|
}
|
||||||
// }
|
|
||||||
//
|
override suspend fun getContentById(id: ContentId): RegisteredContent? = client.get<ByteArray>(
|
||||||
// override suspend fun getContentById(id: ContentId): RegisteredContent? {
|
"$baseUrl/$getContentByIdRoute"
|
||||||
// TODO("Not yet implemented")
|
).let {
|
||||||
// }
|
standardKtorSerializer.load(RegisteredContent.serializer().nullable, it)
|
||||||
//
|
}
|
||||||
// override suspend fun getContentByPagination(pagination: Pagination): PaginationResult<out RegisteredContent> {
|
|
||||||
// TODO("Not yet implemented")
|
override suspend fun getContentByPagination(pagination: Pagination): PaginationResult<out RegisteredContent> = client.get<ByteArray>(
|
||||||
// }
|
"$baseUrl/$getContentByPaginationRoute"
|
||||||
//}
|
).let {
|
||||||
|
standardKtorSerializer.load(registeredContentPaginationResultSerializer, it)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.insanusmokrassar.postssystem.core.ktor.client.content
|
||||||
|
|
||||||
|
import com.insanusmokrassar.postssystem.core.content.*
|
||||||
|
import com.insanusmokrassar.postssystem.core.content.api.WriteContentRepo
|
||||||
|
|
||||||
|
class WriteContentRepoKtorClient : WriteContentRepo {
|
||||||
|
override suspend fun registerContent(content: Content): RegisteredContent? {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun deleteContent(id: ContentId): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -42,8 +42,8 @@ kotlin {
|
|||||||
api "com.insanusmokrassar:postssystem.ktor.common:$core_version"
|
api "com.insanusmokrassar:postssystem.ktor.common:$core_version"
|
||||||
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":ktor:postssystem.ktor.common")
|
api projectByName("postssystem.ktor.common")
|
||||||
api project(":core:postssystem.core.api")
|
api projectByName("postssystem.core.api")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,3 +3,6 @@ package com.insanusmokrassar.postssystem.core.ktor
|
|||||||
const val getContentsIdsRoute = "getContentsIds"
|
const val getContentsIdsRoute = "getContentsIds"
|
||||||
const val getContentByIdRoute = "getContentById"
|
const val getContentByIdRoute = "getContentById"
|
||||||
const val getContentByPaginationRoute = "getContentByPagination"
|
const val getContentByPaginationRoute = "getContentByPagination"
|
||||||
|
|
||||||
|
const val registerContentRoute = "registerContent"
|
||||||
|
const val deleteContentRoute = "deleteContent"
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.insanusmokrassar.postssystem.core.ktor
|
||||||
|
|
||||||
|
import com.insanusmokrassar.postssystem.core.content.RegisteredContent
|
||||||
|
import com.insanusmokrassar.postssystem.ktor.setIdsSerializer
|
||||||
|
import com.insanusmokrassar.postssystem.utils.repos.pagination.PaginationResult
|
||||||
|
|
||||||
|
val contentIdsSerializer = setIdsSerializer
|
||||||
|
val registeredContentPaginationResultSerializer = PaginationResult.serializer(RegisteredContent.serializer())
|
@ -38,7 +38,7 @@ dependencies {
|
|||||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||||
api "com.insanusmokrassar:postssystem.utils.repos:$core_version"
|
api "com.insanusmokrassar:postssystem.utils.repos:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":utils:repos:postssystem.utils.repos.common")
|
api projectByName("postssystem.utils.repos.common")
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||||
|
@ -41,7 +41,7 @@ kotlin {
|
|||||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||||
api "com.insanusmokrassar:postssystem.ktor.common:$core_version"
|
api "com.insanusmokrassar:postssystem.ktor.common:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":ktor:postssystem.ktor.common")
|
api projectByName("postssystem.ktor.common")
|
||||||
}
|
}
|
||||||
|
|
||||||
api "io.ktor:ktor-client-core:$ktor_version"
|
api "io.ktor:ktor-client-core:$ktor_version"
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.insanusmokrassar.postssystem.ktor
|
||||||
|
|
||||||
|
import kotlinx.serialization.builtins.SetSerializer
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
val setIdsSerializer = SetSerializer(String.serializer())
|
@ -43,7 +43,7 @@ kotlin {
|
|||||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||||
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":core:postssystem.core.api")
|
api projectByName("postssystem.core.api")
|
||||||
}
|
}
|
||||||
|
|
||||||
api "com.soywiz.korlibs.klock:klock:$klockVersion"
|
api "com.soywiz.korlibs.klock:klock:$klockVersion"
|
@ -13,8 +13,8 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
project.version = "$core_version"
|
project.version = "$core_version"
|
||||||
@ -43,7 +43,7 @@ kotlin {
|
|||||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||||
api "com.insanusmokrassar:postssystem.markups.core:$core_version"
|
api "com.insanusmokrassar:postssystem.markups.core:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":markups")
|
api projectByName("postssystem.markups.commons")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ kotlin {
|
|||||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||||
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
api "com.insanusmokrassar:postssystem.core.api:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":core:postssystem.core.api")
|
api projectByName("postssystem.core.api")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ dependencies {
|
|||||||
api "com.insanusmokrassar:postssystem.core.publishing:$core_version"
|
api "com.insanusmokrassar:postssystem.core.publishing:$core_version"
|
||||||
api "com.insanusmokrassar:postssystem.exposed.commons:$core_version"
|
api "com.insanusmokrassar:postssystem.exposed.commons:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":publishing:postssystem.publishing.api")
|
api projectByName("postssystem.publishing.api")
|
||||||
api project(":exposed:postssystem.exposed.commons")
|
api projectByName("postssystem.exposed.commons")
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
||||||
|
@ -1,30 +1,25 @@
|
|||||||
rootProject.name='postssystem'
|
rootProject.name='postssystem'
|
||||||
|
|
||||||
String[] includes = [
|
String[] includes = [
|
||||||
':utils',
|
|
||||||
':utils:repos',
|
':utils:repos',
|
||||||
':utils:repos:common',
|
':utils:repos:common',
|
||||||
':utils:repos:exposed',
|
':utils:repos:exposed',
|
||||||
|
|
||||||
':exposed',
|
|
||||||
':exposed:commons',
|
':exposed:commons',
|
||||||
|
|
||||||
':ktor',
|
|
||||||
':ktor:common',
|
':ktor:common',
|
||||||
':ktor:client',
|
':ktor:client',
|
||||||
|
|
||||||
':core',
|
|
||||||
':core:api',
|
':core:api',
|
||||||
':core:exposed',
|
':core:exposed',
|
||||||
':core:ktor',
|
':core:ktor',
|
||||||
':core:ktor:common',
|
':core:ktor:common',
|
||||||
':core:ktor:client',
|
':core:ktor:client',
|
||||||
|
|
||||||
':publishing',
|
|
||||||
':publishing:api',
|
':publishing:api',
|
||||||
':publishing:exposed',
|
':publishing:exposed',
|
||||||
|
|
||||||
':markups',
|
':markups:commons',
|
||||||
':markups:html'
|
':markups:html'
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -32,6 +27,5 @@ String[] includes = [
|
|||||||
includes.each {
|
includes.each {
|
||||||
include it
|
include it
|
||||||
ProjectDescriptor project = project(it)
|
ProjectDescriptor project = project(it)
|
||||||
println(project.projectDir.absolutePath.replace(rootDir.absolutePath, ""))
|
|
||||||
project.name = rootProject.name + project.projectDir.absolutePath.replace(rootDir.absolutePath, "").replace("/", ".")
|
project.name = rootProject.name + project.projectDir.absolutePath.replace(rootDir.absolutePath, "").replace("/", ".")
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ dependencies {
|
|||||||
api "com.insanusmokrassar:postssystem.utils.repos:$core_version"
|
api "com.insanusmokrassar:postssystem.utils.repos:$core_version"
|
||||||
api "com.insanusmokrassar:postssystem.exposed.commons:$core_version"
|
api "com.insanusmokrassar:postssystem.exposed.commons:$core_version"
|
||||||
} else {
|
} else {
|
||||||
api project(":utils:repos:postssystem.utils.repos.common")
|
api projectByName("postssystem.utils.repos.common")
|
||||||
api project(":exposed:postssystem.exposed.commons")
|
api projectByName("postssystem.exposed.commons")
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
||||||
|
Loading…
Reference in New Issue
Block a user