From 18e9e5e885a297755d800360a094db5aea6e50a7 Mon Sep 17 00:00:00 2001 From: lizhuogui Date: Sun, 2 Jun 2019 20:49:03 +0800 Subject: [PATCH] version 2.0.0, upload to maven central --- README.md | 10 +++ build.gradle | 6 +- coverflow/build.gradle | 6 +- coverflow/gradle.properties | 3 + gradle.properties | 16 ++++- gradle/gradle-mvn-push.gradle | 114 ++++++++++++++++++++++++++++++++++ 6 files changed, 149 insertions(+), 6 deletions(-) create mode 100644 coverflow/gradle.properties create mode 100644 gradle/gradle-mvn-push.gradle diff --git a/README.md b/README.md index 25eb4a5..e343c10 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,16 @@ A beautiful cover flow for android platform , base on ViewPager. ### Build + +#### AndroidX +```groovy +dependencies { + implementation 'com.github.lizhuogui.android:coverflow:2.0.0' +} +``` + +#### support library + ##### Step 1. Add the JitPack repository to your build file ```build allprojects { diff --git a/build.gradle b/build.gradle index 3ba8c3e..16bf805 100644 --- a/build.gradle +++ b/build.gradle @@ -27,10 +27,10 @@ task clean(type: Delete) { def androidxVersion = "1.0.0" def materialVersion = "1.0.0" -ext{ +ext { legacySupportV4 = "androidx.legacy:legacy-support-v4:${androidxVersion}" appCompat = "androidx.appcompat:appcompat:${androidxVersion}" - cardView = "androidx.cardview:cardview:${androidxVersion}" - materialDesign = "com.google.android.material:material:${materialVersion}" + cardView = "androidx.cardview:cardview:${androidxVersion}" + materialDesign = "com.google.android.material:material:${materialVersion}" } diff --git a/coverflow/build.gradle b/coverflow/build.gradle index 5783054..1379264 100644 --- a/coverflow/build.gradle +++ b/coverflow/build.gradle @@ -6,8 +6,8 @@ android { defaultConfig { minSdkVersion 15 targetSdkVersion 28 - versionCode 2 - versionName "1.0.2" + versionCode 200 + versionName "2.0.0" } buildTypes { release { @@ -28,3 +28,5 @@ dependencies { testImplementation 'junit:junit:4.12' implementation rootProject.ext.legacySupportV4 } + +apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/coverflow/gradle.properties b/coverflow/gradle.properties new file mode 100644 index 0000000..f76f6b0 --- /dev/null +++ b/coverflow/gradle.properties @@ -0,0 +1,3 @@ +POM_NAME=Android-Coverflow Library +POM_ARTIFACT_ID=coverflow +POM_PACKAGING=aar \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 915f0e6..9a35cb2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,5 +16,19 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true +VERSION_NAME=2.0.0 +VERSION_CODE=200 +GROUP=com.github.lizhuogui.android +POM_DESCRIPTION=A beautiful cover flow for android platform , base on ViewPager. +POM_URL=https://github.com/lizhuogui/Android-Coverflow +POM_SCM_URL=https://github.com/lizhuogui/Android-Coverflow +POM_SCM_CONNECTION=scm:git@github.com:lizhuogui/Android-Coverflow.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:lizhuogui/Android-Coverflow.git +POM_LICENCE_NAME=MIT License +POM_LICENCE_URL=https://github.com/lizhuogui/Android-Coverflow/blob/master/LICENSE +POM_LICENCE_DIST=repo +POM_DEVELOPER_ID=lizhuogui +POM_DEVELOPER_NAME=lizhuogui + android.enableJetifier=true -android.useAndroidX=true \ No newline at end of file +android.useAndroidX=true diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle new file mode 100644 index 0000000..7b2d95c --- /dev/null +++ b/gradle/gradle-mvn-push.gradle @@ -0,0 +1,114 @@ +/* + * Copyright 2013 Chris Banes + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'maven' +apply plugin: 'signing' + +def isReleaseBuild() { + return VERSION_NAME.contains("SNAPSHOT") == false +} + +def getReleaseRepositoryUrl() { + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +} + +def getSnapshotRepositoryUrl() { + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" +} + +def getRepositoryUsername() { + return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" +} + +def getRepositoryPassword() { + return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" +} + +afterEvaluate { project -> + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + pom.groupId = GROUP + pom.artifactId = POM_ARTIFACT_ID + pom.version = VERSION_NAME + + repository(url: getReleaseRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + snapshotRepository(url: getSnapshotRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + + pom.project { + name POM_NAME + packaging POM_PACKAGING + description POM_DESCRIPTION + url POM_URL + + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + + licenses { + license { + name POM_LICENCE_NAME + url POM_LICENCE_URL + distribution POM_LICENCE_DIST + } + } + + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + } + } + } + } + } + } + + signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives + } + + task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + } + + task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { + classifier = 'javadoc' + from androidJavadocs.destinationDir + } + + task androidSourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.sourceFiles + } + + artifacts { + archives androidSourcesJar + archives androidJavadocsJar + } +} \ No newline at end of file