Skip to content

Commit

Permalink
发布到Gradle Plugin Portal
Browse files Browse the repository at this point in the history
  • Loading branch information
qq549631030 committed Aug 9, 2023
1 parent 1b898d0 commit e3a4361
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 5 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ androidJunkCode {
}
```

**注:从1.3.0开始本库已经上传到Gradle Plugin Portal 可直接这样使用**

```groovy
plugins {
//插件id和前面mavenCentral的不一样
//开头是io.github不是com.github
id "io.github.qq549631030.android-junk-code" version "x.x.x"
}
androidJunkCode {
variantConfig {
release {
//...
}
}
}
```

如果有多个变体共用一个配置可以这样做

```groovy
Expand Down
64 changes: 63 additions & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,77 @@
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
classpath "com.gradle.publish:plugin-publish-plugin:1.2.0"
}
}

apply plugin: 'groovy'
apply plugin: "com.vanniktech.maven.publish"

def publishMaven = false
if (publishMaven) {
apply plugin: "com.vanniktech.maven.publish"
} else {
apply plugin: 'signing'
apply plugin: 'com.gradle.plugin-publish'

group = 'io.github.qq549631030'
version = VERSION_NAME

gradlePlugin {
plugins {
androidJunkCode {
id = 'io.github.qq549631030.android-junk-code'
implementationClass = 'cn.hx.plugin.junkcode.plugin.AndroidJunkCodePlugin'
displayName = 'AndroidJunkCode plugin'
description = POM_DESCRIPTION
}
}
}

pluginBundle {
website = POM_URL
vcsUrl = POM_SCM_URL
description = POM_DESCRIPTION
tags = ['android', 'generate', 'junk', 'code']
}

publishing {
publications {
pluginMaven(MavenPublication) {
artifactId = POM_ARTIFACT_ID
pom {
name = POM_NAME
description = POM_DESCRIPTION
inceptionYear = POM_INCEPTION_YEAR
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
url = POM_DEVELOPER_URL
}
}
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
}
}
}
}
}

java {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
7 changes: 3 additions & 4 deletions library/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#project
GROUP=com.github.qq549631030
VERSION_NAME=1.3.0

POM_ARTIFACT_ID=android-junk-code
POM_NAME=AndroidJunkCode
VERSION_NAME=1.3.0
POM_PACKAGING=jar

POM_NAME=AndroidJunkCode
POM_DESCRIPTION=generate junk code for android
POM_INCEPTION_YEAR=2020

POM_URL=https://github.com/qq549631030/AndroidJunkCode/

POM_SCM_URL=https://github.com/qq549631030/AndroidJunkCode/
POM_SCM_CONNECTION=scm:git:git://github.com/qq549631030/AndroidJunkCode.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/qq549631030/AndroidJunkCode.git
Expand Down

0 comments on commit e3a4361

Please sign in to comment.