Merge Gradle code

This commit is contained in:
2022-02-14 13:23:59 +08:00
parent 8da4226d31
commit daf8ea1ffd
4 changed files with 76 additions and 79 deletions

View File

@@ -1,28 +1,36 @@
buildscript { //file:noinspection unused
ext.kotlin_version = "1.6.10" plugins {
repositories { id 'com.android.application' version '7.1.1' apply false
google() id 'com.android.library' version '7.1.1' apply false
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url "https://www.jitpack.io" }
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
} }
allprojects { ext {
repositories { kotlinVersion = "1.6.10"
google() devId = "0"
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } devUser = "fankesyooni"
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } userEmail = 'qzmmcn@163.com'
maven { url "https://www.jitpack.io" } groupId = "com.highcapable.yukihookapi"
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } apiVersion = "1.0"
mavenCentral() repoName = "YukiHookAPI"
} repoDescription = "An efficient Kotlin version of the Xposed Hook API."
licenceName = "MIT License"
licenceUrl = "https://github.com/fankes/YukiHookAPI/blob/master/LICENSE"
website = "https://github.com/fankes/YukiHookAPI"
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/"
}
static String getFileContent(String name) {
FileReader reader = new FileReader("/Users/fankes/ProjectPath/AndroidStudioProjects/YukiHookAPI/.gradle/" + name)
BufferedReader buff = new BufferedReader(reader)
String result = buff.readLine()
buff.close()
reader.close()
return result
} }
task clean(type: Delete) { task clean(type: Delete) {

View File

@@ -1,3 +1,18 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
maven { url "https://api.xposed.info/" }
mavenCentral()
}
}
rootProject.name = "YukiHookAPI" rootProject.name = "YukiHookAPI"
include ':demo-app' include ':demo-app'
include ':demo-module' include ':demo-module'

View File

@@ -26,8 +26,8 @@ dependencies {
ksp 'dev.zacsweers.autoservice:auto-service-ksp:1.0.0' ksp 'dev.zacsweers.autoservice:auto-service-ksp:1.0.0'
} }
group = 'com.highcapable.yukihookapi' group = rootProject.ext.groupId
version = '1.0' version = rootProject.ext.apiVersion
publishing { publishing {
publications { publications {
@@ -35,38 +35,34 @@ publishing {
artifactId = 'ksp-xposed' artifactId = 'ksp-xposed'
from components.java from components.java
pom { pom {
name = 'YukiHookAPI' name = rootProject.ext.repoName
description = 'An efficient Kotlin version of the Xposed Hook API.' description = rootProject.ext.repoDescription
url = 'https://github.com/fankes/YukiHookAPI' url = rootProject.ext.website
licenses { licenses {
license { license {
name = 'MIT License' name = rootProject.ext.licenceName
url = 'https://github.com/fankes/YukiHookAPI/blob/master/LICENSE' url = rootProject.ext.licenceUrl
} }
} }
developers { developers {
developer { developer {
id = '0' id = rootProject.ext.devId
name = 'fankesyooni' name = rootProject.ext.devUser
email = 'qzmmcn@163.com' email = rootProject.ext.userEmail
} }
} }
scm { scm {
connection = 'scm:git:git://github.com/path/to/repo.git' connection = rootProject.ext.githubConnection
developerConnection = 'scm:git:ssh://github.com/path/to/repo.git' developerConnection = rootProject.ext.githubDeveloperConnection
url = 'https://github.com/path/to/repo' url = rootProject.ext.githubUrl
} }
} }
} }
} }
repositories { repositories {
maven { maven {
name = "OSSRH" name = rootProject.ext.ossName
if (project.version.toString().endsWith("-SNAPSHOT")) { url = rootProject.ext.ossUrl
url = "https://s01.oss.sonatype.org/content/repositories/snapshots"
} else {
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials { credentials {
username = getFileContent("OSSRH_USERNAME") username = getFileContent("OSSRH_USERNAME")
password = getFileContent("OSSRH_PASSWORD") password = getFileContent("OSSRH_PASSWORD")
@@ -77,13 +73,4 @@ publishing {
signing { signing {
sign(publishing.publications.mavenJava) sign(publishing.publications.mavenJava)
}
private static String getFileContent(String name) {
FileReader reader = new FileReader("/Users/fankes/ProjectPath/AndroidStudioProjects/YukiHookAPI/.gradle/" + name)
BufferedReader buff = new BufferedReader(reader)
String result = buff.readLine()
buff.close()
reader.close()
return result
} }

View File

@@ -27,8 +27,8 @@ dependencies {
implementation 'androidx.annotation:annotation:1.3.0' implementation 'androidx.annotation:annotation:1.3.0'
} }
group = 'com.highcapable.yukihookapi' group = rootProject.ext.groupId
version = '1.0' version = rootProject.ext.apiVersion
publishing { publishing {
publications { publications {
@@ -36,38 +36,34 @@ publishing {
artifactId = 'api' artifactId = 'api'
from components.java from components.java
pom { pom {
name = 'YukiHookAPI' name = rootProject.ext.repoName
description = 'An efficient Kotlin version of the Xposed Hook API.' description = rootProject.ext.repoDescription
url = 'https://github.com/fankes/YukiHookAPI' url = rootProject.ext.website
licenses { licenses {
license { license {
name = 'MIT License' name = rootProject.ext.licenceName
url = 'https://github.com/fankes/YukiHookAPI/blob/master/LICENSE' url = rootProject.ext.licenceUrl
} }
} }
developers { developers {
developer { developer {
id = '0' id = rootProject.ext.devId
name = 'fankesyooni' name = rootProject.ext.devUser
email = 'qzmmcn@163.com' email = rootProject.ext.userEmail
} }
} }
scm { scm {
connection = 'scm:git:git://github.com/path/to/repo.git' connection = rootProject.ext.githubConnection
developerConnection = 'scm:git:ssh://github.com/path/to/repo.git' developerConnection = rootProject.ext.githubDeveloperConnection
url = 'https://github.com/path/to/repo' url = rootProject.ext.githubUrl
} }
} }
} }
} }
repositories { repositories {
maven { maven {
name = "OSSRH" name = rootProject.ext.ossName
if (project.version.toString().endsWith("-SNAPSHOT")) { url = rootProject.ext.ossUrl
url = "https://s01.oss.sonatype.org/content/repositories/snapshots"
} else {
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials { credentials {
username = getFileContent("OSSRH_USERNAME") username = getFileContent("OSSRH_USERNAME")
password = getFileContent("OSSRH_PASSWORD") password = getFileContent("OSSRH_PASSWORD")
@@ -78,13 +74,4 @@ publishing {
signing { signing {
sign(publishing.publications.mavenJava) sign(publishing.publications.mavenJava)
}
private static String getFileContent(String name) {
FileReader reader = new FileReader("/Users/fankes/ProjectPath/AndroidStudioProjects/YukiHookAPI/.gradle/" + name)
BufferedReader buff = new BufferedReader(reader)
String result = buff.readLine()
buff.close()
reader.close()
return result
} }