Skip to content

Commit 9465397

Browse files
authored
Merge pull request #373 from pengrad/kotlin-support
Add Kotlin
2 parents 4e28fdd + 272f360 commit 9465397

37 files changed

+271
-465
lines changed

.github/workflows/pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
cache: 'gradle'
2121

2222
- name: Gradle PR Test
23-
run: ./gradlew clean prTest
23+
run: ./gradlew clean check -PprTest

library/build.gradle

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
plugins {
22
id "java-library"
3+
id 'jacoco'
4+
id "org.jetbrains.kotlin.jvm" version "1.9.22"
35
}
4-
apply plugin: 'jacoco'
56

67
sourceCompatibility = 1.8
78
targetCompatibility = 1.8
@@ -10,6 +11,7 @@ dependencies {
1011
api 'com.google.code.gson:gson:2.10.1'
1112
api 'com.squareup.okhttp3:okhttp:4.12.0'
1213
api 'com.squareup.okhttp3:logging-interceptor:4.12.0'
14+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
1315

1416
testImplementation 'junit:junit:4.13.1'
1517
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.13'
@@ -41,6 +43,14 @@ test {
4143
if (project.hasProperty('excludeTests')) {
4244
exclude project.property('excludeTests')
4345
}
46+
if (project.hasProperty('prTest')) {
47+
// TODO move "functional" tests into specific dir and exclude it
48+
exclude '**/Base64Test.class'
49+
exclude '**/CheckTelegramAuthTest.class'
50+
exclude '**/PaymentsTest.class'
51+
exclude '**/TelegramBotTest.class'
52+
exclude '**/UpdatesListenerTest.class'
53+
}
4454
}
4555

4656
tasks.withType(Test).configureEach {
@@ -49,13 +59,4 @@ tasks.withType(Test).configureEach {
4959
}
5060
}
5161

52-
tasks.register('prTest', Test) {
53-
// TODO move "functional" tests into specific dir and exclude it
54-
exclude '**/Base64Test.class'
55-
exclude '**/CheckTelegramAuthTest.class'
56-
exclude '**/PaymentsTest.class'
57-
exclude '**/TelegramBotTest.class'
58-
exclude '**/UpdatesListenerTest.class'
59-
}
60-
6162
apply from: rootProject.file('gradle/gradle-publish-plugin.gradle')

library/src/main/java/com/pengrad/telegrambot/model/Audio.java

-103
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.pengrad.telegrambot.model
2+
3+
/**
4+
* stas
5+
* 8/5/15.
6+
*/
7+
data class Audio(
8+
@get:JvmName("fileId") val fileId: String? = null,
9+
@get:JvmName("fileUniqueId") val fileUniqueId: String? = null,
10+
@get:JvmName("duration") val duration: Int? = null,
11+
@get:JvmName("performer") val performer: String? = null,
12+
@get:JvmName("title") val title: String? = null,
13+
@get:JvmName("fileName") val fileName: String? = null,
14+
@get:JvmName("mimeType") val mimeType: String? = null,
15+
@get:JvmName("fileSize") val fileSize: Long? = null,
16+
@get:JvmName("thumbnail") val thumbnail: PhotoSize? = null,
17+
)

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandScope.java

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
open class BotCommandScope(val type: String)

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandScopeAllChatAdministrators.java

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
class BotCommandScopeAllChatAdministrators : BotCommandScope(type = "all_chat_administrators")

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandScopeAllGroupChats.java

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
class BotCommandScopeAllGroupChats : BotCommandScope(type = "all_group_chats")

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandScopeAllPrivateChats.java

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
class BotCommandScopeAllPrivateChats : BotCommandScope(type = "all_private_chats")

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandScopeDefault.java

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
class BotCommandScopeDefault : BotCommandScope(type = "default")

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandsScopeChat.java

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
class BotCommandsScopeChat(val chatId: Any) : BotCommandScope(type = "chat")

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandsScopeChatAdministrators.java

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
class BotCommandsScopeChatAdministrators(val chatId: Any) : BotCommandScope(type = "chat_administrators")

library/src/main/java/com/pengrad/telegrambot/model/botcommandscope/BotCommandsScopeChatMember.java

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.pengrad.telegrambot.model.botcommandscope
2+
3+
class BotCommandsScopeChatMember(val chatId: Any, val userId: Long) : BotCommandScope(type = "chat_member")

library/src/main/java/com/pengrad/telegrambot/model/request/CallbackGame.java

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.pengrad.telegrambot.model.request
2+
3+
/**
4+
* Stas Parshin
5+
* 04 June 2019
6+
*/
7+
object CallbackGame
8+
9+

library/src/main/java/com/pengrad/telegrambot/model/request/ChatAction.java renamed to library/src/main/java/com/pengrad/telegrambot/model/request/ChatAction.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
package com.pengrad.telegrambot.model.request;
1+
package com.pengrad.telegrambot.model.request
22

33
/**
44
* stas
55
* 10/21/15.
66
*/
7-
public enum ChatAction {
7+
@Suppress("EnumEntryName")
8+
enum class ChatAction {
89
typing,
910
upload_photo,
1011
record_video,

library/src/main/java/com/pengrad/telegrambot/model/request/ForceReply.java

-33
This file was deleted.

0 commit comments

Comments
 (0)