Set up no-op package (#425)

Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/425

Incomplete implementation that should allow for most uses
as a release-only package.

Next steps:
- Integrate sample app with this.
- Set up CI to build sample app in release mode with this.
- Register with JCenter.
- Automatically publish to JCenter as part of our release step.

Reviewed By: jknoxville

Differential Revision: D15146823

fbshipit-source-id: 3ad058dce7b0395721c6e6715d44d4d51b1834da
This commit is contained in:
Pascal Hartig
2019-04-30 13:08:52 -07:00
committed by Facebook Github Bot
parent 3771026eeb
commit db5d486c6f
8 changed files with 175 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.flipper">
</manifest>

View File

@@ -0,0 +1,20 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*/
package com.facebook.flipper.android;
import android.content.Context;
import com.facebook.flipper.core.FlipperClient;
public final class AndroidFlipperClient {
public static FlipperClient getInstance(Context context) {
return new NoOpAndroidFlipperClient();
}
public static FlipperClient getInstanceIfInitialized() {
return new NoOpAndroidFlipperClient();
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
package com.facebook.flipper.android;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.core.FlipperPlugin;
import javax.annotation.Nullable;
public class NoOpAndroidFlipperClient implements FlipperClient {
@Override
public void addPlugin(FlipperPlugin plugin) {
// no-op
}
@Nullable
@Override
public <T extends FlipperPlugin> T getPlugin(String id) {
return null;
}
@Nullable
@Override
public <T extends FlipperPlugin> T getPluginByClass(Class<T> cls) {
return null;
}
@Override
public void removePlugin(FlipperPlugin plugin) {
// no-op
}
@Override
public void start() {
// no-op
}
@Override
public void stop() {
// no-op
}
@Override
public void unsubscribe() {
// no-op
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
package com.facebook.flipper.core;
import javax.annotation.Nullable;
public interface FlipperClient {
void addPlugin(FlipperPlugin plugin);
@Nullable
<T extends FlipperPlugin> T getPlugin(String id);
@Nullable
<T extends FlipperPlugin> T getPluginByClass(Class<T> cls);
void removePlugin(FlipperPlugin plugin);
void start();
void stop();
void unsubscribe();
}

View File

@@ -0,0 +1,10 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
package com.facebook.flipper.core;
public interface FlipperPlugin {}