David Liu

add in base maven push gradle stuff

@@ -14,6 +14,7 @@ buildscript { @@ -14,6 +14,7 @@ buildscript {
14 classpath 'com.android.tools.build:gradle:4.1.3' 14 classpath 'com.android.tools.build:gradle:4.1.3'
15 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 15 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16 classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" 16 classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
  17 + classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
17 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.15' 18 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.15'
18 // NOTE: Do not place your application dependencies here; they belong 19 // NOTE: Do not place your application dependencies here; they belong
19 // in the individual module build.gradle files 20 // in the individual module build.gradle files
@@ -19,3 +19,25 @@ android.useAndroidX=true @@ -19,3 +19,25 @@ android.useAndroidX=true
19 android.enableJetifier=true 19 android.enableJetifier=true
20 # Kotlin code style for this project: "official" or "obsolete": 20 # Kotlin code style for this project: "official" or "obsolete":
21 kotlin.code.style=official 21 kotlin.code.style=official
  22 +
  23 +###############################################################
  24 +
  25 +GROUP=io.livekit
  26 +VERSION_NAME=0.5.1-SNAPSHOT
  27 +
  28 +POM_DESCRIPTION=Android SDK for WebRTC communication
  29 +
  30 +POM_URL=https://github.com/livekit/client-sdk-android
  31 +POM_SCM_URL=https://github.com/livekit/client-sdk-android
  32 +POM_SCM_CONNECTION=scm:git:git://github.com/livekit/client-sdk-android.git
  33 +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/livekit/client-sdk-android.git
  34 +
  35 +POM_LICENCE_NAME=
  36 +POM_LICENCE_URL=
  37 +POM_LICENCE_DIST=repo
  38 +
  39 +POM_DEVELOPER_ID=livekit
  40 +POM_DEVELOPER_NAME=LiveKit
  41 +
  42 +RELEASE_REPOSITORY_URL=https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
  43 +SNAPSHOT_REPOSITORY_URL=https://s01.oss.sonatype.org/content/repositories/snapshots/
  1 +/*
  2 + * Copyright 2013 Chris Banes
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +/*
  18 + * This file is from:
  19 + * https://github.com/chrisbanes/gradle-mvn-push/blob/master/gradle-mvn-push.gradle
  20 + */
  21 +
  22 +apply plugin: 'maven-publish'
  23 +apply plugin: 'signing'
  24 +
  25 +version = VERSION_NAME
  26 +group = GROUP
  27 +
  28 +def isReleaseBuild() {
  29 + return VERSION_NAME.contains("SNAPSHOT") == false
  30 +}
  31 +
  32 +def getReleaseRepositoryUrl() {
  33 + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
  34 + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
  35 +}
  36 +
  37 +def getSnapshotRepositoryUrl() {
  38 + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
  39 + : "https://oss.sonatype.org/content/repositories/snapshots/"
  40 +}
  41 +
  42 +def getRepositoryUsername() {
  43 + return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
  44 +}
  45 +
  46 +def getRepositoryPassword() {
  47 + return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
  48 +}
  49 +
  50 +def configurePom(pom) {
  51 + pom.name = POM_NAME
  52 + pom.packaging = POM_PACKAGING
  53 + pom.description = POM_DESCRIPTION
  54 + pom.url = POM_URL
  55 +
  56 + pom.scm {
  57 + url = POM_SCM_URL
  58 + connection = POM_SCM_CONNECTION
  59 + developerConnection = POM_SCM_DEV_CONNECTION
  60 + }
  61 +
  62 + pom.licenses {
  63 + license {
  64 + name = POM_LICENCE_NAME
  65 + url = POM_LICENCE_URL
  66 + distribution = POM_LICENCE_DIST
  67 + }
  68 + }
  69 +
  70 + pom.developers {
  71 + developer {
  72 + id = POM_DEVELOPER_ID
  73 + name = POM_DEVELOPER_NAME
  74 + }
  75 + }
  76 +}
  77 +
  78 +afterEvaluate { project ->
  79 + publishing {
  80 + repositories {
  81 + maven {
  82 + def releasesRepoUrl = getReleaseRepositoryUrl()
  83 + def snapshotsRepoUrl = getSnapshotRepositoryUrl()
  84 + url = isReleaseBuild() ? releasesRepoUrl : snapshotsRepoUrl
  85 +
  86 + credentials(PasswordCredentials) {
  87 + username = getRepositoryUsername()
  88 + password = getRepositoryPassword()
  89 + }
  90 + }
  91 + }
  92 + }
  93 +
  94 + if (project.getPlugins().hasPlugin('com.android.application') ||
  95 + project.getPlugins().hasPlugin('com.android.library')) {
  96 +
  97 + task androidJavadocs(type: Javadoc) {
  98 + source = android.sourceSets.main.java.source
  99 + classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  100 + excludes = ['**/*.kt']
  101 + }
  102 +
  103 + task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
  104 + classifier = 'javadoc'
  105 + from androidJavadocs.destinationDir
  106 + }
  107 +
  108 + task androidSourcesJar(type: Jar) {
  109 + classifier = 'sources'
  110 + from android.sourceSets.main.java.source
  111 + }
  112 + }
  113 +
  114 + if (JavaVersion.current().isJava8Compatible()) {
  115 + allprojects {
  116 + tasks.withType(Javadoc) {
  117 + options.addStringOption('Xdoclint:none', '-quiet')
  118 + }
  119 + }
  120 + }
  121 +
  122 + if (JavaVersion.current().isJava9Compatible()) {
  123 + allprojects {
  124 + tasks.withType(Javadoc) {
  125 + options.addBooleanOption('html5', true)
  126 + }
  127 + }
  128 + }
  129 +
  130 + artifacts {
  131 + if (project.getPlugins().hasPlugin('com.android.application') ||
  132 + project.getPlugins().hasPlugin('com.android.library')) {
  133 + archives androidSourcesJar
  134 + archives androidJavadocsJar
  135 + }
  136 + }
  137 +
  138 + android.libraryVariants.all { variant ->
  139 + tasks.androidJavadocs.doFirst {
  140 + classpath += files(variant.javaCompileProvider.get().classpath.files.join(File.pathSeparator))
  141 + }
  142 + }
  143 +
  144 + publishing.publications.all { publication ->
  145 + publication.groupId = GROUP
  146 + publication.version = VERSION_NAME
  147 +
  148 + publication.artifact androidSourcesJar
  149 + publication.artifact androidJavadocsJar
  150 +
  151 + configurePom(publication.pom)
  152 + }
  153 +
  154 + signing {
  155 + publishing.publications.all { publication ->
  156 + sign publication
  157 + }
  158 + }
  159 +}
1 -apply plugin: 'com.android.library'  
2 -apply plugin: 'kotlin-android'  
3 -apply plugin: 'kotlin-kapt'  
4 -apply plugin: 'kotlinx-serialization'  
5 -apply plugin: 'com.google.protobuf'  
6 -apply plugin: 'org.jetbrains.dokka' 1 +plugins {
  2 + id "org.jetbrains.dokka"
  3 + id 'com.android.library'
  4 + id 'kotlin-android'
  5 + id 'kotlin-kapt'
  6 + id 'kotlinx-serialization'
  7 + id 'com.google.protobuf'
  8 + id 'com.bmuschko.nexus'
  9 +}
7 10
8 android { 11 android {
9 - compileSdkVersion 29  
10 - buildToolsVersion "29.0.3" 12 + compileSdkVersion 30
  13 + buildToolsVersion "30.0.3"
11 14
12 15
13 defaultConfig { 16 defaultConfig {
14 minSdkVersion 21 17 minSdkVersion 21
15 - targetSdkVersion 29 18 + targetSdkVersion 30
16 versionCode 1 19 versionCode 1
17 - versionName "1.0" 20 + versionName VERSION_NAME
18 21
19 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 22 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
20 consumerProguardFiles 'consumer-rules.pro' 23 consumerProguardFiles 'consumer-rules.pro'
  24 +
  25 + buildConfigField "String", "VERSION_NAME", "\"$VERSION_NAME\""
21 } 26 }
22 27
23 buildTypes { 28 buildTypes {
@@ -90,7 +95,7 @@ dokkaHtml { @@ -90,7 +95,7 @@ dokkaHtml {
90 dependencies { 95 dependencies {
91 implementation fileTree(dir: 'libs', include: ['*.jar']) 96 implementation fileTree(dir: 'libs', include: ['*.jar'])
92 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 97 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
93 - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' 98 + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
94 implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0' 99 implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0'
95 api 'org.webrtc:google-webrtc:1.0.32006' 100 api 'org.webrtc:google-webrtc:1.0.32006'
96 api "com.squareup.okhttp3:okhttp:4.9.0" 101 api "com.squareup.okhttp3:okhttp:4.9.0"
@@ -109,3 +114,5 @@ dependencies { @@ -109,3 +114,5 @@ dependencies {
109 androidTestImplementation 'androidx.test.ext:junit:1.1.2' 114 androidTestImplementation 'androidx.test.ext:junit:1.1.2'
110 androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 115 androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
111 } 116 }
  117 +
  118 +apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
  1 +POM_NAME=LiveKit Client Android SDK
  2 +POM_ARTIFACT_ID=livekit-android-sdk
  3 +POM_PACKAGING=aar
1 package io.livekit.android 1 package io.livekit.android
2 2
3 -class Version {  
4 - companion object {  
5 - const val CLIENT_VERSION = "0.5.1"  
6 - } 3 +object Version {
  4 + const val CLIENT_VERSION = BuildConfig.VERSION_NAME
7 } 5 }