1 Commits

Author SHA1 Message Date
2a08f28838 refactor(config): 使用 URL 生成缺省仓库 Id.
在使用过程中, 发现 Aether 会根据仓库 Id 保存一些元信息, 所以尝试以 URL 生成仓库 Id, 或许有利于 Aether 存取仓库元信息.
改动仍需观望.
2022-08-18 00:59:51 +08:00
23 changed files with 128 additions and 608 deletions

View File

@ -1,2 +0,0 @@
**/
!scalabot-app/build/install/

View File

@ -1,33 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
# - package-ecosystem: "gradle"
# directory: "/scalabot-app"
# schedule:
# interval: "weekly"
# - package-ecosystem: "gradle"
# directory: "/scalabot-meta"
# schedule:
# interval: "weekly"
# - package-ecosystem: "gradle"
# directory: "/scalabot-extension"
# schedule:
# interval: "weekly"
# - package-ecosystem: "gradle"
# directory: "/scalabot-ext-example"
# schedule:
# interval: "weekly"

View File

@ -1,36 +0,0 @@
name: Binary compatibility verification (for API)
on:
push:
paths:
- 'scalabot-meta/**'
- 'scalabot-extension/**'
pull_request:
paths:
- 'scalabot-meta/**'
- 'scalabot-extension/**'
permissions:
contents: read
jobs:
apiCompatibilityCheck:
timeout-minutes: 8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and run binary compatibility verification
uses: gradle/gradle-build-action@v2.11.0
with:
gradle-version: 'wrapper'
arguments: apiCheck

View File

@ -18,18 +18,17 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
java-version: '11' java-version: '11'
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
cache: 'gradle' cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1 - name: Grant execute permission for gradlew
- name: Grant execute permission for gradlew run: chmod +x gradlew
run: chmod +x gradlew - name: Build and test
- name: Build and test uses: gradle/gradle-build-action@v2.2.1
uses: gradle/gradle-build-action@v2.11.0 with:
with: gradle-version: 'wrapper'
gradle-version: 'wrapper' arguments: test
arguments: test

View File

@ -1,65 +0,0 @@
name: Create release draft
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
# 该 Action 有以下步骤:
# 1. 拉取并构建代码, 然后生成 Application 发行包;
# 2. 创建 Release, 并标记为 Draft(草稿);
# 3. 上传 Application 发行包;
permissions:
contents: write
jobs:
create-release:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# 创建更新日志.
- name: 'Get Previous tag'
id: previous-tag
uses: younited/get-previous-tag-action@v1.1.0
with:
match: "v*.*.*"
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Commitizen
run: pip install -U commitizen
- name: Create Change log
run: cz ch --start-rev ${{ steps.previous-tag.outputs.previous-tag }} --file-name ${{ github.workspace }}/CURRENT_CHANGELOG.md
# 开始构建项目.
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test
uses: gradle/gradle-build-action@v2.11.0
with:
gradle-version: 'wrapper'
arguments: clean test assembleDist
# 创建新的发行版本
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: true
body_path: ${{ github.workspace }}/CURRENT_CHANGELOG.md
files: |
*/build/distributions/*
*/build/libs/*

View File

@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1

View File

@ -1,49 +0,0 @@
name: Publish artifacts
on:
release:
types:
- published
env:
IMAGE_NAME: lamgc/scalabot
jobs:
publish-container-image:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test
uses: gradle/gradle-build-action@v2.11.0
with:
gradle-version: 'wrapper'
arguments: clean test installDist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_NAME }}:latest, ${{ env.IMAGE_NAME }}:${{ github.ref_name }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -1,49 +0,0 @@
name: Build development version container image
on:
push:
branches:
- "main"
permissions:
contents: read
jobs:
build:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt-hotspot'
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build project and install Distribution package
uses: gradle/gradle-build-action@v2.11.0
with:
gradle-version: 'wrapper'
arguments: installDist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: lamgc/scalabot:dev
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -1,8 +0,0 @@
FROM openjdk:18
ENV BOT_DATA_PATH /scalabot/data/
WORKDIR /scalabot/run/
CMD ["/scalabot/app/bin/scalabot-app"]
COPY scalabot-app/build/install/scalabot-app/ /scalabot/app/

View File

@ -1,7 +1,6 @@
plugins { plugins {
kotlin("jvm") version "1.9.10" apply false kotlin("jvm") version "1.7.10" apply false
id("org.jetbrains.kotlinx.kover") version "0.7.4" apply false id("org.jetbrains.kotlinx.kover") version "0.5.1" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" apply false
} }
allprojects { allprojects {
@ -13,5 +12,5 @@ allprojects {
} }
group = "net.lamgc" group = "net.lamgc"
version = "0.6.1" version = "0.5.0"
} }

View File

@ -10,9 +10,9 @@ dependencies {
implementation(project(":scalabot-meta")) implementation(project(":scalabot-meta"))
implementation(project(":scalabot-extension")) implementation(project(":scalabot-extension"))
implementation("org.slf4j:slf4j-api:2.0.9") implementation("org.slf4j:slf4j-api:1.7.36")
implementation("io.github.microutils:kotlin-logging:3.0.5") implementation("io.github.microutils:kotlin-logging:2.1.23")
implementation("ch.qos.logback:logback-classic:1.4.11") implementation("ch.qos.logback:logback-classic:1.2.11")
val aetherVersion = "1.1.0" val aetherVersion = "1.1.0"
implementation("org.eclipse.aether:aether-api:$aetherVersion") implementation("org.eclipse.aether:aether-api:$aetherVersion")
@ -23,20 +23,20 @@ dependencies {
implementation("org.eclipse.aether:aether-connector-basic:$aetherVersion") implementation("org.eclipse.aether:aether-connector-basic:$aetherVersion")
implementation("org.apache.maven:maven-aether-provider:3.3.9") implementation("org.apache.maven:maven-aether-provider:3.3.9")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.21") implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20")
implementation("com.google.code.gson:gson:2.10.1") implementation("com.google.code.gson:gson:2.9.0")
implementation("org.jdom:jdom2:2.0.6.1") implementation("org.jdom:jdom2:2.0.6.1")
implementation("org.telegram:telegrambots-abilities:6.8.0") implementation("org.telegram:telegrambots-abilities:6.1.0")
implementation("org.telegram:telegrambots:6.8.0") implementation("org.telegram:telegrambots:6.1.0")
implementation("io.prometheus:simpleclient:0.16.0") implementation("io.prometheus:simpleclient:0.15.0")
implementation("io.prometheus:simpleclient_httpserver:0.16.0") implementation("io.prometheus:simpleclient_httpserver:0.15.0")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
testImplementation("io.mockk:mockk:1.13.8") testImplementation("io.mockk:mockk:1.12.4")
testImplementation("com.github.stefanbirkner:system-lambda:1.2.1") testImplementation("com.github.stefanbirkner:system-lambda:1.2.1")
} }

View File

@ -1,6 +1,7 @@
package net.lamgc.scalabot package net.lamgc.scalabot
import ch.qos.logback.core.PropertyDefinerBase import ch.qos.logback.core.PropertyDefinerBase
import com.google.common.net.InternetDomainName
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import com.google.gson.JsonArray import com.google.gson.JsonArray
@ -12,13 +13,12 @@ import org.eclipse.aether.repository.Authentication
import org.eclipse.aether.repository.Proxy import org.eclipse.aether.repository.Proxy
import org.eclipse.aether.repository.RemoteRepository import org.eclipse.aether.repository.RemoteRepository
import org.eclipse.aether.repository.RepositoryPolicy import org.eclipse.aether.repository.RepositoryPolicy
import org.slf4j.event.Level
import org.telegram.telegrambots.bots.DefaultBotOptions import org.telegram.telegrambots.bots.DefaultBotOptions
import java.io.File import java.io.File
import java.net.URL import java.net.URL
import java.net.URLEncoder
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger
import java.util.function.Supplier import java.util.function.Supplier
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
@ -45,13 +45,9 @@ internal fun ProxyConfig.toAetherProxy(): Proxy? {
internal fun MavenRepositoryConfig.toRemoteRepository(proxyConfig: ProxyConfig? = null): RemoteRepository { internal fun MavenRepositoryConfig.toRemoteRepository(proxyConfig: ProxyConfig? = null): RemoteRepository {
val repositoryId = if (id == null) { val repositoryId = if (id == null) {
val generatedRepoId = createDefaultRepositoryId() val generatedRepoId = createDefaultRepositoryId(url)
log.debug { "仓库 Url `$url` 未设置仓库 Id, 已分配缺省 Id: $generatedRepoId" } log.debug { "仓库 Url `$url` 未设置仓库 Id, 已分配缺省 Id: $generatedRepoId" }
generatedRepoId generatedRepoId
} else if ("local".contentEquals(id, ignoreCase = true)) {
val generatedRepoId = createDefaultRepositoryId()
log.debug { "仓库 Url `$url` 不允许使用 `local` 作为仓库 Id, 已分配缺省 Id: $generatedRepoId" }
generatedRepoId
} else { } else {
id id
} }
@ -97,10 +93,11 @@ private fun checkRepositoryLayout(layoutType: String): String {
return type return type
} }
private val repoNumberGenerator = AtomicInteger(1) private fun createDefaultRepositoryId(url: URL): String {
val topPrivateDomain = InternetDomainName.from(url.host).topPrivateDomain().toString()
private fun createDefaultRepositoryId(): String { return "Repository-${URLEncoder.encode(topPrivateDomain, StandardCharsets.UTF_8)}-${
return "Repository-${repoNumberGenerator.getAndIncrement()}" url.toString().hashCode().toString(16)
}"
} }
/** /**
@ -253,37 +250,8 @@ internal class LogDirectorySupplier : PropertyDefinerBase() {
} }
} }
internal class LogLevelSupplier : PropertyDefinerBase() {
override fun getPropertyValue(): String {
val property = System.getProperty("scalabot.log.level", System.getenv("BOT_LOG_LEVEL"))
val level = if (property != null) {
try {
Level.valueOf(property.uppercase())
} catch (e: IllegalArgumentException) {
addWarn("Invalid log level: `$property`, the log will be output using the Info log level.")
Level.INFO
}
} else {
Level.INFO
}
return level.name
}
}
internal class NetworkVerboseLogSupplier : PropertyDefinerBase() {
override fun getPropertyValue(): String {
val propertyValue = System.getProperty("scalabot.log.network.verbose", "false")
return if (propertyValue.toBoolean()) {
"DEBUG"
} else {
"INFO"
}
}
}
internal object Const { internal object Const {
val config = loadAppConfig() val config = loadAppConfig()
const val METRICS_NAMESPACE = "scalabot"
} }
private fun AppPaths.defaultInitializer() { private fun AppPaths.defaultInitializer() {

View File

@ -26,7 +26,6 @@ private val log = KotlinLogging.logger { }
fun main(args: Array<String>): Unit = runBlocking { fun main(args: Array<String>): Unit = runBlocking {
log.info { "ScalaBot 正在启动中..." } log.info { "ScalaBot 正在启动中..." }
log.info { "数据目录: ${AppPaths.DATA_ROOT}" } log.info { "数据目录: ${AppPaths.DATA_ROOT}" }
log.debug { "Kotlin: ${KotlinVersion.CURRENT}, JVM: ${Runtime.version()}" }
log.debug { "启动参数: ${args.joinToString(prefix = "[", postfix = "]")}" } log.debug { "启动参数: ${args.joinToString(prefix = "[", postfix = "]")}" }
if (initialFiles()) { if (initialFiles()) {
exitProcess(1) exitProcess(1)
@ -62,10 +61,7 @@ internal fun startMetricsServer(config: MetricsConfig = Const.config.metrics): H
return httpServer return httpServer
} }
internal class Launcher( internal class Launcher(private val config: AppConfig = Const.config) : AutoCloseable {
private val config: AppConfig = Const.config,
private val configFile: File = AppPaths.CONFIG_APPLICATION.file,
) : AutoCloseable {
companion object { companion object {
@JvmStatic @JvmStatic
@ -79,25 +75,27 @@ internal class Launcher(
private fun getMavenLocalRepository(): LocalRepository { private fun getMavenLocalRepository(): LocalRepository {
val localPath = val localPath =
if (config.mavenLocalRepository != null && config.mavenLocalRepository!!.isNotEmpty()) { if (config.mavenLocalRepository != null && config.mavenLocalRepository!!.isNotEmpty()) {
val repoPath = configFile.toPath().resolve(config.mavenLocalRepository!!).apply { val repoPath = AppPaths.DATA_ROOT.file.toPath()
if (!exists()) { .resolve(config.mavenLocalRepository!!)
if (!parent.isWritable() || !parent.isReadable()) { .apply {
throw IOException("Unable to read and write the directory where Maven repository is located.") if (!exists()) {
} if (!parent.isWritable() || !parent.isReadable()) {
if (System.getProperty("os.name").lowercase().startsWith("windows")) { throw IOException("Unable to read and write the directory where Maven repository is located.")
createDirectories() }
} else { if (System.getProperty("os.name").lowercase().startsWith("windows")) {
val fileAttributes = setOf( createDirectories()
PosixFilePermission.OWNER_READ, } else {
PosixFilePermission.OWNER_WRITE, val fileAttributes = setOf(
PosixFilePermission.GROUP_READ, PosixFilePermission.OWNER_READ,
PosixFilePermission.GROUP_WRITE, PosixFilePermission.OWNER_WRITE,
PosixFilePermission.OTHERS_READ, PosixFilePermission.GROUP_READ,
) PosixFilePermission.GROUP_WRITE,
createDirectories(PosixFilePermissions.asFileAttribute(fileAttributes)) PosixFilePermission.OTHERS_READ,
)
createDirectories(PosixFilePermissions.asFileAttribute(fileAttributes))
}
} }
} }
}
.toRealPath() .toRealPath()
.toFile() .toFile()
repoPath repoPath

View File

@ -50,8 +50,6 @@ internal class ScalaBot(
extensionFinders = extensionFinders extensionFinders = extensionFinders
) )
private val accountIdString = accountId.toString()
init { init {
log.info { "[Bot $botUsername] 正在加载扩展..." } log.info { "[Bot $botUsername] 正在加载扩展..." }
val extensionEntries = extensionLoader.getExtensions() val extensionEntries = extensionLoader.getExtensions()
@ -68,18 +66,18 @@ internal class ScalaBot(
override fun creatorId(): Long = creatorId override fun creatorId(): Long = creatorId
override fun onUpdateReceived(update: Update?) { override fun onUpdateReceived(update: Update?) {
botUpdateCounter.labels(botUsername, accountIdString).inc() botUpdateCounter.labels(botUsername).inc()
botUpdateGauge.labels(botUsername, accountIdString).inc() botUpdateGauge.labels(botUsername).inc()
val timer = updateProcessTime.labels(botUsername, accountIdString).startTimer() val timer = updateProcessTime.labels(botUsername).startTimer()
try { try {
super.onUpdateReceived(update) super.onUpdateReceived(update)
} catch (e: Exception) { } catch (e: Exception) {
exceptionHandlingCounter.labels(botUsername, accountIdString).inc() exceptionHandlingCounter.labels(botUsername).inc()
throw e throw e
} finally { } finally {
timer.observeDuration() timer.observeDuration()
botUpdateGauge.labels(botUsername, accountIdString).dec() botUpdateGauge.labels(botUsername).dec()
} }
} }
@ -136,8 +134,7 @@ internal class ScalaBot(
private val botUpdateCounter = Counter.build() private val botUpdateCounter = Counter.build()
.name("updates_total") .name("updates_total")
.help("Total number of updates received by all bots.") .help("Total number of updates received by all bots.")
.labelNames("bot_name", "bot_id") .labelNames("bot_name")
.namespace(Const.METRICS_NAMESPACE)
.subsystem("telegrambots") .subsystem("telegrambots")
.register() .register()
@ -145,8 +142,7 @@ internal class ScalaBot(
private val botUpdateGauge = Gauge.build() private val botUpdateGauge = Gauge.build()
.name("updates_in_progress") .name("updates_in_progress")
.help("Number of updates in process by all bots.") .help("Number of updates in process by all bots.")
.labelNames("bot_name", "bot_id") .labelNames("bot_name")
.namespace(Const.METRICS_NAMESPACE)
.subsystem("telegrambots") .subsystem("telegrambots")
.register() .register()
@ -154,7 +150,6 @@ internal class ScalaBot(
private val onlineBotGauge = Gauge.build() private val onlineBotGauge = Gauge.build()
.name("bots_online") .name("bots_online")
.help("Number of bots Online.") .help("Number of bots Online.")
.namespace(Const.METRICS_NAMESPACE)
.subsystem("telegrambots") .subsystem("telegrambots")
.register() .register()
@ -166,8 +161,7 @@ internal class ScalaBot(
"so it may be different from the actual execution time of ability. " + "so it may be different from the actual execution time of ability. " +
"It is not recommended to use it as the accurate execution time of ability)" "It is not recommended to use it as the accurate execution time of ability)"
) )
.labelNames("bot_name", "bot_id") .labelNames("bot_name")
.namespace(Const.METRICS_NAMESPACE)
.subsystem("telegrambots") .subsystem("telegrambots")
.register() .register()
@ -175,8 +169,7 @@ internal class ScalaBot(
private val exceptionHandlingCounter = Counter.build() private val exceptionHandlingCounter = Counter.build()
.name("updates_exception_handling") .name("updates_exception_handling")
.help("Number of exceptions during processing.") .help("Number of exceptions during processing.")
.labelNames("bot_name", "bot_id") .labelNames("bot_name")
.namespace(Const.METRICS_NAMESPACE)
.subsystem("telegrambots") .subsystem("telegrambots")
.register() .register()
} }

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<included> <included>
<define name="DATA_LOGS" class="net.lamgc.scalabot.LogDirectorySupplier"/> <define name="DATA_LOGS" class="net.lamgc.scalabot.LogDirectorySupplier"/>
<define name="LOG_LEVEL" class="net.lamgc.scalabot.LogLevelSupplier"/>
<define name="NETWORK_LOG_LEVEL" class="net.lamgc.scalabot.NetworkVerboseLogSupplier"/>
<appender name="STD_OUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STD_OUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

View File

@ -0,0 +1,16 @@
<configuration scan="false" debug="false">
<include resource="base-logback.xml"/>
<logger name="org.apache.http" level="INFO"/>
<logger name="org.eclipse.aether.internal.impl.DefaultTransporterProvider" level="INFO"/>
<logger name="org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider" level="INFO"/>
<logger name="org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager" level="INFO"/>
<logger name="org.telegram.telegrambots.facilities.proxysocketfactorys" level="INFO"/>
<logger name="org.eclipse.aether.internal.impl.DefaultUpdateCheckManager" level="INFO"/>
<root level="DEBUG">
<appender-ref ref="FILE_OUT"/>
<appender-ref ref="STD_ERR"/>
<appender-ref ref="STD_OUT"/>
</root>
</configuration>

View File

@ -1,14 +1,7 @@
<configuration scan="false" debug="false"> <configuration scan="false" debug="false">
<include resource="base-logback.xml"/> <include resource="base-logback.xml"/>
<logger name="org.apache.http" level="${NETWORK_LOG_LEVEL}"/> <root level="INFO">
<logger name="org.eclipse.aether.internal.impl.DefaultTransporterProvider" level="${NETWORK_LOG_LEVEL}"/>
<logger name="org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider" level="${NETWORK_LOG_LEVEL}"/>
<logger name="org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager" level="${NETWORK_LOG_LEVEL}"/>
<logger name="org.telegram.telegrambots.facilities.proxysocketfactorys" level="${NETWORK_LOG_LEVEL}"/>
<logger name="org.eclipse.aether.internal.impl.DefaultUpdateCheckManager" level="${NETWORK_LOG_LEVEL}"/>
<root level="${LOG_LEVEL}">
<appender-ref ref="FILE_OUT"/> <appender-ref ref="FILE_OUT"/>
<appender-ref ref="STD_ERR"/> <appender-ref ref="STD_ERR"/>
<appender-ref ref="STD_OUT"/> <appender-ref ref="STD_OUT"/>

View File

@ -5,7 +5,7 @@ plugins {
dependencies { dependencies {
compileOnly(project(":scalabot-extension")) compileOnly(project(":scalabot-extension"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0") testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
} }

View File

@ -1,9 +0,0 @@
public abstract interface class net/lamgc/scalabot/extension/BotExtensionFactory {
public abstract fun createExtensionInstance (Lorg/telegram/abilitybots/api/bot/BaseAbilityBot;Ljava/io/File;)Lorg/telegram/abilitybots/api/util/AbilityExtension;
}
public class net/lamgc/scalabot/extension/util/AbilityBots {
public static fun cancelReplyState (Lorg/telegram/abilitybots/api/bot/BaseAbilityBot;J)Z
public static fun getBotAccountId (Lorg/telegram/abilitybots/api/bot/BaseAbilityBot;)J
}

View File

@ -1,17 +1,17 @@
plugins { plugins {
`java-library` kotlin("jvm")
java
jacoco jacoco
`maven-publish` `maven-publish`
signing signing
id("org.jetbrains.kotlinx.binary-compatibility-validator")
} }
dependencies { dependencies {
implementation("commons-codec:commons-codec:1.16.0") api("org.telegram:telegrambots-abilities:6.1.0")
api("org.telegram:telegrambots-abilities:6.8.0") api("org.slf4j:slf4j-api:1.7.36")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0") testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testImplementation("org.mockito:mockito-core:5.8.0") testImplementation("org.mockito:mockito-core:4.6.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
} }
@ -44,21 +44,19 @@ tasks.withType<AbstractArchiveTask>().configureEach {
publishing { publishing {
repositories { repositories {
maven("https://git.lamgc.me/api/packages/LamGC/maven") { if (project.version.toString().endsWith("-SNAPSHOT")) {
credentials { maven("https://nexus.kuku.me/repository/maven-snapshots/") {
username = project.properties["repo.credentials.self-git.username"].toString() credentials {
password = project.properties["repo.credentials.self-git.password"].toString() username = project.properties["repo.credentials.private.username"].toString()
password = project.properties["repo.credentials.private.password"].toString()
}
} }
}
val kukuRepoUrl = if (project.version.toString().endsWith("-SNAPSHOT", ignoreCase = true)) {
"https://nexus.kuku.me/repository/maven-snapshots/"
} else { } else {
"https://nexus.kuku.me/repository/maven-releases/" maven("https://nexus.kuku.me/repository/maven-releases/") {
} credentials {
maven(kukuRepoUrl) { username = project.properties["repo.credentials.private.username"].toString()
credentials { password = project.properties["repo.credentials.private.password"].toString()
username = project.properties["repo.credentials.kuku-repo.username"].toString() }
password = project.properties["repo.credentials.kuku-repo.password"].toString()
} }
} }
} }

View File

@ -24,9 +24,7 @@ public class AbilityBots {
* @return 返回 AbilityBot 的账户 Id. * @return 返回 AbilityBot 的账户 Id.
* @throws IllegalArgumentException 当 AbilityBot 的 botToken 格式错误时抛出该异常. * @throws IllegalArgumentException 当 AbilityBot 的 botToken 格式错误时抛出该异常.
*/ */
@SuppressWarnings("deprecation")
public static long getBotAccountId(BaseAbilityBot bot) { public static long getBotAccountId(BaseAbilityBot bot) {
// 根据文档说明, 弃用仅针对重写方法, 使用该方法并无大碍.
String botToken = bot.getBotToken(); String botToken = bot.getBotToken();
Matcher matcher = botTokenPattern.matcher(botToken); Matcher matcher = botTokenPattern.matcher(botToken);
if (!matcher.matches()) { if (!matcher.matches()) {

View File

@ -1,196 +0,0 @@
public final class net/lamgc/scalabot/config/AppConfig {
public fun <init> ()V
public fun <init> (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;)V
public synthetic fun <init> (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Lnet/lamgc/scalabot/config/ProxyConfig;
public final fun component2 ()Lnet/lamgc/scalabot/config/MetricsConfig;
public final fun component3 ()Ljava/util/List;
public final fun component4 ()Ljava/lang/String;
public final fun copy (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;)Lnet/lamgc/scalabot/config/AppConfig;
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/AppConfig;Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/MetricsConfig;Ljava/util/List;Ljava/lang/String;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/AppConfig;
public fun equals (Ljava/lang/Object;)Z
public final fun getMavenLocalRepository ()Ljava/lang/String;
public final fun getMavenRepositories ()Ljava/util/List;
public final fun getMetrics ()Lnet/lamgc/scalabot/config/MetricsConfig;
public final fun getProxy ()Lnet/lamgc/scalabot/config/ProxyConfig;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class net/lamgc/scalabot/config/BotAccount {
public fun <init> (Ljava/lang/String;Ljava/lang/String;J)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()J
public final fun copy (Ljava/lang/String;Ljava/lang/String;J)Lnet/lamgc/scalabot/config/BotAccount;
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/BotAccount;Ljava/lang/String;Ljava/lang/String;JILjava/lang/Object;)Lnet/lamgc/scalabot/config/BotAccount;
public fun equals (Ljava/lang/Object;)Z
public final fun getCreatorId ()J
public final fun getId ()J
public final fun getName ()Ljava/lang/String;
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class net/lamgc/scalabot/config/BotConfig {
public fun <init> (ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;)V
public synthetic fun <init> (ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Z
public final fun component2 ()Lnet/lamgc/scalabot/config/BotAccount;
public final fun component3 ()Z
public final fun component4 ()Z
public final fun component5 ()Ljava/util/Set;
public final fun component6 ()Lnet/lamgc/scalabot/config/ProxyConfig;
public final fun component7 ()Ljava/lang/String;
public final fun copy (ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;)Lnet/lamgc/scalabot/config/BotConfig;
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/BotConfig;ZLnet/lamgc/scalabot/config/BotAccount;ZZLjava/util/Set;Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/String;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/BotConfig;
public fun equals (Ljava/lang/Object;)Z
public final fun getAccount ()Lnet/lamgc/scalabot/config/BotAccount;
public final fun getAutoUpdateCommandList ()Z
public final fun getBaseApiUrl ()Ljava/lang/String;
public final fun getDisableBuiltInAbility ()Z
public final fun getEnabled ()Z
public final fun getExtensions ()Ljava/util/Set;
public final fun getProxy ()Lnet/lamgc/scalabot/config/ProxyConfig;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class net/lamgc/scalabot/config/MavenRepositoryConfig {
public fun <init> (Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/net/URL;
public final fun component3 ()Lorg/eclipse/aether/repository/Proxy;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Z
public final fun component6 ()Z
public final fun component7 ()Lorg/eclipse/aether/repository/Authentication;
public final fun copy (Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;)Lnet/lamgc/scalabot/config/MavenRepositoryConfig;
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/MavenRepositoryConfig;Ljava/lang/String;Ljava/net/URL;Lorg/eclipse/aether/repository/Proxy;Ljava/lang/String;ZZLorg/eclipse/aether/repository/Authentication;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/MavenRepositoryConfig;
public fun equals (Ljava/lang/Object;)Z
public final fun getAuthentication ()Lorg/eclipse/aether/repository/Authentication;
public final fun getEnableReleases ()Z
public final fun getEnableSnapshots ()Z
public final fun getId ()Ljava/lang/String;
public final fun getLayout ()Ljava/lang/String;
public final fun getProxy ()Lorg/eclipse/aether/repository/Proxy;
public final fun getUrl ()Ljava/net/URL;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class net/lamgc/scalabot/config/MetricsConfig {
public fun <init> ()V
public fun <init> (ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;)V
public synthetic fun <init> (ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Z
public final fun component2 ()I
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Lnet/lamgc/scalabot/config/UsernameAuthenticator;
public final fun copy (ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;)Lnet/lamgc/scalabot/config/MetricsConfig;
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/MetricsConfig;ZILjava/lang/String;Lnet/lamgc/scalabot/config/UsernameAuthenticator;ILjava/lang/Object;)Lnet/lamgc/scalabot/config/MetricsConfig;
public fun equals (Ljava/lang/Object;)Z
public final fun getAuthenticator ()Lnet/lamgc/scalabot/config/UsernameAuthenticator;
public final fun getBindAddress ()Ljava/lang/String;
public final fun getEnable ()Z
public final fun getPort ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class net/lamgc/scalabot/config/ProxyConfig {
public fun <init> ()V
public fun <init> (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;I)V
public synthetic fun <init> (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Lnet/lamgc/scalabot/config/ProxyType;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()I
public final fun copy (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;I)Lnet/lamgc/scalabot/config/ProxyConfig;
public static synthetic fun copy$default (Lnet/lamgc/scalabot/config/ProxyConfig;Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/String;IILjava/lang/Object;)Lnet/lamgc/scalabot/config/ProxyConfig;
public fun equals (Ljava/lang/Object;)Z
public final fun getHost ()Ljava/lang/String;
public final fun getPort ()I
public final fun getType ()Lnet/lamgc/scalabot/config/ProxyType;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class net/lamgc/scalabot/config/ProxyType : java/lang/Enum {
public static final field HTTP Lnet/lamgc/scalabot/config/ProxyType;
public static final field HTTPS Lnet/lamgc/scalabot/config/ProxyType;
public static final field NO_PROXY Lnet/lamgc/scalabot/config/ProxyType;
public static final field SOCKS4 Lnet/lamgc/scalabot/config/ProxyType;
public static final field SOCKS5 Lnet/lamgc/scalabot/config/ProxyType;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lnet/lamgc/scalabot/config/ProxyType;
public static fun values ()[Lnet/lamgc/scalabot/config/ProxyType;
}
public final class net/lamgc/scalabot/config/UsernameAuthenticator : com/sun/net/httpserver/BasicAuthenticator {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public fun checkCredentials (Ljava/lang/String;Ljava/lang/String;)Z
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public final fun toJsonObject ()Lcom/google/gson/JsonObject;
}
public final class net/lamgc/scalabot/config/serializer/ArtifactSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/ArtifactSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lorg/eclipse/aether/artifact/Artifact;
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
public fun serialize (Lorg/eclipse/aether/artifact/Artifact;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
}
public final class net/lamgc/scalabot/config/serializer/AuthenticationSerializer : com/google/gson/JsonDeserializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/AuthenticationSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lorg/eclipse/aether/repository/Authentication;
}
public final class net/lamgc/scalabot/config/serializer/BotAccountSerializer : com/google/gson/JsonDeserializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/BotAccountSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/BotAccount;
}
public final class net/lamgc/scalabot/config/serializer/BotConfigSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/BotConfigSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/BotConfig;
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
public fun serialize (Lnet/lamgc/scalabot/config/BotConfig;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
}
public final class net/lamgc/scalabot/config/serializer/MavenRepositoryConfigSerializer : com/google/gson/JsonDeserializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/MavenRepositoryConfigSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/MavenRepositoryConfig;
}
public final class net/lamgc/scalabot/config/serializer/ProxyConfigSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/ProxyConfigSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/ProxyConfig;
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
public fun serialize (Lnet/lamgc/scalabot/config/ProxyConfig;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
}
public final class net/lamgc/scalabot/config/serializer/ProxyTypeSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/ProxyTypeSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/ProxyType;
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
public fun serialize (Lnet/lamgc/scalabot/config/ProxyType;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
}
public final class net/lamgc/scalabot/config/serializer/UsernameAuthenticatorSerializer : com/google/gson/JsonDeserializer, com/google/gson/JsonSerializer {
public static final field INSTANCE Lnet/lamgc/scalabot/config/serializer/UsernameAuthenticatorSerializer;
public synthetic fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ljava/lang/Object;
public fun deserialize (Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/lamgc/scalabot/config/UsernameAuthenticator;
public synthetic fun serialize (Ljava/lang/Object;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
public fun serialize (Lnet/lamgc/scalabot/config/UsernameAuthenticator;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
}

View File

@ -1,10 +1,9 @@
plugins { plugins {
kotlin("jvm") kotlin("jvm")
id("org.jetbrains.kotlinx.kover") id("org.jetbrains.kotlinx.kover")
id("org.jetbrains.dokka") version "1.9.10" id("org.jetbrains.dokka") version "1.7.0"
`maven-publish` `maven-publish`
signing signing
id("org.jetbrains.kotlinx.binary-compatibility-validator")
} }
dependencies { dependencies {
@ -12,16 +11,16 @@ dependencies {
api("org.eclipse.aether:aether-api:$aetherVersion") api("org.eclipse.aether:aether-api:$aetherVersion")
implementation("org.eclipse.aether:aether-util:$aetherVersion") implementation("org.eclipse.aether:aether-util:$aetherVersion")
implementation("org.telegram:telegrambots-meta:6.8.0") implementation("org.telegram:telegrambots-meta:6.1.0")
api("com.google.code.gson:gson:2.10.1") api("com.google.code.gson:gson:2.9.0")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
testImplementation("io.mockk:mockk:1.13.8") testImplementation("io.mockk:mockk:1.12.4")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0") testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.1") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:1.9.10") dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:1.7.0")
} }
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
@ -52,21 +51,19 @@ val javadocJar = tasks.named<Jar>("javadocJar") {
publishing { publishing {
repositories { repositories {
maven("https://git.lamgc.me/api/packages/LamGC/maven") { if (project.version.toString().endsWith("-SNAPSHOT", ignoreCase = true)) {
credentials { maven("https://nexus.kuku.me/repository/maven-snapshots/") {
username = project.properties["repo.credentials.self-git.username"].toString() credentials {
password = project.properties["repo.credentials.self-git.password"].toString() username = project.properties["repo.credentials.private.username"].toString()
password = project.properties["repo.credentials.private.password"].toString()
}
} }
}
val kukuRepoUrl = if (project.version.toString().endsWith("-SNAPSHOT", ignoreCase = true)) {
"https://nexus.kuku.me/repository/maven-snapshots/"
} else { } else {
"https://nexus.kuku.me/repository/maven-releases/" maven("https://nexus.kuku.me/repository/maven-releases/") {
} credentials {
maven(kukuRepoUrl) { username = project.properties["repo.credentials.private.username"].toString()
credentials { password = project.properties["repo.credentials.private.password"].toString()
username = project.properties["repo.credentials.kuku-repo.username"].toString() }
password = project.properties["repo.credentials.kuku-repo.password"].toString()
} }
} }
} }