Skip to content

Commit

Permalink
Merge pull request #10 from btrautmann/develop
Browse files Browse the repository at this point in the history
Fix publishing issues by adding aar as an artifact.
  • Loading branch information
Brandon Trautmann authored May 6, 2018
2 parents e9214b7 + 22c94aa commit 5a204b8
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 47 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[ ![Download](https://api.bintray.com/packages/oakwoodsc/maven/RxFirestore/images/download.svg) ](https://bintray.com/oakwoodsc/maven/RxFirestore/_latestVersion)
# RxFirestore
RxFirestore is an RxJava2 wrapper for [Cloud Firestore](https://firebase.google.com/docs/firestore/), which is a new database solution by Firebase and is currently in beta. It provides a more friendly API than that of Firestore itself for those familiar with RxJava. Check out the [RxFirestore docs](https://github.com/btrautmann/RxFirestore/blob/master/RxFirestoreDocs.md) for more information on the API.

[ ![Download](https://api.bintray.com/packages/oakwoodsc/maven/RxFirestore/images/download.svg) ](https://bintray.com/oakwoodsc/maven/RxFirestore/_latestVersion)

### How to use it:

**Kotlin or Java:**
Expand Down
2 changes: 1 addition & 1 deletion RxFirestoreDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ This library provides seamless realtime update methods which work flawlessly. Yo
### On the roadmap
I have a few things I'd like to see in this library:
- Tests: I haven't focused on these because I've been developing for my own needs and the API is fairly straight forward, but no library is complete without tests.
- Kotlin support: Because Kotlin > Java
- CI: When we merge to master, publish to bintray and anywhere else we want to expose the library
1 change: 1 addition & 0 deletions bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ publishing {
MyPublication(MavenPublication) {
artifact sourcesJar
artifact javadocJar
artifact("$buildDir/outputs/aar/$aarName")
groupId publishedGroupId
artifactId artifact
version libraryVersion
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
// Two necessary plugins
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:${bintrayPluginVersion}"
classpath "com.github.dcendents:android-maven-gradle-plugin:${mavenGradlePluginVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 5 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ ext {
// Libraries
supportLibraryVersion = '27.1.1'
firebaseVersion = '16.0.0'
junitVersion = '4.12'
kotlinVersion = '1.2.41'
rxJavaVersion = '2.1.8'

// Test libraries
mockitoVersion = '2.18.3'
kotlinMockitoVersion = '1.5.0'
junitVersion = '4.12'

// Build plugins
androidPluginVersion = '3.1.2'
bintrayPluginVersion = '1.8.0'
Expand Down
4 changes: 2 additions & 2 deletions publishing-config.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
// Publishing
libraryVersion = '1.0.2'
libraryVersionName = '1.0.2'
libraryVersion = '1.0.3'
libraryVersionName = '1.0.3'
bintrayRepo = 'maven'
publishedGroupId = 'com.oakwoodsc.rxfirestore'
libraryDescription = 'An RxJava2 wrapper for Cloud Firestore'
Expand Down
17 changes: 14 additions & 3 deletions rxfirestore/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
Expand All @@ -18,6 +19,9 @@ android {
disable 'InvalidPackage'
abortOnError true
}
sourceSets {
test.java.srcDirs += 'src/test/kotlin'
}
}

ext {
Expand All @@ -29,6 +33,7 @@ ext {
libraryName = 'RxFirestore'
// This artifact name should be the same with library module name
artifact = 'rxfirestore'
aarName = 'rxfirestore-release.aar'
libraryDescription = rootProject.ext.libraryDescription
siteUrl = rootProject.ext.siteUrl
gitUrl = rootProject.ext.gitUrl
Expand All @@ -46,9 +51,15 @@ apply from: '../bintray.gradle'

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "io.reactivex.rxjava2:rxjava:${rxJavaVersion}"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "com.google.firebase:firebase-firestore:$firebaseVersion"
implementation "com.android.support:support-annotations:${supportLibraryVersion}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "com.android.support:support-annotations:$supportLibraryVersion"
// Testing
testImplementation 'junit:junit:4.12'
testImplementation "junit:junit:$junitVersion"
testImplementation "com.nhaarman:mockito-kotlin:$kotlinMockitoVersion"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
}
repositories {
mavenCentral()
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.oakwoodsc.rxfirestore

import com.google.firebase.firestore.DocumentReference
import com.google.firebase.firestore.DocumentSnapshot
import com.google.firebase.firestore.EventListener
import com.nhaarman.mockito_kotlin.argumentCaptor
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.times
import com.nhaarman.mockito_kotlin.verify
import io.reactivex.subscribers.TestSubscriber
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.mockito.MockitoAnnotations

class RxFirestoreDbTests {

private val documentSnapshotListener = argumentCaptor<EventListener<DocumentSnapshot>>()

@Before

fun setUp() {
MockitoAnnotations.initMocks(this)
}

@Test
fun sanityTest() {
assertEquals(4, (2 + 2).toLong())
}

@Test
fun testDocumentSnapshots() {
val docReference = mock<DocumentReference>()
val snapshot = mock<DocumentSnapshot>()

with(TestSubscriber.create<DocumentSnapshot>()) {
RxFirestoreDb.documentSnapshots(docReference).subscribe()

docReference.verifySnapshotListenerAdded()

}

}

private fun DocumentReference.verifySnapshotListenerAdded() {
verify(this, times(1))
.addSnapshotListener(documentSnapshotListener.capture())
}

}


7 changes: 4 additions & 3 deletions rxfirestorekt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ext {
libraryName = 'RxFirestoreKt'
// This artifact name should be the same with library module name
artifact = 'rxfirestorekt'
aarName = 'rxfirestorekt-release.aar'
libraryDescription = rootProject.ext.libraryDescription
siteUrl = rootProject.ext.siteUrl
gitUrl = rootProject.ext.gitUrl
Expand All @@ -49,12 +50,12 @@ apply from: '../bintray.gradle'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':rxfirestore')
implementation "io.reactivex.rxjava2:rxjava:${rxJavaVersion}"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "com.google.firebase:firebase-firestore:$firebaseVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "com.android.support:support-annotations:${supportLibraryVersion}"
implementation "com.android.support:support-annotations:$supportLibraryVersion"
// Testing
testImplementation 'junit:junit:4.12'
testImplementation "junit:junit:$junitVersion"
}
repositories {
mavenCentral()
Expand Down

This file was deleted.

0 comments on commit 5a204b8

Please sign in to comment.