101 lines
4.0 KiB
Groovy
101 lines
4.0 KiB
Groovy
import java.util.concurrent.TimeUnit
|
|
|
|
pluginManagement {
|
|
repositories {
|
|
google {
|
|
content {
|
|
includeGroupByRegex("com\\.android.*")
|
|
includeGroupByRegex("com\\.google.*")
|
|
includeGroupByRegex("androidx.*")
|
|
}
|
|
}
|
|
maven {
|
|
url "https://maven.batiao8.com/repository/maven-releases/"
|
|
credentials {
|
|
username BATIAO_REPO_USERNAME
|
|
password BATIAO_REPO_PASSWORD
|
|
}
|
|
}
|
|
maven { url 'https://maven.aliyun.com/repository/public' }
|
|
maven { url 'https://maven.aliyun.com/repository/google' }
|
|
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
|
maven { url 'https://developer.huawei.com/repo/' }
|
|
mavenCentral()
|
|
gradlePluginPortal()
|
|
}
|
|
|
|
resolutionStrategy {
|
|
eachPlugin {
|
|
if (requested.id.id == 'com.batiao.batiaosdkbuilder') {
|
|
def repoUrl = 'https://maven.batiao8.com/repository/maven-releases/'
|
|
def mavenUser = BATIAO_REPO_USERNAME
|
|
def mavenPass = BATIAO_REPO_PASSWORD
|
|
def groupId = 'com.batiao'
|
|
def artifactId = 'batiao-sdk-builder'
|
|
|
|
def pluginVersion = requested.version ?: '+'
|
|
def isDynamic = pluginVersion.contains('+') ||
|
|
pluginVersion.equalsIgnoreCase('latest.release') ||
|
|
pluginVersion.equalsIgnoreCase('latest.integration') ||
|
|
pluginVersion.equalsIgnoreCase('release.+')
|
|
|
|
if (isDynamic) {
|
|
def base = repoUrl.endsWith('/') ? repoUrl : repoUrl + '/'
|
|
def metaUrl = base + groupId.replace('.', '/') + '/' + artifactId + '/maven-metadata.xml'
|
|
def conn = new URL(metaUrl).openConnection()
|
|
conn.setConnectTimeout(20_000)
|
|
conn.setReadTimeout(20_000)
|
|
if (mavenUser) {
|
|
def creds = "${mavenUser}:${mavenPass ?: ''}".bytes.encodeBase64().toString()
|
|
conn.setRequestProperty('Authorization', "Basic ${creds}")
|
|
}
|
|
if (conn.responseCode != 200) {
|
|
throw new GradleException("Batiao: fetch ${metaUrl} failed HTTP ${conn.responseCode}")
|
|
}
|
|
def xml = new XmlSlurper().parse(conn.inputStream)
|
|
pluginVersion = (xml.versioning.release?.text() ?: xml.versioning.latest?.text())?.trim()
|
|
if (!pluginVersion) {
|
|
throw new GradleException("Batiao: no release/latest in ${metaUrl}")
|
|
}
|
|
}
|
|
|
|
useModule("${groupId}:${artifactId}:${pluginVersion}")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dependencyResolutionManagement {
|
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
|
repositories {
|
|
maven {
|
|
url "https://maven.batiao8.com/repository/maven-releases/"
|
|
credentials {
|
|
username BATIAO_REPO_USERNAME
|
|
password BATIAO_REPO_PASSWORD
|
|
}
|
|
}
|
|
maven { url 'https://maven.aliyun.com/repository/public' }
|
|
maven { url 'https://maven.aliyun.com/repository/google' }
|
|
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
|
maven { url 'https://mvn.getui.com/nexus/content/repositories/releases' }
|
|
maven { url 'https://developer.huawei.com/repo/' }//添加华为仓库 获取oaid
|
|
maven { url 'https://developer.hihonor.com/repo/'}
|
|
maven { url 'https://artifact.bytedance.com/repository/Volcengine/' } //巨量融合
|
|
maven { url "https://jitpack.io" }
|
|
mavenCentral()
|
|
google()
|
|
}
|
|
}
|
|
|
|
gradle.beforeProject { proj ->
|
|
proj.configurations.configureEach {
|
|
resolutionStrategy {
|
|
cacheDynamicVersionsFor(0, TimeUnit.SECONDS)
|
|
cacheChangingModulesFor(0, TimeUnit.SECONDS)
|
|
}
|
|
}
|
|
}
|
|
|
|
rootProject.name = "blzb"
|
|
include ':app'
|
|
include ':base' |