This commit is contained in:
InsanusMokrassar 2021-02-22 01:48:48 +06:00
parent e6764197d3
commit 3fe45e4aec
10 changed files with 23 additions and 193 deletions

172
README.md
View File

@ -1,169 +1,7 @@
# How to use
# TelegramBotAPI Libraries
That is a template for Kotlin Multiplatform Projects. How to use it:
This project was created due to neccessity of additional libraries over [tgbotapi](https://github.com/InsanusMokrassar/TelegramBotAPI).
Currently there are plans to create several libraries at the start of this project:
* Create your repository from this template
* Add `local.properties` file in case you plan to use `Android` target (you must set up location of SDK, it will not be tracked by `git` and it is correct behaviour). In the snippet below you may see approximate content of `local.properties` file:
```properties
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/your/path/to/android/sdk
```
* Replace in a whole project `project_group` by your group
* Replace in a whole project `project_name` by your **ROOT** project name
* Update your subproject packages. It is not critical, but recommended especially in case you plan to publish your
library
## Subprojects
In this template there is only one subproject with name `lib`. You are always able to rename it, but remember that in
this case you must rename it in `settings.gradle` file.
## Types of projects
### `mppProjectWithSerialization`
This type of preset have `JVM`, `JS` and `Android` targets and available using
`apply from: "$mppProjectWithSerializationPresetPath"`. Template for project with this preset looks like next snippet:
```groovy
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
}
apply from: "$mppProjectWithSerializationPresetPath"
// The code below is optional
kotlin {
sourceSets {
commonMain {
dependencies {
// common dependencies
}
}
commonTest {
dependencies {
// common test dependencies
}
}
jvmMain {
dependencies {
// jvm dependencies
}
}
jvmTest {
dependencies {
// jvm test dependencies
}
}
jsMain {
dependencies {
// js dependencies
}
}
jsTest {
dependencies {
// js test dependencies
}
}
androidMain {
dependencies {
// android dependencies
}
}
androidTest {
dependencies {
// android test dependencies
}
}
}
}
```
### `mppJavaProject`
This type of preset have only `JVM` target and available using `apply from: "$mppJavaProjectPresetPath"`. Template for
project with this preset looks like next snippet:
```groovy
plugins {
id "org.jetbrains.kotlin.multiplatform"
}
apply from: "$mppJavaProjectPresetPath"
// The code below is optional
kotlin {
sourceSets {
commonMain {
dependencies {
// common dependencies
}
}
commonTest {
dependencies {
// common test dependencies
}
}
jvmMain {
dependencies {
// jvm dependencies
}
}
jvmTest {
dependencies {
// jvm test dependencies
}
}
}
}
```
### `mppAndroidProject`
This type of preset have only `Android` target and available using `apply from: "$mppAndroidProjectPresetPath"`. Template for
project with this preset looks like next snippet:
```groovy
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "com.android.library"
}
apply from: "$mppAndroidProjectPresetPath"
// The code below is optional
kotlin {
sourceSets {
commonMain {
dependencies {
// common dependencies
}
}
commonTest {
dependencies {
// common test dependencies
}
}
androidMain {
dependencies {
// android dependencies
}
}
androidTest {
dependencies {
// android test dependencies
}
}
}
}
```
* Cache library for media (saving and autorefreshing of `fileId`)
* Cache library for admins (saving chat admins, autoupdate and refreshing by command (maybe))

View File

@ -0,0 +1 @@
<manifest package="dev.inmo.tgbotapi.libraries.cache.admins"/>

8
cache/media/build.gradle vendored Normal file
View File

@ -0,0 +1,8 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
}
apply from: "$mppProjectWithSerializationPresetPath"

View File

@ -0,0 +1 @@
<manifest package="dev.inmo.tgbotapi.libraries.cache.media"/>

View File

@ -9,7 +9,10 @@ android.enableJetifier=true
kotlin_version=1.4.30
kotlin_serialisation_core_version=1.1.0
# github_release_plugin_version=2.2.12
github_release_plugin_version=2.2.12
tgbotapi_version=0.32.8
micro_utils_version=0.4.26
# ANDROID
@ -27,6 +30,6 @@ dokka_version=1.4.20
# Project data
group=project_group
group=dev.inmo
version=0.0.1
android_code_version=1

View File

@ -1,7 +0,0 @@
package project_group
class Library {
fun someLibraryMethod(): Boolean {
return true
}
}

View File

@ -1,14 +0,0 @@
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package project_group
import kotlin.test.Test
import kotlin.test.assertTrue
class LibraryTest {
@Test fun testSomeLibraryMethod() {
val classUnderTest = Library()
assertTrue(classUnderTest.someLibraryMethod(), "someLibraryMethod should return 'true'")
}
}

View File

@ -1 +0,0 @@
<manifest package="project_group.lib"/>

View File

@ -1,7 +1,8 @@
rootProject.name = 'project_name'
rootProject.name = 'tgbotapi.libraries'
String[] includes = [
":lib"
":cache:admins",
":cache:media"
]