Skip to content

Commit

Permalink
Add Maven plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
penfeizhou committed Sep 6, 2023
1 parent daa1438 commit 2a53a2e
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 103 deletions.
5 changes: 5 additions & 0 deletions apng/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
publishing {
singleVariant('release') {
withSourcesJar()
}
}
namespace = "com.github.penfeizhou.animation.apng"
}

Expand Down
5 changes: 5 additions & 0 deletions awebp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
publishing {
singleVariant('release') {
withSourcesJar()
}
}
namespace = "com.github.penfeizhou.animation.awebp"
}

Expand Down
5 changes: 5 additions & 0 deletions awebpencoder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
publishing {
singleVariant('release') {
withSourcesJar()
}
}
namespace = "com.github.penfeizhou.animation.awebpencoder"
}

Expand Down
60 changes: 30 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
id 'com.google.devtools.ksp' version '1.9.10-1.0.13' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.register('clean', Delete) {
delete rootProject.buildFile
}

def needReplaceLocal = true
Expand Down Expand Up @@ -34,31 +34,31 @@ ext {
Version = properties.version
}

//
//task publishFrameAnimation dependsOn(":frameanimation:uploadArchives") {
// println "FrameAnimation published"
//}
//
//task publishAPNG dependsOn(publishFrameAnimation, ":apng:uploadArchives") {
// println "APNG published"
//}
//
//task publishAWebP dependsOn(publishFrameAnimation, ":awebp:uploadArchives") {
// println "AWebP published"
//}
//
//task publishGif dependsOn(publishFrameAnimation, ":gif:uploadArchives") {
// println "Gif published"
//}
//
//task publishAWebPEncoder dependsOn(publishAWebP, publishGif, ":awebpencoder:uploadArchives") {
// println "AwebP Encoder published"
//}
//
//task publishGlidePlugin dependsOn(publishAPNG, publishAWebP, publishGif, ":plugin_glide:uploadArchives") {
// println "GlidePlugin published"
//}
//
//task PublishAll dependsOn(publishGlidePlugin, publishAWebPEncoder) {
// println "All published"
//}

task publishFrameAnimation dependsOn(":frameanimation:publish") {
println "FrameAnimation published"
}

task publishAPNG dependsOn(publishFrameAnimation, ":apng:publish") {
println "APNG published"
}

task publishAWebP dependsOn(publishFrameAnimation, ":awebp:publish") {
println "AWebP published"
}

task publishGif dependsOn(publishFrameAnimation, ":gif:publish") {
println "Gif published"
}

task publishAWebPEncoder dependsOn(publishAWebP, publishGif, ":awebpencoder:publish") {
println "AwebP Encoder published"
}

task publishGlidePlugin dependsOn(publishAPNG, publishAWebP, publishGif, ":plugin_glide:publish") {
println "GlidePlugin published"
}

task PublishAll dependsOn(publishGlidePlugin, publishAWebPEncoder) {
println "All published"
}
5 changes: 5 additions & 0 deletions frameanimation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
publishing {
singleVariant('release') {
withSourcesJar()
}
}
namespace = "com.github.penfeizhou.animation.frameanimation"
}

Expand Down
5 changes: 5 additions & 0 deletions gif/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ android {
path "src/main/cpp/CMakeLists.txt"
}
}
publishing {
singleVariant('release') {
withSourcesJar()
}
}
namespace = "com.github.penfeizhou.animation.gif"
}

Expand Down
5 changes: 5 additions & 0 deletions plugin_glide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
publishing {
singleVariant('release') {
withSourcesJar()
}
}
namespace = "com.github.penfeizhou.animation.glide"
}

Expand Down
150 changes: 77 additions & 73 deletions scripts/upload.gradle
Original file line number Diff line number Diff line change
@@ -1,74 +1,78 @@
//apply plugin: 'maven'
//
//Properties properties = new Properties()
//properties.load(project.rootProject.file('scripts/maven.properties').newDataInputStream())
//properties.load(new FileInputStream("${projectDir}/pom.properties"))
//
//
//if (new File("local.properties").exists()) {
// properties.load(project.rootProject.file('local.properties').newDataInputStream())
//}
//
//def user = System.getenv("BINTARY_USER")
//def apiKey = System.getenv("BINTARY_APIKEY")
//def repo = System.getenv("BINTARY_REPO")
//
//if (user == null || user.length() == 0) {
// user = properties.user
//}
//
//if (apiKey == null || apiKey.length() == 0) {
// apiKey = properties.apiKey
//}
//
//if (repo == null || repo.length() == 0) {
// repo = properties.releasesRepository
//}
//
//apply plugin: 'maven'
//
//uploadArchives {
// repositories {
// mavenDeployer {
// pom.groupId = properties.groupId
// pom.artifactId = properties.artifactId
// pom.version = rootProject.ext.Version
//
// pom.project {
// name 'APNG4Android'
// description 'Android animation support for APNG & Animated WebP & Gif'
// url 'https://github.com/penfeizhou/APNG4Android'
// licenses {
// license {
// name = 'The Apache License, Version 2.0'
// url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
// }
// }
// developers {
// developer {
// id = 'penfeizhou'
// name = 'osborn'
// }
// }
apply plugin: 'maven-publish'

Properties properties = new Properties()
properties.load(project.rootProject.file('scripts/maven.properties').newDataInputStream())
properties.load(new FileInputStream("${projectDir}/pom.properties"))


if (new File("local.properties").exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}

def user = System.getenv("BINTARY_USER")
def apiKey = System.getenv("BINTARY_APIKEY")
def repo = System.getenv("BINTARY_REPO")

if (user == null || user.length() == 0) {
user = properties.user
}

if (apiKey == null || apiKey.length() == 0) {
apiKey = properties.apiKey
}

if (repo == null || repo.length() == 0) {
repo = properties.releasesRepository
}
println("User:${user}")

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId = properties.groupId
artifactId = properties.artifactId
version = rootProject.ext.Version
pom {
name = 'APNG4Android'
description = 'Android animation support for APNG & Animated WebP & Gif'
url = 'https://github.com/penfeizhou/APNG4Android'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'osborn'
name = 'Pengfei Zhou'
email = 'pengfeizhou@foxmail.com'
}
}
scm {
connection = 'scm:git:git@github.com:penfeizhou/APNG4Android.git'
url = 'https://github.com/penfeizhou/APNG4Android'
}
}
afterEvaluate {
from components.release
}
}
}
repositories {
// maven {
// name = 'myrepo'
// url = "${project.buildDir}/repo"
// }
//
// repository(url: repo) {
// authentication(userName: user, password: apiKey)
// }
// }
// }
//}
//
//task uploadAar {
// dependsOn clean, uploadArchives
//}
//
//// 打包时上传源码,可选
//task androidSourcesJar(type: Jar) {
// classifier = "sources"
// from android.sourceSets.main.java.sourceFiles
//}
//
//artifacts {
// archives androidSourcesJar
//}
maven {
name = 'MavenCentral'
url = repo
credentials {
username user
password apiKey
}
}
}
}
}

0 comments on commit 2a53a2e

Please sign in to comment.