-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
270 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.0-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
allprojects { | ||
buildscript { | ||
repositories { | ||
/*maven{ url 'https://maven.aliyun.com/repository/public/'} | ||
maven{ url 'https://maven.aliyun.com/repository/google/'} | ||
all { ArtifactRepository repo -> | ||
if (repo instanceof MavenArtifactRepository) { | ||
def url = repo.url.toString() | ||
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/') | ||
|| url.startsWith('https://dl.google.com/dl/android/maven2/')) { | ||
//project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL." | ||
remove repo | ||
} | ||
} | ||
}*/ | ||
/*def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/public' | ||
def ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/repository/public' | ||
def ALIYUN_GOOGLE_URL = 'https://maven.aliyun.com/repository/google' | ||
def ALIYUN_GRADLE_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin' | ||
all { ArtifactRepository repo -> | ||
if(repo instanceof MavenArtifactRepository){ | ||
def url = repo.url.toString() | ||
if (url.startsWith('https://repo1.maven.org/maven2/')) { | ||
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL." | ||
remove repo | ||
} | ||
if (url.startsWith('https://jcenter.bintray.com/')) { | ||
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL." | ||
remove repo | ||
} | ||
if (url.startsWith('https://dl.google.com/dl/android/maven2/')) { | ||
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GOOGLE_URL." | ||
remove repo | ||
} | ||
if (url.startsWith('https://plugins.gradle.org/m2/')) { | ||
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GRADLE_PLUGIN_URL." | ||
remove repo | ||
} | ||
} | ||
} | ||
maven { url ALIYUN_REPOSITORY_URL } | ||
maven { url ALIYUN_JCENTER_URL } | ||
maven { url ALIYUN_GOOGLE_URL } | ||
maven { url ALIYUN_GRADLE_PLUGIN_URL }*/ | ||
def NJU_REPOSITORY_URL = 'https://repo.nju.edu.cn/repository/maven-public/' | ||
all { ArtifactRepository repo -> | ||
if (repo instanceof MavenArtifactRepository) { | ||
def url = repo.url.toString() | ||
if (url.startsWith('https://repo1.maven.org/maven2')) { | ||
project.logger.lifecycle "Repository ${repo.url} replaced by $NJU_REPOSITORY_URL." | ||
remove repo | ||
} | ||
if (url.startsWith('https://jcenter.bintray.com/')) { | ||
project.logger.lifecycle "Repository ${repo.url} deleted." | ||
remove repo | ||
} | ||
if (url.startsWith('https://dl.google.com/dl/android/maven2/')) { | ||
project.logger.lifecycle "Repository ${repo.url} deleted." | ||
remove repo | ||
} | ||
if (url.contains('plugins.gradle.org/m2')) { | ||
project.logger.lifecycle "Repository ${repo.url} deleted." | ||
remove repo | ||
} | ||
} | ||
} | ||
maven { url NJU_REPOSITORY_URL } | ||
mavenLocal() | ||
} | ||
} | ||
|
||
repositories { | ||
/*maven { | ||
url 'https://maven.aliyun.com/repository/public/' | ||
} | ||
maven { | ||
url 'https://maven.aliyun.com/repository/google/' | ||
} | ||
all { ArtifactRepository repo -> | ||
if (repo instanceof MavenArtifactRepository) { | ||
def url = repo.url.toString() | ||
if (url.startsWith('https://repo.maven.apache.org/maven2/') || url.startsWith('https://repo.maven.org/maven2') | ||
|| url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/') | ||
|| url.startsWith('https://maven.google.com/') || url.startsWith('https://dl.google.com/dl/android/maven2/')) { | ||
//project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL." | ||
remove repo | ||
} | ||
} | ||
}*/ | ||
def NJU_REPOSITORY_URL = 'https://repo.nju.edu.cn/repository/maven-public/' | ||
all { ArtifactRepository repo -> | ||
if (repo instanceof MavenArtifactRepository) { | ||
def url = repo.url.toString() | ||
if (url.startsWith('https://repo1.maven.org/maven2')) { | ||
project.logger.lifecycle "Repository ${repo.url} replaced by $NJU_REPOSITORY_URL." | ||
remove repo | ||
} | ||
if (url.startsWith('https://jcenter.bintray.com/')) { | ||
project.logger.lifecycle "Repository ${repo.url} deleted." | ||
remove repo | ||
} | ||
if (url.startsWith('https://dl.google.com/dl/android/maven2/')) { | ||
project.logger.lifecycle "Repository ${repo.url} deleted." | ||
remove repo | ||
} | ||
if (url.contains('plugins.gradle.org/m2')) { | ||
project.logger.lifecycle "Repository ${repo.url} deleted." | ||
remove repo | ||
} | ||
} | ||
} | ||
maven { url NJU_REPOSITORY_URL } | ||
mavenLocal() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// https://www.cnblogs.com/mkckr0/p/17714374.html | ||
// https://gist.github.com/mkckr0/97ec5b0d99feede4c19ee6f905d5e722 | ||
|
||
val repoMirrorMap = mapOf( | ||
"https://repo.maven.apache.org/maven2" to "https://maven.aliyun.com/repository/central", | ||
"https://dl.google.com/dl/android/maven2" to "https://maven.aliyun.com/repository/google", | ||
"https://plugins.gradle.org/m2" to "https://maven.aliyun.com/repository/gradle-plugin", | ||
"https://jcenter.bintray.com" to "https://maven.aliyun.com/repository/jcenter", | ||
) | ||
val repoReplaceMap = mapOf( | ||
"https://maven.google.com" to "https://dl.google.com/dl/android/maven2" | ||
) | ||
|
||
fun RepositoryHandler.setMirrors() { | ||
all { | ||
if (this is MavenArtifactRepository && !name.endsWith("Origin")) { | ||
val originName = name | ||
var originUrl = url.toString().trimEnd('/') | ||
|
||
// do replace | ||
repoReplaceMap[originUrl]?.let { newUrl -> | ||
originUrl = newUrl | ||
setUrl(originUrl) | ||
} | ||
|
||
// do mirror | ||
repoMirrorMap[originUrl]?.let { newUrl -> | ||
// replace into mirror repo | ||
setUrl(newUrl) | ||
// add origin repo to find missing jars | ||
artifactUrls(originUrl) | ||
// keep origin repo to find missing POM | ||
maven(originUrl) { name = "$originName Origin" } | ||
} | ||
} | ||
} | ||
printRepos() | ||
} | ||
|
||
fun RepositoryHandler.printRepos() { | ||
all { | ||
if (this is MavenArtifactRepository) { | ||
println("Maven Repo: name=\"$name\", url=$url, artifacts=${artifactUrls}") | ||
} | ||
} | ||
} | ||
|
||
settingsEvaluated { | ||
pluginManagement { | ||
repositories { | ||
setMirrors() | ||
} | ||
} | ||
dependencyResolutionManagement { | ||
@Suppress("UnstableApiUsage") | ||
repositories { | ||
setMirrors() | ||
} | ||
} | ||
} | ||
|
||
allprojects { | ||
buildscript { | ||
repositories { | ||
setMirrors() | ||
} | ||
} | ||
repositories { | ||
setMirrors() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
pluginManagement { | ||
repositories { | ||
|
||
maven { url 'https://maven.aliyun.com/repository/central' } | ||
maven { url 'https://maven.aliyun.com/repository/jcenter' } | ||
maven { url 'https://maven.aliyun.com/repository/google' } //替换google() | ||
maven { url 'https://maven.aliyun.com/repository/public' } | ||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } | ||
|
||
google() | ||
mavenLocal() //配置先从本地仓库寻找jar包,优先寻找上一个配置,找到不执行下面的配置 | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
dependencyResolutionManagement { | ||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | ||
repositories { | ||
|
||
maven { url 'https://maven.aliyun.com/repository/google' } | ||
maven { url 'https://maven.aliyun.com/repository/public' } | ||
|
||
google() | ||
mavenCentral() | ||
} | ||
} | ||
rootProject.name = "hiCompose" | ||
include ':app' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.