mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-05 18:25:28 +08:00
Modify move maven configs from .gradle to .maven directory and make it to json file
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
|
.maven
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/caches
|
/.idea/caches
|
||||||
/.idea/libraries
|
/.idea/libraries
|
||||||
|
24
build.gradle
24
build.gradle
@@ -1,4 +1,5 @@
|
|||||||
//file:noinspection unused
|
import groovy.json.JsonSlurper
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '7.4.1' apply false
|
id 'com.android.application' version '7.4.1' apply false
|
||||||
id 'com.android.library' version '7.4.1' apply false
|
id 'com.android.library' version '7.4.1' apply false
|
||||||
@@ -24,23 +25,18 @@ ext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取授权文件内容 - 用于 Maven 的提交
|
* 获取 Maven 授权信息 - 用于 Maven 的提交
|
||||||
*
|
* @param childProjectDir 子项目的目录
|
||||||
* 若编译失败请将路径替换为自己的或置空
|
* @return [Object]
|
||||||
* @param name
|
|
||||||
* @return [String]
|
|
||||||
*/
|
*/
|
||||||
static String getFileContent(String name) {
|
@SuppressWarnings('unused')
|
||||||
String result = ""
|
static Object getMavenCredentials(File childProjectDir) {
|
||||||
|
def slurper = new JsonSlurper()
|
||||||
try {
|
try {
|
||||||
FileReader reader = new FileReader("/Users/fankes/Project/Android/Xposed/YukiHookAPI/.gradle/" + name)
|
return slurper.parse(new File("${childProjectDir.getParent()}/.maven/credentials.json"))
|
||||||
BufferedReader buff = new BufferedReader(reader)
|
|
||||||
result = buff.readLine()
|
|
||||||
buff.close()
|
|
||||||
reader.close()
|
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
|
return slurper.parseText('{"username":"-NEEDED-","password":"-NEEDED-"}')
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
@@ -70,8 +70,9 @@ publishing {
|
|||||||
name = rootProject.ext.ossName
|
name = rootProject.ext.ossName
|
||||||
url = rootProject.ext.ossUrl
|
url = rootProject.ext.ossUrl
|
||||||
credentials {
|
credentials {
|
||||||
username = getFileContent("OSSRH_USERNAME")
|
def configs = getMavenCredentials(projectDir)
|
||||||
password = getFileContent("OSSRH_PASSWORD")
|
username = configs.username
|
||||||
|
password = configs.password
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -89,8 +89,9 @@ publishing {
|
|||||||
name = rootProject.ext.ossName
|
name = rootProject.ext.ossName
|
||||||
url = rootProject.ext.ossUrl
|
url = rootProject.ext.ossUrl
|
||||||
credentials {
|
credentials {
|
||||||
username = getFileContent("OSSRH_USERNAME")
|
def configs = getMavenCredentials(projectDir)
|
||||||
password = getFileContent("OSSRH_PASSWORD")
|
username = configs.username
|
||||||
|
password = configs.password
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user