import groovy.json.JsonSlurper

plugins {
    id 'com.android.application' version '7.4.1' apply false
    id 'com.android.library' version '7.4.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
    id 'org.jetbrains.kotlin.jvm' version '1.8.20' apply false
}

ext {
    devId = "0"
    devUser = "fankesyooni"
    userEmail = "qzmmcn@163.com"
    groupId = "com.highcapable.yukireflection"
    apiVersion = "1.0.0"
    repoName = "YukiReflection"
    repoDescription = "An efficient Reflection API for the Android platform built in Kotlin."
    licenceName = "MIT License"
    licenceUrl = "https://github.com/fankes/YukiReflection/blob/master/LICENSE"
    website = "https://github.com/fankes/YukiReflection"
    githubConnection = "scm:git:git://github.com/path/to/repo.git"
    githubDeveloperConnection = "scm:git:ssh://github.com/path/to/repo.git"
    githubUrl = "https://github.com/path/to/repo"
    ossName = "OSSRH"
    ossUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}

/**
 * 获取 Maven 授权信息 - 用于 Maven 的提交
 * @param childProjectDir 子项目的目录
 * @return [Object]
 */
@SuppressWarnings('unused')
static Object getMavenCredentials(File childProjectDir) {
    def slurper = new JsonSlurper()
    try {
        return slurper.parse(new File("${childProjectDir.getParent()}/.maven/credentials.json"))
    } catch (Throwable ignored) {
        return slurper.parseText('{"username":"-NEEDED-","password":"-NEEDED-"}')
    }
}