Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK & Environment Improvement #56

Merged
merged 4 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
}
}

allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
plugins {
id 'com.android.application' version '7.1.0-rc01' apply false
id 'com.android.library' version '7.1.0-rc01' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}
}
90 changes: 90 additions & 0 deletions buildSrc/publish-module.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
} else {
from sourceSets.main.java.srcDirs
from sourceSets.main.kotlin.srcDirs
}
}

tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
pluginsMapConfiguration.set(
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
)
}

task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set('javadoc')
from dokkaJavadoc.outputDirectory
}

artifacts {
archives androidSourcesJar
archives javadocJar
}

group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION
if (project.plugins.findPlugin("com.android.library")) {
from components.release
} else {
from components.java
}

artifact androidSourcesJar
artifact javadocJar

pom {
name = PUBLISH_ARTIFACT_ID
description = 'Stream Chat official Android SDK'
url = 'https://github.com/getstream/stream-chat-android'
licenses {
license {
name = 'Stream License'
url = 'https://github.com/GetStream/stream-chat-android/blob/main/LICENSE'
}
}
developers {
developer {
id = 'zeoflow'
name = 'ZeoFlow SRL'
email = 'open-srouce@zeoflow.com'
}
developer {
id = 'teodorhmx1'
name = 'Teodor G.'
email = 'teo@zeoflow.com'
}
}
scm {
connection = 'scm:git:github.com/getstream/stream-chat-android.git'
developerConnection = 'scm:git:ssh://github.com/getstream/stream-chat-android.git'
url = 'https://github.com/getstream/stream-chat-android/tree/main'
}
}
}
}
}
}

ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]

signing {
sign publishing.publications
}
211 changes: 211 additions & 0 deletions buildSrc/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
apply plugin: 'maven-publish'

task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}

exclude '**/R.html', '**/R.*.html', '**/index.html'
options.encoding 'utf-8'
options {
addStringOption 'docencoding', 'utf-8'
addStringOption 'charset', 'utf-8'
links 'https://docs.oracle.com/javase/7/docs/api/'
links 'https://d.android.com/reference'
links 'https://developer.android.com/reference/androidx/'
}
}

task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
archiveClassifier.set('javadoc')
from androidJavadoc.destinationDir

preserveFileTimestamps = false
reproducibleFileOrder = true
}

task javaSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs

preserveFileTimestamps = false
reproducibleFileOrder = true
}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {

from components.release

artifact androidJavadocJar
artifact javaSourcesJar

groupId = GROUP
version = VERSION_NAME

pom {
name = artifactId
description = ''
url = ''
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
// distribution POM_LICENCE_DIST
}
}
developers {
developer {
id = 'zeoflow'
name = 'ZeoFLow SRL'
email = 'open-source@zeoflow.com'
}
developer {
id = 'teodorhmx1'
name = 'Teodor G.'
email = 'teo@zeoflow.com'
}
}
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
}
}
}
repositories {
maven {
def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username NEXUS_USERNAME
password NEXUS_PASSWORD
}
}
}
}
}

//apply plugin: 'maven-publish'
//apply plugin: 'signing'

//afterEvaluate {
// publishing {
// publications {
// mavenRelease(MavenPublication) {
// from components.release
// }
// }
// }
//}

//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 : ""
//}
//
//java {
// withJavadocJar()
// withSourcesJar()
//}
//
//
//afterEvaluate {
// publishing {
// publications {
// maven(MavenPublication) {
// groupId = GROUP
// artifactId = POM_ARTIFACT_ID
// version = VERSION_NAME
// pom {
// name POM_NAME
// packaging POM_PACKAGING
// description POM_DESCRIPTION
// url POM_URL
//// properties = [
//// myProp: "value",
//// "prop.with.dots": "anotherValue"
//// ]
// licenses {
// license {
// name POM_LICENCE_NAME
// url POM_LICENCE_URL
// distribution POM_LICENCE_DIST
// }
// }
// developers {
// developer {
// id = 'zeoflow'
// name = 'ZeoFLow SRL'
// email = 'open-source@zeoflow.com'
// }
// developer {
// id = 'teodorhmx1'
// name = 'Teodor G.'
// email = 'teo@zeoflow.com'
// }
// }
// scm {
// url POM_SCM_URL
// connection POM_SCM_CONNECTION
// developerConnection POM_SCM_DEV_CONNECTION
// }
// }
// }
// }
// repositories {
// maven {
// def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
// def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// credentials {
// username NEXUS_USERNAME
// password NEXUS_PASSWORD
// }
// }
// }
// }
//}
//
//task cleanBuildPublishLocal(type: GradleBuild) {
// tasks = ['clean', 'build', 'publishToMavenLocal']
//}
//
//task cleanBuildPublish(type: GradleBuild) {
// tasks = ['clean', 'build', 'publish']
//}
//
//signing {
// sign configurations.archives
//}
//
//javadoc {
// if(JavaVersion.current().isJava9Compatible()) {
// options.addBooleanOption('html5', true)
// }
//}
Loading