build(ci): remove Jiguang Maven repository from build workflows and Huawei plugin
Some checks failed
Frontend CI / ota (ios) (push) Has been cancelled
Frontend CI / build-and-push-web (push) Has been cancelled
Frontend CI / ota (android) (push) Has been cancelled
Frontend CI / build-android-apk (push) Failing after 15m46s

This commit is contained in:
lafay
2026-06-16 00:07:50 +08:00
parent ce56824c2e
commit ed06c10f25
2 changed files with 3 additions and 18 deletions

View File

@@ -186,7 +186,6 @@ jobs:
maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://developer.jiguang.cn/maven' }
google() google()
mavenCentral() mavenCentral()
gradlePluginPortal() gradlePluginPortal()
@@ -222,7 +221,6 @@ jobs:
maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://developer.jiguang.cn/maven' }
maven { url 'https://www.jitpack.io' } maven { url 'https://www.jitpack.io' }
google() google()
mavenCentral() mavenCentral()
@@ -278,7 +276,6 @@ jobs:
maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://www.jitpack.io' } maven { url 'https://www.jitpack.io' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://developer.jiguang.cn/maven' }
google() google()
mavenCentral() mavenCentral()
} }

View File

@@ -22,38 +22,26 @@ const withHuaweiPush = (config, options = {}) => {
// is applied via buildscript classpath in build.gradle with the apms-plugin excluded. // is applied via buildscript classpath in build.gradle with the apms-plugin excluded.
if (!contents.includes('developer.huawei.com/repo')) { if (!contents.includes('developer.huawei.com/repo')) {
const repoLine = ` maven { url 'https://developer.huawei.com/repo/' }`; const repoLine = ` maven { url 'https://developer.huawei.com/repo/' }`;
const jigLine = ` maven { url 'https://developer.jiguang.cn/maven' }`;
const hasPluginManagement = contents.includes('pluginManagement'); const hasPluginManagement = contents.includes('pluginManagement');
const hasRepositoriesInPM = /pluginManagement\s*\{[\s\S]*?repositories\s*\{/.test(contents); const hasRepositoriesInPM = /pluginManagement\s*\{[\s\S]*?repositories\s*\{/.test(contents);
if (hasRepositoriesInPM) { if (hasRepositoriesInPM) {
config.modResults.contents = contents.replace( config.modResults.contents = contents.replace(
/(pluginManagement\s*\{[\s\S]*?repositories\s*\{)/, /(pluginManagement\s*\{[\s\S]*?repositories\s*\{)/,
`$1\n ${repoLine}\n ${jigLine}` `$1\n ${repoLine}`
); );
} else if (hasPluginManagement) { } else if (hasPluginManagement) {
config.modResults.contents = contents.replace( config.modResults.contents = contents.replace(
/(pluginManagement\s*\{)/, /(pluginManagement\s*\{)/,
`$1\n repositories {\n gradlePluginPortal()\n google()\n mavenCentral()\n ${repoLine}\n ${jigLine}\n }` `$1\n repositories {\n gradlePluginPortal()\n google()\n mavenCentral()\n ${repoLine}\n }`
); );
} else { } else {
config.modResults.contents = config.modResults.contents =
`pluginManagement {\n repositories {\n ${repoLine}\n ${jigLine}\n }\n}\n\n` + `pluginManagement {\n repositories {\n ${repoLine}\n }\n}\n\n` +
config.modResults.contents; config.modResults.contents;
} }
} }
// Add Jiguang Maven repo to dependencyResolutionManagement (for jcore/jpush SDK)
if (!contents.includes('developer.jiguang.cn/maven')) {
const depMgmtPattern = /dependencyResolutionManagement\s*\{[\s\S]*?repositories\s*\{/;
if (depMgmtPattern.test(config.modResults.contents)) {
config.modResults.contents = config.modResults.contents.replace(
depMgmtPattern,
`$&\n maven { url 'https://developer.jiguang.cn/maven' }`
);
}
}
// Ensure Huawei Maven repo in dependencyResolutionManagement (Gradle 9+) // Ensure Huawei Maven repo in dependencyResolutionManagement (Gradle 9+)
if (!config.modResults.contents.match(/dependencyResolutionManagement[\s\S]*developer\.huawei\.com\/repo/)) { if (!config.modResults.contents.match(/dependencyResolutionManagement[\s\S]*developer\.huawei\.com\/repo/)) {
const depMgmtPattern = /dependencyResolutionManagement\s*\{[\s\S]*?repositories\s*\{/; const depMgmtPattern = /dependencyResolutionManagement\s*\{[\s\S]*?repositories\s*\{/;