Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ bin/
# Scala build
*.cache
/.nb-gradle/private/

# Android build local properties
local.properties
24 changes: 18 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
language: java
jdk:
- oraclejdk7
sudo: false
# as per http://blog.travis-ci.com/2014-12-17-faster-builds-with-container-based-infrastructure/
sudo: false

language: android

# script for build and release via Travis to Bintray
script: gradle/buildViaTravis.sh
android:
components:
- build-tools-23.0.1
- android-23
- extra-android-m2repository
- sys-img-armeabi-v7a-android-18

jdk:
- oraclejdk7

script: gradle/build.sh

# cache between builds
cache:
directories:
- $HOME/.m2
- $HOME/.gradle

env:
matrix:
- TARGET_PLATFORM=jdk
- TARGET_PLATFORM="android-18 --abi armeabi-v7a"
global:
- secure: YcLpYfNc/dyDON+oDvnJK5pFNhpPeJHxlAHV8JBt42e51prAl6njqrg1Qlfdp0pvBiskTPQHUxbFy9DOB1Z+43lPj5vlqz6qBgtS3vtBnsrczr+5Xx7NTdVKq6oZGl45VjfNPT7zdM6GQ5ifdzOid6kJIFu34g9JZkCzOY3BWGM=
- secure: WVmfSeW1UMNdem7+X4cVDjkEkqdeNavYH4udn3bFN1IFaWdliWFp4FYVBVi+p1T/IgkRSqzoW9Bm43DABe1UMFoErFCbfd7B0Ofgb4NZAsxFgokHGVLCe6k5+rQyASseiO7k0itSj3Kq9TrDueKPhv+g+IG0w1A8yZTnXdhXHvY=
Expand Down
61 changes: 61 additions & 0 deletions android-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
buildscript {
repositories {
jcenter()
}

dependencies {
// Android Gradle plugin
classpath 'com.android.tools.build:gradle:1.3.1'

// Resolves android-sdk dependencies
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed. .travis.yml takes care of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for developers, I guess @akarnokd used it without noticing :)

On Fri, Nov 13, 2015, 07:47 Jake Wharton [email protected] wrote:

In android-tests/build.gradle
#3519 (comment):

@@ -0,0 +1,61 @@
+buildscript {

  • repositories {
  •    jcenter()
    
  • }
  • dependencies {
  •    // Android Gradle plugin
    
  •    classpath 'com.android.tools.build:gradle:1.3.1'
    
  •    // Resolves android-sdk dependencies
    
  •    classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
    

Not needed. .travis.yml takes care of this.


Reply to this email directly or view it on GitHub
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749555.

@artem_zin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm amazed it even still works.

On Thu, Nov 12, 2015 at 11:51 PM Artem Zinnatullin [email protected]
wrote:

In android-tests/build.gradle
#3519 (comment):

@@ -0,0 +1,61 @@
+buildscript {

  • repositories {
  •    jcenter()
    
  • }
  • dependencies {
  •    // Android Gradle plugin
    
  •    classpath 'com.android.tools.build:gradle:1.3.1'
    
  •    // Resolves android-sdk dependencies
    
  •    classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
    

It's for developers, I guess @akarnokd https://github.com/akarnokd used
it without noticing :)
On Fri, Nov 13, 2015, 07:47 Jake Wharton [email protected]
wrote: In android-tests/build.gradle <#3519 (comment)
https://github.com/ReactiveX/RxJava/pull/3519#discussion_r44749555>: >
@@ -0,0 +1,61 @@ > +buildscript { > + repositories { > + jcenter() > + } >

    • dependencies { > + // Android Gradle plugin > + classpath
      'com.android.tools.build:gradle:1.3.1' > + > + // Resolves android-sdk
      dependencies > + classpath
      'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' Not needed. .travis.yml
      takes care of this. — Reply to this email directly or view it on GitHub <
      https://github.com/ReactiveX/RxJava/pull/3519/files#r44749555>.
      -- @artem_zin


Reply to this email directly or view it on GitHub
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749702.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, would be nice to see new releases! Sometimes it can not handle
support libraries updates. But anyway, great tool.

On Fri, Nov 13, 2015, 07:52 Jake Wharton [email protected] wrote:

In android-tests/build.gradle
#3519 (comment):

@@ -0,0 +1,61 @@
+buildscript {

  • repositories {
  •    jcenter()
    
  • }
  • dependencies {
  •    // Android Gradle plugin
    
  •    classpath 'com.android.tools.build:gradle:1.3.1'
    
  •    // Resolves android-sdk dependencies
    
  •    classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
    

I'm amazed it even still works.
… <#msg-f:1517698800156585010_>
On Thu, Nov 12, 2015 at 11:51 PM Artem Zinnatullin <
[email protected]> wrote: In android-tests/build.gradle <#3519
(comment)
https://github.com/ReactiveX/RxJava/pull/3519#discussion_r44749702>: >
@@ -0,0 +1,61 @@ > +buildscript { > + repositories { > + jcenter() > + } >


Reply to this email directly or view it on GitHub
https://github.com/ReactiveX/RxJava/pull/3519/files#r44749727.

@artem_zin


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion '23.0.1'

defaultConfig {
minSdkVersion 14
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

sourceSets {
androidTest {
java.srcDir '../src/test/java'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

dependencies {
compile libraries.rxJava

androidTestCompile libraries.mockitoCore
androidTestCompile libraries.dexMaker
androidTestCompile libraries.dexMakerDx
androidTestCompile libraries.dexMakerMockito
androidTestCompile libraries.androidSupportTestRunner
}

afterEvaluate {
tasks.withType(com.android.build.gradle.internal.tasks.AndroidTestTask) { task ->
task.doFirst {
logging.level = LogLevel.INFO
}
task.doLast {
logging.level = LogLevel.LIFECYCLE
}
}
}
4 changes: 4 additions & 0 deletions android-tests/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.reactivex.rxjava.android_tests">

</manifest>
41 changes: 16 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
buildscript {
repositories { jcenter() }
dependencies { classpath 'com.netflix.nebula:gradle-rxjava-project-plugin:2.2.3' }
repositories { jcenter() }
dependencies { classpath 'com.netflix.nebula:gradle-rxjava-project-plugin:2.2.3' }
}

description = 'RxJava: Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.'
allprojects {
repositories {
jcenter()
}

apply plugin: 'rxjava-project'
apply plugin: 'java'

dependencies {
testCompile 'junit:junit-dep:4.10'
testCompile 'org.mockito:mockito-core:1.8.5'
}

javadoc {
exclude "**/rx/internal/**"
apply plugin: 'rxjava-project'
}

// support for snapshot/final releases with the various branches RxJava uses
nebulaRelease {
addReleaseBranchPattern(/\d+\.\d+\.\d+/)
addReleaseBranchPattern('HEAD')
}
ext.libraries = [
rxJava : project(':rxjava'),

if (project.hasProperty('release.useLastTag')) {
tasks.prepare.enabled = false
}

test{
maxHeapSize = "2g"
}
junit : 'junit:junit-dep:4.10',
mockitoCore : 'org.mockito:mockito-core:1.10.19',
dexMaker : 'com.crittercism.dexmaker:dexmaker:1.4',
dexMakerDx : 'com.crittercism.dexmaker:dexmaker-dx:1.4',
dexMakerMockito : 'com.crittercism.dexmaker:dexmaker-mockito:1.4',
androidSupportTestRunner: 'com.android.support.test:runner:0.4'
]
9 changes: 9 additions & 0 deletions gradle/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ "$TARGET_PLATFORM" == "jdk" ]; then
sh "${SCRIPTS_DIR}/buildViaTravis.sh"
elif [[ "$TARGET_PLATFORM" == android-* ]]; then
sh "${SCRIPTS_DIR}/runTestsOnAndroid.sh"
fi
8 changes: 4 additions & 4 deletions gradle/buildViaTravis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
./gradlew -Prelease.useLastTag=true build
./gradlew -Prelease.useLastTag=true :rxjava:build
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build snapshot --stacktrace
./gradlew -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" :rxjava:build :rxjava:snapshot --stacktrace
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" final --stacktrace
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" :rxjava:final --stacktrace
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew -Prelease.useLastTag=true build
./gradlew -Prelease.useLastTag=true :rxjava:build
fi
6 changes: 6 additions & 0 deletions gradle/runTestsOnAndroid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
echo no | eval "android create avd --force -n test -t $TARGET_PLATFORM"
emulator -avd test -no-skin -no-audio -no-window &
android-wait-for-emulator
adb shell input keyevent 82
./gradlew connectedAndroidTest
43 changes: 43 additions & 0 deletions rxjava/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
description = 'RxJava: Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.'

apply plugin: 'java'

sourceCompatibility = 1.7
targetCompatibility = 1.7

sourceSets {
main {
java {
srcDir '../src/main/java'
}
}

test {
java {
srcDir '../src/test/java'
}
}
}

dependencies {
testCompile libraries.junit
testCompile libraries.mockitoCore
}

javadoc {
exclude '**/rx/internal/**'
}

// support for snapshot/final releases with the various branches RxJava uses
nebulaRelease {
addReleaseBranchPattern(/\d+\.\d+\.\d+/)
addReleaseBranchPattern('HEAD')
}

if (project.hasProperty('release.useLastTag')) {
tasks.prepare.enabled = false
}

test {
maxHeapSize = '2g'
}
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rootProject.name='rxjava'
include ':rxjava'
include ':android-tests'
6 changes: 3 additions & 3 deletions src/test/java/rx/BackpressureTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ public void testOnBackpressureDrop() {
}
}

@Test(timeout = 10000)
@Test(timeout = 30000)
public void testOnBackpressureDropWithAction() {
for (int i = 0; i < 100; i++) {
final AtomicInteger emitCount = new AtomicInteger();
Expand Down Expand Up @@ -508,7 +508,7 @@ public void call(Integer integer) {
}
}

@Test(timeout = 10000)
@Test(timeout = 30000)
public void testOnBackpressureDropSynchronous() {
for (int i = 0; i < 100; i++) {
int NUM = (int) (RxRingBuffer.SIZE * 1.1); // > 1 so that take doesn't prevent buffer overflow
Expand All @@ -530,7 +530,7 @@ public void testOnBackpressureDropSynchronous() {
}
}

@Test(timeout = 10000)
@Test(timeout = 30000)
public void testOnBackpressureDropSynchronousWithAction() {
for (int i = 0; i < 100; i++) {
final AtomicInteger dropCount = new AtomicInteger();
Expand Down
48 changes: 39 additions & 9 deletions src/test/java/rx/ObservableTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
Expand All @@ -55,6 +58,7 @@
import rx.functions.Func2;
import rx.observables.ConnectableObservable;
import rx.observers.TestSubscriber;
import rx.schedulers.Schedulers;
import rx.schedulers.TestScheduler;
import rx.subjects.ReplaySubject;
import rx.subjects.Subject;
Expand Down Expand Up @@ -1101,19 +1105,45 @@ public String call(Integer t1) {
}

@Test
public void testErrorThrownIssue1685() {
public void testErrorThrownIssue1685() throws ExecutionException, InterruptedException {
Subject<Object, Object> subject = ReplaySubject.create();

Observable.error(new RuntimeException("oops"))
.materialize()
.delay(1, TimeUnit.SECONDS)
.dematerialize()
.subscribe(subject);
ExecutorService exec = Executors.newSingleThreadExecutor();

subject.subscribe();
subject.materialize().toBlocking().first();
try {

final AtomicReference<Throwable> err = new AtomicReference<Throwable>();

Scheduler s = Schedulers.from(exec);
exec.submit(new Runnable() {
@Override
public void run() {
Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
err.set(e);
}
});
}
}).get();

System.out.println("Done");
Observable.error(new RuntimeException("oops"))
.materialize()
.delay(1, TimeUnit.SECONDS, s)
.dematerialize()
.subscribe(subject);

subject.subscribe();
subject.materialize().toBlocking().first();

Thread.sleep(1000); // the uncaught exception comes after the terminal event reaches toBlocking
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails for some reason. Maybe the underlying thread dies off?
Could you change the code above to use a ThreadFactory with newSingleThreadExecutor and set the uncaught exception handler within the factory?


assertNotNull("UncaughtExceptionHandler didn't get anything.", err.get());

System.out.println("Done");
} finally {
exec.shutdownNow();
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ public void testWithCombineLatestIssue1717() throws InterruptedException {
final AtomicInteger count = new AtomicInteger();
final int SIZE = 2000;
Observable<Long> timer = Observable.interval(0, 1, TimeUnit.MILLISECONDS)
.onBackpressureBuffer()
.observeOn(Schedulers.newThread())
.doOnEach(new Action1<Notification<? super Long>>() {

Expand Down
Loading