Remove dependency on launcher from instrumentation tests
Reviewed By: bestander Differential Revision: D3736847 fbshipit-source-id: d39a227fe8753f3766521fd23440933adba9e8c7
This commit is contained in:
parent
af14a5b489
commit
37ab1c8844
|
@ -287,6 +287,7 @@ dependencies {
|
||||||
testCompile "org.easytesting:fest-assert-core:${FEST_ASSERT_CORE_VERSION}"
|
testCompile "org.easytesting:fest-assert-core:${FEST_ASSERT_CORE_VERSION}"
|
||||||
testCompile "org.robolectric:robolectric:${ROBOLECTRIC_VERSION}"
|
testCompile "org.robolectric:robolectric:${ROBOLECTRIC_VERSION}"
|
||||||
|
|
||||||
|
androidTestCompile fileTree(dir: 'src/main/third-party/java/buck-android-support/', include: ['*.jar'])
|
||||||
androidTestCompile 'com.android.support.test:runner:0.3'
|
androidTestCompile 'com.android.support.test:runner:0.3'
|
||||||
androidTestCompile "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
|
androidTestCompile "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ android_library(
|
||||||
deps = [
|
deps = [
|
||||||
react_native_dep('libraries/soloader/java/com/facebook/soloader:soloader'),
|
react_native_dep('libraries/soloader/java/com/facebook/soloader:soloader'),
|
||||||
react_native_dep('third-party/android/support/v4:lib-support-v4'),
|
react_native_dep('third-party/android/support/v4:lib-support-v4'),
|
||||||
|
react_native_dep('third-party/java/buck-android-support:buck-android-support'),
|
||||||
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
|
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
|
||||||
react_native_dep('third-party/java/jsr-305:jsr-305'),
|
react_native_dep('third-party/java/jsr-305:jsr-305'),
|
||||||
react_native_dep('third-party/java/junit:junit'),
|
react_native_dep('third-party/java/junit:junit'),
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2014-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.react.testing;
|
||||||
|
|
||||||
|
import com.facebook.buck.android.support.exopackage.ApplicationLike;
|
||||||
|
import com.facebook.buck.android.support.exopackage.ExopackageApplication;
|
||||||
|
import com.facebook.react.common.build.ReactBuildConfig;
|
||||||
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application class for the Catalyst Launcher to allow it to work as an exopackage.
|
||||||
|
*
|
||||||
|
* Any app-specific code that should run before secondary dex files are loaded
|
||||||
|
* (like setting up crash reporting) should go in onBaseContextAttached.
|
||||||
|
* Anything that should run after secondary dex should go in CatalystApplicationImpl.onCreate.
|
||||||
|
*/
|
||||||
|
public class ReactTestAppShell extends ExopackageApplication<ApplicationLike> {
|
||||||
|
|
||||||
|
public ReactTestAppShell() {
|
||||||
|
super("com.facebook.react.testing.ReactTestApplicationImpl", ReactBuildConfig.EXOPACKAGE_FLAGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBaseContextAttached() {
|
||||||
|
// This is a terrible hack. Don't copy it.
|
||||||
|
// It's unfortunate that Instagram does the same thing.
|
||||||
|
// We need to do this here because internal apps use SoLoader,
|
||||||
|
// and Open Source Buck uses ExopackageSoLoader.
|
||||||
|
// If you feel the need to copy this, we should refactor it
|
||||||
|
// into an FB-specific subclass of ExopackageApplication.
|
||||||
|
SoLoader.init(this, (ReactBuildConfig.EXOPACKAGE_FLAGS & 2) != 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2014-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.react.testing;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import com.facebook.buck.android.support.exopackage.DefaultApplicationLike;
|
||||||
|
|
||||||
|
public class ReactTestApplicationImpl extends DefaultApplicationLike {
|
||||||
|
|
||||||
|
public ReactTestApplicationImpl() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReactTestApplicationImpl(Application application) {
|
||||||
|
super(application);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
include_defs('//ReactAndroid/DEFS')
|
||||||
|
|
||||||
|
# this lib was compiled by buck version : 6cbf2709778ea352a169d1c84e3ef2894dfa39ec
|
||||||
|
prebuilt_jar(
|
||||||
|
name = 'buck-android-support',
|
||||||
|
binary_jar = 'buck-android-support.jar',
|
||||||
|
visibility = [
|
||||||
|
react_native_integration_tests_target('...'),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
project_config(
|
||||||
|
src_target = ':buck-android-support',
|
||||||
|
)
|
BIN
ReactAndroid/src/main/third-party/java/buck-android-support/buck-android-support.jar
vendored
Normal file
BIN
ReactAndroid/src/main/third-party/java/buck-android-support/buck-android-support.jar
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue