From cadc89dceed0020e3f9c64211c3566e66af2bbd9 Mon Sep 17 00:00:00 2001 From: appdata Date: Sun, 28 Apr 2024 15:27:18 +0800 Subject: [PATCH] =?UTF-8?q?build(core.gradle-plugin):=20Maven=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=B7=BB=E5=8A=A0Plugin=20Marker=E6=9E=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 便于插件工程以Gradle更新的plugins id语法引入插件。 plugins { id 'com.tencent.shadow.plugin' } --- buildScripts/gradle/maven.gradle | 16 ++++++++++++++++ .../settings.gradle | 11 +++++++++++ .../stub-project/build.gradle | 12 +++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/buildScripts/gradle/maven.gradle b/buildScripts/gradle/maven.gradle index 51427d23c..d544526be 100644 --- a/buildScripts/gradle/maven.gradle +++ b/buildScripts/gradle/maven.gradle @@ -126,6 +126,22 @@ publishing { setScm(scm) } } + // Plugin Marker Artifacts + // https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers + pluginMarker(MavenPublication) { + def pluginId = 'com.tencent.shadow.plugin' + groupId pluginId + artifactId pluginId + '.gradle.plugin' + version publicationVersion + + pom.withXml { + def root = asNode() + def dependencies = root.appendNode('dependencies') + dependencies.append(getDependencyNode('compile', coreGroupId, 'gradle-plugin', publicationVersion)) + def scm = root.appendNode('scm') + setScm(scm) + } + } manifestParser(MavenPublication) { groupId coreGroupId artifactId 'manifest-parser' diff --git a/projects/test/gradle-plugin-agp-compat-test/settings.gradle b/projects/test/gradle-plugin-agp-compat-test/settings.gradle index add123a22..ab6c7c9f3 100644 --- a/projects/test/gradle-plugin-agp-compat-test/settings.gradle +++ b/projects/test/gradle-plugin-agp-compat-test/settings.gradle @@ -1,3 +1,14 @@ +pluginManagement { + repositories { + if (!System.getenv().containsKey("DISABLE_TENCENT_MAVEN_MIRROR")) { + maven { url 'https://mirrors.tencent.com/nexus/repository/maven-public/' } + } else { + google() + mavenCentral() + } + mavenLocal() + } +} rootProject.name = 'gradle-plugin-agp-compat-test' if (SetGradleVersion != 'true') { include 'stub-project' diff --git a/projects/test/gradle-plugin-agp-compat-test/stub-project/build.gradle b/projects/test/gradle-plugin-agp-compat-test/stub-project/build.gradle index 2130ccd64..4aaacabea 100644 --- a/projects/test/gradle-plugin-agp-compat-test/stub-project/build.gradle +++ b/projects/test/gradle-plugin-agp-compat-test/stub-project/build.gradle @@ -23,9 +23,15 @@ buildscript { classpath "com.tencent.shadow.core:gradle-plugin:$ShadowVersion" } } - -apply plugin: 'com.android.application' -apply plugin: 'com.tencent.shadow.plugin' +try { + plugins { + id 'com.android.application' version "$TestAGPVersion" apply true + id 'com.tencent.shadow.plugin' version "$ShadowVersion" apply true + } +} catch (Exception ignored) { + apply plugin: 'com.android.application' + apply plugin: 'com.tencent.shadow.plugin' +} allprojects { repositories {