Skip to content

Commit

Permalink
build(core.gradle-plugin): Maven发布添加Plugin Marker构件
Browse files Browse the repository at this point in the history
便于插件工程以Gradle更新的plugins id语法引入插件。
plugins {
    id 'com.tencent.shadow.plugin'
}
  • Loading branch information
XuchengJie authored and shifujun committed Apr 28, 2024
1 parent 59b9c79 commit cadc89d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
16 changes: 16 additions & 0 deletions buildScripts/gradle/maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions projects/test/gradle-plugin-agp-compat-test/settings.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cadc89d

Please sign in to comment.