app builds but not with sonarfb
This commit is contained in:
@@ -69,4 +69,4 @@ target_include_directories(${PACKAGE_NAME} PRIVATE
|
||||
${LIBEVENT_DIR}/include/event2
|
||||
)
|
||||
|
||||
target_link_libraries(${PACKAGE_NAME} fb sonarcpp)
|
||||
target_link_libraries(${PACKAGE_NAME} sonarfb sonarcpp)
|
||||
|
||||
@@ -22,17 +22,21 @@ android {
|
||||
res {
|
||||
srcDir 'res'
|
||||
}
|
||||
}
|
||||
}
|
||||
packagingOptions {
|
||||
pickFirst 'lib/armeabi-v7a/libfb.so'
|
||||
pickFirst 'lib/x86/libfb.so'
|
||||
pickFirst 'lib/x86_64/libfb.so'
|
||||
pickFirst 'lib/arm64-v8a/libfb.so'
|
||||
jniLibs.srcDirs = ['../third-party/OpenSSL/libs']
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
pickFirst 'lib/armeabi-v7a/libsonarfb.so'
|
||||
pickFirst 'lib/x86/libsonarfb.so'
|
||||
pickFirst 'lib/x86_64/libsonarfb.so'
|
||||
pickFirst 'lib/arm64-v8a/libsonarfb.so'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
||||
@@ -42,21 +46,22 @@ dependencies {
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
// ...
|
||||
// Litho
|
||||
implementation 'com.facebook.litho:litho-core:0.15.0'
|
||||
implementation 'com.facebook.litho:litho-widget:0.15.0'
|
||||
compileOnly 'com.facebook.litho:litho-annotations:0.15.0'
|
||||
// implementation 'com.facebook.litho:litho-core:0.15.0'
|
||||
// implementation 'com.facebook.litho:litho-widget:0.15.0'
|
||||
// compileOnly 'com.facebook.litho:litho-annotations:0.15.0'
|
||||
|
||||
annotationProcessor 'com.facebook.litho:litho-processor:0.15.0'
|
||||
// annotationProcessor 'com.facebook.litho:litho-processor:0.15.0'
|
||||
|
||||
// SoLoader
|
||||
implementation 'com.facebook.soloader:soloader:0.4.1'
|
||||
|
||||
// For integration with Fresco
|
||||
implementation 'com.facebook.litho:litho-fresco:0.15.0'
|
||||
// implementation 'com.facebook.litho:litho-fresco:0.15.0'
|
||||
|
||||
// For testing
|
||||
testImplementation 'com.facebook.litho:litho-testing:0.15.0'
|
||||
// testImplementation 'com.facebook.litho:litho-testing:0.15.0'
|
||||
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||
implementation project(':fbjni')
|
||||
implementation project(':android')
|
||||
}
|
||||
|
||||
@@ -4,19 +4,34 @@ package com.facebook.sonar.sample;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import com.facebook.litho.ComponentContext;
|
||||
import com.facebook.litho.LithoView;
|
||||
import java.util.List;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
// import com.facebook.litho.ComponentContext;
|
||||
// import com.facebook.litho.LithoView;
|
||||
import android.util.Log;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.d("ON CREATE SAMPLE APP", "I m in Oncreate of sample app");
|
||||
// final ComponentContext c = new ComponentContext(this);
|
||||
// setContentView(
|
||||
// LithoView.create(
|
||||
// c,
|
||||
// RootComponent.create(c).build()));
|
||||
LinearLayout linearLayout = new LinearLayout(this);
|
||||
TextView ProgrammaticallyTextView = new TextView(this);
|
||||
ProgrammaticallyTextView.setText("Hello World");
|
||||
ProgrammaticallyTextView.setTextSize(22);
|
||||
ProgrammaticallyTextView.setPadding(20, 300, 20, 100);
|
||||
|
||||
final ComponentContext c = new ComponentContext(this);
|
||||
setContentView(
|
||||
LithoView.create(
|
||||
c,
|
||||
RootComponent.create(c).build()));
|
||||
linearLayout.addView(ProgrammaticallyTextView);
|
||||
|
||||
setContentView(linearLayout, new LinearLayout.LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,105 +1,105 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
package com.facebook.sonar.sample;
|
||||
|
||||
import com.facebook.litho.Column;
|
||||
import com.facebook.litho.Component;
|
||||
import com.facebook.litho.ComponentContext;
|
||||
import com.facebook.litho.annotations.LayoutSpec;
|
||||
import com.facebook.litho.annotations.OnCreateLayout;
|
||||
import com.facebook.litho.widget.Text;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.FormBody.Builder;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import com.facebook.litho.ClickEvent;
|
||||
import android.util.Log;
|
||||
import java.io.IOException;
|
||||
import com.facebook.litho.annotations.OnEvent;
|
||||
|
||||
@LayoutSpec
|
||||
public class RootComponentSpec {
|
||||
|
||||
@OnCreateLayout
|
||||
static Component onCreateLayout(ComponentContext c) {
|
||||
return Column.create(c)
|
||||
.child(
|
||||
Text.create(c)
|
||||
.text("Tap to hit get request")
|
||||
.key("1")
|
||||
.textSizeSp(20)
|
||||
.clickHandler(RootComponent.hitGetRequest(c)))
|
||||
.child(
|
||||
Text.create(c)
|
||||
.text("Tap to hit post request")
|
||||
.key("2")
|
||||
.textSizeSp(20)
|
||||
.clickHandler(RootComponent.hitPostRequest(c)))
|
||||
.child(
|
||||
Text.create(c)
|
||||
.text("I m just a text")
|
||||
.key("3")
|
||||
.textSizeSp(20))
|
||||
.build();
|
||||
}
|
||||
|
||||
@OnEvent(ClickEvent.class)
|
||||
static void hitGetRequest(ComponentContext c) {
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.github.com/repos/facebook/yoga")
|
||||
.get()
|
||||
.build();
|
||||
SonarSampleApplication.okhttpClient.newCall(request).enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.d("Sonar", e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
if (response.isSuccessful()) {
|
||||
Log.d("Sonar", response.body().string());
|
||||
} else {
|
||||
Log.d("Sonar", "not successful");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(ClickEvent.class)
|
||||
static void hitPostRequest(ComponentContext c) {
|
||||
|
||||
RequestBody formBody = new FormBody.Builder()
|
||||
.add("app", "Sonar")
|
||||
.add("remarks", "Its awesome")
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://demo9512366.mockable.io/SonarPost")
|
||||
.post(formBody)
|
||||
.build();
|
||||
|
||||
SonarSampleApplication.okhttpClient.newCall(request).enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.d("Sonar", e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
if (response.isSuccessful()) {
|
||||
Log.d("Sonar", response.body().string());
|
||||
} else {
|
||||
Log.d("Sonar", "not successful");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// // Copyright 2004-present Facebook. All Rights Reserved.
|
||||
//
|
||||
// package com.facebook.sonar.sample;
|
||||
//
|
||||
// import com.facebook.litho.Column;
|
||||
// import com.facebook.litho.Component;
|
||||
// import com.facebook.litho.ComponentContext;
|
||||
// import com.facebook.litho.annotations.LayoutSpec;
|
||||
// import com.facebook.litho.annotations.OnCreateLayout;
|
||||
// import com.facebook.litho.widget.Text;
|
||||
// import okhttp3.Request;
|
||||
// import okhttp3.Response;
|
||||
// import okhttp3.RequestBody;
|
||||
// import okhttp3.FormBody;
|
||||
// import okhttp3.FormBody.Builder;
|
||||
// import okhttp3.OkHttpClient;
|
||||
// import okhttp3.Call;
|
||||
// import okhttp3.Callback;
|
||||
// import com.facebook.litho.ClickEvent;
|
||||
// import android.util.Log;
|
||||
// import java.io.IOException;
|
||||
// import com.facebook.litho.annotations.OnEvent;
|
||||
//
|
||||
// @LayoutSpec
|
||||
// public class RootComponentSpec {
|
||||
//
|
||||
// @OnCreateLayout
|
||||
// static Component onCreateLayout(ComponentContext c) {
|
||||
// return Column.create(c)
|
||||
// .child(
|
||||
// Text.create(c)
|
||||
// .text("Tap to hit get request")
|
||||
// .key("1")
|
||||
// .textSizeSp(20)
|
||||
// .clickHandler(RootComponent.hitGetRequest(c)))
|
||||
// .child(
|
||||
// Text.create(c)
|
||||
// .text("Tap to hit post request")
|
||||
// .key("2")
|
||||
// .textSizeSp(20)
|
||||
// .clickHandler(RootComponent.hitPostRequest(c)))
|
||||
// .child(
|
||||
// Text.create(c)
|
||||
// .text("I m just a text")
|
||||
// .key("3")
|
||||
// .textSizeSp(20))
|
||||
// .build();
|
||||
// }
|
||||
//
|
||||
// @OnEvent(ClickEvent.class)
|
||||
// static void hitGetRequest(ComponentContext c) {
|
||||
//
|
||||
// Request request = new Request.Builder()
|
||||
// .url("https://api.github.com/repos/facebook/yoga")
|
||||
// .get()
|
||||
// .build();
|
||||
// SonarSampleApplication.okhttpClient.newCall(request).enqueue(new Callback() {
|
||||
// @Override
|
||||
// public void onFailure(Call call, IOException e) {
|
||||
// e.printStackTrace();
|
||||
// Log.d("Sonar", e.getMessage());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onResponse(Call call, Response response) throws IOException {
|
||||
// if (response.isSuccessful()) {
|
||||
// Log.d("Sonar", response.body().string());
|
||||
// } else {
|
||||
// Log.d("Sonar", "not successful");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @OnEvent(ClickEvent.class)
|
||||
// static void hitPostRequest(ComponentContext c) {
|
||||
//
|
||||
// RequestBody formBody = new FormBody.Builder()
|
||||
// .add("app", "Sonar")
|
||||
// .add("remarks", "Its awesome")
|
||||
// .build();
|
||||
//
|
||||
// Request request = new Request.Builder()
|
||||
// .url("https://demo9512366.mockable.io/SonarPost")
|
||||
// .post(formBody)
|
||||
// .build();
|
||||
//
|
||||
// SonarSampleApplication.okhttpClient.newCall(request).enqueue(new Callback() {
|
||||
// @Override
|
||||
// public void onFailure(Call call, IOException e) {
|
||||
// e.printStackTrace();
|
||||
// Log.d("Sonar", e.getMessage());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onResponse(Call call, Response response) throws IOException {
|
||||
// if (response.isSuccessful()) {
|
||||
// Log.d("Sonar", response.body().string());
|
||||
// } else {
|
||||
// Log.d("Sonar", "not successful");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -7,44 +7,56 @@ import android.net.Network;
|
||||
import android.support.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.facebook.litho.sonar.LithoSonarDescriptors;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
// import com.facebook.litho.sonar.LithoSonarDescriptors;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import com.facebook.sonar.android.utils.SonarUtils;
|
||||
import com.facebook.sonar.android.AndroidSonarClient;
|
||||
import com.facebook.sonar.core.SonarClient;
|
||||
import com.facebook.sonar.plugins.inspector.DescriptorMapping;
|
||||
import com.facebook.sonar.plugins.inspector.InspectorSonarPlugin;
|
||||
import com.facebook.sonar.plugins.network.NetworkSonarPlugin;
|
||||
import com.facebook.sonar.plugins.network.SonarOkhttpInterceptor;
|
||||
import com.facebook.sonar.plugins.network.NetworkResponseFormatter;
|
||||
import okhttp3.OkHttpClient;
|
||||
// import com.facebook.sonar.android.utils.SonarUtils;
|
||||
import com.facebook.sonar.android.AndroidSonarClient;
|
||||
import com.facebook.sonar.core.SonarClient;
|
||||
// import com.facebook.sonar.plugins.inspector.DescriptorMapping;
|
||||
// import com.facebook.sonar.plugins.inspector.InspectorSonarPlugin;
|
||||
// import com.facebook.sonar.plugins.network.NetworkSonarPlugin;
|
||||
// import com.facebook.sonar.plugins.network.SonarOkhttpInterceptor;
|
||||
// import com.facebook.sonar.plugins.network.NetworkResponseFormatter;
|
||||
// import okhttp3.OkHttpClient;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class SonarSampleApplication extends Application {
|
||||
|
||||
static public OkHttpClient okhttpClient;
|
||||
//static public OkHttpClient okhttpClient;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
SoLoader.init(this, false);
|
||||
|
||||
final SonarClient client = AndroidSonarClient.getInstance(this);
|
||||
final DescriptorMapping descriptorMapping = DescriptorMapping.withDefaults();
|
||||
|
||||
NetworkSonarPlugin networkPlugin = new NetworkSonarPlugin();
|
||||
SonarOkhttpInterceptor interceptor = new SonarOkhttpInterceptor(networkPlugin);
|
||||
|
||||
okhttpClient = new OkHttpClient.Builder()
|
||||
.addNetworkInterceptor(interceptor)
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.writeTimeout(10, TimeUnit.MINUTES)
|
||||
.build();
|
||||
|
||||
LithoSonarDescriptors.add(descriptorMapping);
|
||||
client.addPlugin(new InspectorSonarPlugin(this, descriptorMapping));
|
||||
client.addPlugin(networkPlugin);
|
||||
client.start();
|
||||
try {
|
||||
SoLoader.loadLibrary("sonarfb");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// final SonarClient client = AndroidSonarClient.getInstance(this);
|
||||
// final DescriptorMapping descriptorMapping = DescriptorMapping.withDefaults();
|
||||
// client.addPlugin(new InspectorSonarPlugin(this, descriptorMapping));
|
||||
// client.start();
|
||||
// final DescriptorMapping descriptorMapping = DescriptorMapping.withDefaults();
|
||||
//
|
||||
// NetworkSonarPlugin networkPlugin = new NetworkSonarPlugin();
|
||||
// SonarOkhttpInterceptor interceptor = new SonarOkhttpInterceptor(networkPlugin);
|
||||
//
|
||||
// okhttpClient = new OkHttpClient.Builder()
|
||||
// .addNetworkInterceptor(interceptor)
|
||||
// .connectTimeout(60, TimeUnit.SECONDS)
|
||||
// .readTimeout(60, TimeUnit.SECONDS)
|
||||
// .writeTimeout(10, TimeUnit.MINUTES)
|
||||
// .build();
|
||||
//
|
||||
// //LithoSonarDescriptors.add(descriptorMapping);
|
||||
// //client.addPlugin(new InspectorSonarPlugin(this, descriptorMapping));
|
||||
// client.addPlugin(networkPlugin);
|
||||
// client.start();
|
||||
}
|
||||
}
|
||||
|
||||
7
android/third-party/Folly/CMakeLists.txt
vendored
7
android/third-party/Folly/CMakeLists.txt
vendored
@@ -125,9 +125,6 @@ file(MAKE_DIRECTORY ${build_DIR})
|
||||
add_subdirectory(${GLOG_DIR} ${libglog_build_DIR})
|
||||
add_subdirectory(${DOUBLECONVERSION_DIR} ${doubleconversion_build_DIR})
|
||||
add_subdirectory(${LIBEVENT_DIR} ${libevent_build_DIR})
|
||||
# ${LIBEVENT_DIR}
|
||||
# ${LIBEVENT_DIR}/include/
|
||||
# ${LIBEVENT_DIR}/../
|
||||
target_include_directories(${PACKAGE_NAME} PRIVATE
|
||||
${OPENSSL_DIR}/jni/openssl-android/
|
||||
${OPENSSL_DIR}/jni/openssl-android/include
|
||||
@@ -142,10 +139,6 @@ target_include_directories(${PACKAGE_NAME} PRIVATE
|
||||
set(LIBEXTRA_PATH /Users/prit91/LocalDevTesting/sonar-upstream-proper/Sonar/android/build/third-party-ndk/LibEvent/.externalNativeBuild/cmake/debug/${ANDROID_ABI}/lib)
|
||||
set(OPENSSL_LINK_DIRECTORIES ${PROJECT_SOURCE_DIR}/../OpenSSL/libs/${ANDROID_ABI}/)
|
||||
find_path(OPENSSL_LIBRARY libssl.so HINTS ${OPENSSL_LINK_DIRECTORIES})
|
||||
#find_library(CRYPTO_LIBRARY crypto HINTS ${OPENSSL_LINK_DIRECTORIES})
|
||||
#set(LIBEVENT_LINK_DIRECTORIES ${PROJECT_SOURCE_DIR}/../LibEvent/libs/${ANDROID_ABI}/)
|
||||
#find_path(LIBEVENT_LIBRARY libevent.a HINTS ${LIBEVENT_LINK_DIRECTORIES})
|
||||
#link_directories(${LINK_DIRECTORIES})
|
||||
message(STATUS "link_directories:- " ${LIBEVENT_LINK_DIRECTORIES})
|
||||
|
||||
install(TARGETS ${PACKAGE_NAME} DESTINATION ./build/)
|
||||
|
||||
2
android/third-party/OpenSSL/build.gradle
vendored
2
android/third-party/OpenSSL/build.gradle
vendored
@@ -8,7 +8,7 @@ android {
|
||||
minSdkVersion rootProject.minSdkVersion
|
||||
targetSdkVersion rootProject.targetSdkVersion
|
||||
ndk {
|
||||
abiFilters 'x86', 'arm64-v8a'
|
||||
abiFilters 'arm64-v8a', 'x86', 'armeabi-v7a'
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.6.0)
|
||||
set(PACKAGE_NAME "fb")
|
||||
set(PACKAGE_NAME "sonarfb")
|
||||
project(${PACKAGE_NAME} CXX)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
@@ -37,7 +37,9 @@ file(GLOB FBJNI_SRC
|
||||
add_library(${PACKAGE_NAME} SHARED
|
||||
${FBJNI_SRC})
|
||||
|
||||
#target_include_directories(fb PRIVATE
|
||||
# include ${libjnihack_DIR})
|
||||
target_include_directories(${PACKAGE_NAME} PRIVATE
|
||||
include ${FBJNI_HDRS})
|
||||
|
||||
target_link_libraries(${PACKAGE_NAME} log)
|
||||
#install(TARGETS ${PACKAGE_NAME} DESTINATION ./build/)
|
||||
|
||||
target_link_libraries(${PACKAGE_NAME} android log)
|
||||
|
||||
@@ -16,7 +16,7 @@ android {
|
||||
}
|
||||
}
|
||||
ndk {
|
||||
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
||||
abiFilters 'arm64-v8a', 'x86', 'armeabi-v7a'
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
|
||||
Reference in New Issue
Block a user