From 4b29ff2bb2a82d93cb37860f754deebd5c7c21a3 Mon Sep 17 00:00:00 2001 From: cooksey Date: Fri, 30 Apr 2021 13:59:17 -0500 Subject: [PATCH] Migrates publishing from bintray to Sonatype Maven Central (#22) * Updates build tools --- .gitignore | 1 + build.gradle | 4 +- channel-sdk/build.gradle | 131 +++++----- channel-sdk/full-r8-config.txt | 304 +++++++++++++++++++++++ channel-sdk/gradle.properties | 3 + gradle.properties | 1 + gradle/wrapper/gradle-wrapper.properties | 4 +- 7 files changed, 387 insertions(+), 61 deletions(-) create mode 100644 channel-sdk/full-r8-config.txt create mode 100644 channel-sdk/gradle.properties diff --git a/.gitignore b/.gitignore index 39c474a..ec73e5e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ local.properties .gradle **/.cxx **/.externalNativeBuild +javadoc diff --git a/build.gradle b/build.gradle index 0c376c1..ef7542b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.3.61' + ext.kotlin_version = '1.4.32' ext.dokka_version = '0.9.17' ext.gradle_bintray_version = '1.8.4' repositories { @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.2' + classpath 'com.android.tools.build:gradle:4.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$dokka_version" classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_version" diff --git a/channel-sdk/build.gradle b/channel-sdk/build.gradle index 0cfdd5f..af1bbb2 100644 --- a/channel-sdk/build.gradle +++ b/channel-sdk/build.gradle @@ -1,9 +1,10 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'org.jetbrains.dokka' -apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'org.jetbrains.dokka' + id 'maven-publish' + id 'signing' +} android { compileSdkVersion 29 @@ -11,7 +12,7 @@ android { minSdkVersion 15 targetSdkVersion 29 versionCode 1 - versionName "0.5.1" + versionName "0.5.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -34,7 +35,7 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - task dokka(overwrite: true, type: org.jetbrains.dokka.gradle.DokkaAndroidTask) { + task sdkDocumentation(type: org.jetbrains.dokka.gradle.DokkaAndroidTask) { outputFormat = 'html' outputDirectory = "../javadoc" includeNonPublic = false @@ -54,64 +55,80 @@ android { } task sourcesJar(type: Jar) { - classifier = 'sources' + archiveClassifier = 'sources' from android.sourceSets.main.java.srcDirs } - task javadocJar(type: Jar, dependsOn: dokka) { - classifier = 'javadoc' - from dokka.outputDirectory + task javadocJar(type: Jar, dependsOn: sdkDocumentation) { + archiveClassifier = 'javadoc' + from sdkDocumentation.outputDirectory } - publishing { - publications { - channelsSdk(MavenPublication) { - groupId 'com.zello' - artifactId 'zello-channel-sdk' - version android.defaultConfig.versionName - // Change release to debug below for development - artifact "$buildDir/outputs/aar/release/zello-${archivesBaseName}.aar" - artifact sourcesJar - artifact javadocJar + afterEvaluate { + publishing { + publications { + channelsSdk(MavenPublication) { + from components.release + artifact sourcesJar + artifact javadocJar + + groupId 'com.zello' + artifactId 'zello-channel-sdk' + version android.defaultConfig.versionName - pom.withXml { - def dependenciesNode = asNode().appendNode('dependencies') - configurations.implementation.allDependencies.each { dependency -> - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', dependency.group) - dependencyNode.appendNode('artifactId', dependency.name) - dependencyNode.appendNode('version', dependency.version) + pom { + packaging = "aar" + name = "Zello Channels SDK" + description = "The Zello Channels SDK allows you to integrate Zello push-to-talk into your own application. The SDK communicates with a Zello server over a web socket connection using a JSON-based protocol, and offers a simple API to send and receive audio, images, and text over Zello channels. Supported features include: Send voice messages from the device microphone Play incoming voice messages through the device speaker Send voice messages from your own audio code, e.g. from a file Receive voice message data with your own audio code with optional pass-through to the device speaker Send and recieve text messages Send and receive images Send the device's current location, and receive location messages from other users The protocol specification is also available if you prefer to develop your own client in-house." + url = "https://github.com/zelloptt/zello-channel-api/" + licenses { + license { + name = "MIT License" + url = "http://www.opensource.org/licenses/mit-license.php" + } + } + developers { + developer { + name = "Greg Cooksey" + email = "greg@zello.com" + organization = "Zello" + organizationUrl = "https://zello.com/" + } + } + scm { + connection = "scm:git:git://github.com/zelloptt/zello-channel-api.git" + url = "https://github.com/zelloptt/zello-channel-api/tree/master" + } } } + } - } - // Uncomment mavenLocal definition for development + repositories { + maven { + name = "sonatype" + url = defaultConfig.versionName.endsWith('SNAPSHOT') ? "https://s01.oss.sonatype.org/content/repositories/snapshots" : "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2" + credentials { + Properties properties = new Properties() + properties.load(project.rootProject.file('local.properties').newDataInputStream()) + + username = findProperty("ossrhUsername") + password = findProperty("ossrhPassword") + } + } + } + + // Uncomment mavenLocal definition for development // repositories { // mavenLocal() // } - } - - Properties localProperties = new Properties() - localProperties.load(project.rootProject.file('local.properties').newDataInputStream()) - def bintrayUser = localProperties.getProperty('bintray.user') - def bintrayApiKey = localProperties.getProperty('bintray.apikey') - - bintray { - user = bintrayUser - key = bintrayApiKey - - dryRun = false - publish = false - override = true + } - pkg { - repo = 'zello-channel-sdk' - name = 'zello-channel-sdk' - publications = ['channelsSdk'] + signing { + def signingKey = findProperty("ossrhSigningKey") + def password = findProperty("ossrhSigningPassword") + useInMemoryPgpKeys(signingKey, password) - version { - name = android.defaultConfig.versionName - } + sign publishing.publications.channelsSdk } } @@ -120,13 +137,13 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2' testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test:rules:1.2.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test:runner:1.3.0' + androidTestImplementation 'androidx.test:rules:1.3.0' } diff --git a/channel-sdk/full-r8-config.txt b/channel-sdk/full-r8-config.txt new file mode 100644 index 0000000..3592ea3 --- /dev/null +++ b/channel-sdk/full-r8-config.txt @@ -0,0 +1,304 @@ +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html +# +# Starting with version 2.2 of the Android plugin for Gradle, this file is distributed together with +# the plugin and unpacked at build-time. The files in $ANDROID_HOME are no longer maintained and +# will be ignored by new version of the Android plugin for Gradle. + +# Optimization is turned off by default. Dex does not like code run +# through the ProGuard optimize steps (and performs some +# of these optimizations on its own). +# Note that if you want to enable optimization, you cannot just +# include optimization flags in your own project configuration file; +# instead you will need to point to the +# "proguard-android-optimize.txt" file instead of this one from your +# project.properties file. +-dontoptimize + +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +# Preserve some attributes that may be required for reflection. +-keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod + +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService +-keep public class com.google.android.vending.licensing.ILicensingService +-dontnote com.android.vending.licensing.ILicensingService +-dontnote com.google.vending.licensing.ILicensingService +-dontnote com.google.android.vending.licensing.ILicensingService + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} + +# Keep setters in Views so that animations can still work. +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +# We want to keep methods in Activity that could be used in the XML attribute onClick. +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keepclassmembers class * implements android.os.Parcelable { + public static final ** CREATOR; +} + +-keepclassmembers class **.R$* { + public static ; +} + +# Preserve annotated Javascript interface methods. +-keepclassmembers class * { + @android.webkit.JavascriptInterface ; +} + +# The support libraries contains references to newer platform versions. +# Don't warn about those in case this app is linking against an older +# platform version. We know about them, and they are safe. +-dontnote android.support.** +-dontnote androidx.** +-dontwarn android.support.** +-dontwarn androidx.** + +# This class is deprecated, but remains for backward compatibility. +-dontwarn android.util.FloatMath + +# Understand the @Keep support annotation. +-keep class android.support.annotation.Keep +-keep class androidx.annotation.Keep + +-keep @android.support.annotation.Keep class * {*;} +-keep @androidx.annotation.Keep class * {*;} + +-keepclasseswithmembers class * { + @android.support.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @android.support.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @android.support.annotation.Keep (...); +} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep (...); +} + +# These classes are duplicated between android.jar and org.apache.http.legacy.jar. +-dontnote org.apache.http.** +-dontnote android.net.http.** + +# These classes are duplicated between android.jar and core-lambda-stubs.jar. +-dontnote java.lang.invoke.** + +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile + +-printconfiguration full-r8-config.txt + +-keep public class * extends android.content.BroadcastReceiver +-keep public class com.zello.channel.sdk.BuildConfig { *; } + +-keep public enum com.zello.channel.sdk.ChannelFeature { *; } +-keep public class com.zello.channel.sdk.ImageInfo { *; } +-keep public class com.zello.channel.sdk.IncomingVoiceConfiguration { *; } +-keep public class com.zello.channel.sdk.IncomingVoiceStream { *; } +-keep public class com.zello.channel.sdk.IncomingVoiceStreamInfo { *; } +-keep public class com.zello.channel.sdk.InformationalError { *; } +-keep public class com.zello.channel.sdk.InvalidImageMessageError { *; } +-keep public class com.zello.channel.sdk.InvalidMessageFormatError { *; } +-keep public class com.zello.channel.sdk.Location { *; } +-keep public class com.zello.channel.sdk.OutgoingVoiceConfiguration { *; } +-keep public class com.zello.channel.sdk.OutgoingVoiceStream { *; } +-keep public enum com.zello.channel.sdk.OutgoingVoiceStreamError { *; } +-keep public enum com.zello.channel.sdk.ReconnectReason { *; } +-keep public class com.zello.channel.sdk.SendImageError { *; } +-keep public class com.zello.channel.sdk.SendLocationError { *; } +-keep public class com.zello.channel.sdk.SentLocationCallback { *; } +-keep public class com.zello.channel.sdk.Session { *; } +-keep public class com.zello.channel.sdk.Session$Builder { *; } +-keep public class com.zello.channel.sdk.SessionConnectError { *; } +-keep public enum com.zello.channel.sdk.SessionConnectError$Code { *; } +-keep public class com.zello.channel.sdk.SessionListener { *; } +-keep public class com.zello.channel.sdk.SessionListener$DefaultImpls { *; } +-keep public class com.zello.channel.sdk.SessionLogger { *; } +-keep public class com.zello.channel.sdk.SessionLoggerAdb { *; } +-keep public class com.zello.channel.sdk.SessionLoggerNull { *; } +-keep public enum com.zello.channel.sdk.SessionState { *; } +-keep public class com.zello.channel.sdk.VoiceReceiver { *; } +-keep public class com.zello.channel.sdk.VoiceSink { *; } +-keep public class com.zello.channel.sdk.VoiceSource { *; } +-keep public class com.zello.channel.sdk.VoiceStream { *; } +-keep public enum com.zello.channel.sdk.VoiceStreamState { *; } + +# Generated by the gradle plugin + +# Copyright (C) 2018 The Android Open Source Project +# +# 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. + +# Ensure that reflectively-loaded inflater is not obfuscated. This can be +# removed when we stop supporting AAPT1 builds. +-keepnames class androidx.appcompat.app.AppCompatViewInflater + +# aapt is not able to read app::actionViewClass and app:actionProviderClass to produce proguard +# keep rules. Add a commonly used SearchView to the keep list until b/109831488 is resolved. +-keep class androidx.appcompat.widget.SearchView { (...); } +# Files in this directory will be ignored starting with Android Gradle Plugin 3.6.0+ + +# When editing this file, update the following files as well for AGP 3.6.0+: +# - META-INF/com.android.tools/proguard/coroutines.pro +# - META-INF/com.android.tools/r8-upto-1.6.0/coroutines.pro + +-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;} + +# ServiceLoader support +-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} +-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {} +-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {} +-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {} + +# Most of volatile fields are updated with AFU and should not be mangled +-keepclassmembernames class kotlinx.** { + volatile ; +} + +# Copyright (C) 2016 The Android Open Source Project +# +# 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. + +# keep setters in VectorDrawables so that animations can still work. +-keepclassmembers class androidx.vectordrawable.graphics.drawable.VectorDrawableCompat$* { + void set*(***); + *** get*(); +} + +# aapt2 is not (yet) keeping FQCNs defined in the appComponentFactory attribute +-keep class androidx.core.app.CoreComponentFactory + +-keep public class * implements androidx.versionedparcelable.VersionedParcelable +-keep public class android.support.**Parcelizer { *; } +-keep public class androidx.**Parcelizer { *; } +-keep public class androidx.versionedparcelable.ParcelImpl + +-keepattributes *Annotation* + +-keepclassmembers enum androidx.lifecycle.Lifecycle$Event { + ; +} + +-keep !interface * implements androidx.lifecycle.LifecycleObserver { +} + +-keep class * implements androidx.lifecycle.GeneratedAdapter { + (...); +} + +-keepclassmembers class ** { + @androidx.lifecycle.OnLifecycleEvent *; +} +-keepclassmembers,allowobfuscation class * extends androidx.lifecycle.ViewModel { + (); +} + +-keepclassmembers,allowobfuscation class * extends androidx.lifecycle.AndroidViewModel { + (android.app.Application); +} + +# Copyright (C) 2019 The Android Open Source Project +# +# 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. + +-keepclassmembers,allowobfuscation class * implements androidx.savedstate.SavedStateRegistry$AutoRecreated { + (); +} + +-keep,allowobfuscation @interface androidx.annotation.Keep +-keep @androidx.annotation.Keep class * {*;} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep ; +} + +-keepclasseswithmembers class * { + @androidx.annotation.Keep (...); +} + +-ignorewarnings +-keep class **.R +-keep class **.R$* \ No newline at end of file diff --git a/channel-sdk/gradle.properties b/channel-sdk/gradle.properties new file mode 100644 index 0000000..a6e1958 --- /dev/null +++ b/channel-sdk/gradle.properties @@ -0,0 +1,3 @@ +POM_NAME=ZelloChannelsSdk +POM_ARTIFACT_ID=zello-channels-sdk +POM_PACKAGING=aar diff --git a/gradle.properties b/gradle.properties index 9e6fce1..272babd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,3 +17,4 @@ org.gradle.jvmargs=-Xmx1536m # 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 +org.gradle.warning.mode=all diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4751ff..d823297 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Oct 28 12:08:12 CDT 2019 +#Wed Apr 28 11:33:29 CDT 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip