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,38 @@
// 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.
apply plugin: 'com.android.library'
apply plugin: 'maven'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
}
sourceSets {
test {
java {
exclude 'com/facebook/flipper/plugins/facebook/**'
}
}
}
dependencies {
implementation deps.jsr305
}
}
apply from: rootProject.file('gradle/release.gradle')
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts.add('archives', sourcesJar)

View File

@@ -0,0 +1,21 @@
#
# Copyright 2014-present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
POM_NAME=Flipper NoOp
POM_DESCRIPTION=No-Open Implementation of the Flipper SDK for Android
POM_ARTIFACT_ID=flipper-noop
POM_PACKAGING=aar

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 {}

View File

@@ -18,6 +18,7 @@ include ':glog'
include ':libevent'
include ':rsocket'
include ':third-party'
include ':noop'
project(':fbjni').projectDir = file('libs/fbjni')
project(':easywsclient').projectDir = file('libs/easywsclient')
@@ -30,3 +31,4 @@ project(':folly').projectDir = file('android/third-party/external/folly/')
project(':libevent').projectDir = file('android/third-party/external/LibEvent/')
project(':rsocket').projectDir = file('android/third-party/external/RSocket/')
project(':third-party').projectDir = file('android/third-party/')
project(':noop').projectDir = file('android/no-op/')