Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: native FFI for Android and Cocoa SDK #1622

Closed
wants to merge 6 commits into from
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
6 changes: 6 additions & 0 deletions flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ android {
jvmTarget = JavaVersion.VERSION_1_8
languageVersion = "1.4"
}

externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
}

dependencies {
Expand Down
15 changes: 15 additions & 0 deletions flutter/android/src/main/cpp/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format

# Defines the Chromium style for automatic reformatting.
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Chromium

# clang-format doesn't seem to do a good job of this for longer comments.
ReflowComments: 'false'

# We have lots of these. Though we need to put them all in curly braces,
# clang-format can't do that.
AllowShortIfStatementsOnASingleLine: 'true'

# Put escaped newlines into the rightmost column.
AlignEscapedNewlinesLeft: false
32 changes: 32 additions & 0 deletions flutter/android/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# jni_native_build (Build with jni:setup. Do not delete this line.)

# The Flutter tooling requires that developers have CMake 3.10 or later
# installed. You should not increase this version, as doing so will cause
# the plugin to fail to compile for some customers of the plugin.
cmake_minimum_required(VERSION 3.10)

project(sentry_android_binding VERSION 0.0.1 LANGUAGES C)

add_library(sentry_android_binding SHARED
"./sentry_android_binding.c"
)

set_target_properties(sentry_android_binding PROPERTIES
OUTPUT_NAME "sentry_android_binding"
)

target_compile_definitions(sentry_android_binding PUBLIC DART_SHARED_LIB)

if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES
LINK_FLAGS "/DELAYLOAD:jvm.dll")
endif()

if (ANDROID)
target_link_libraries(sentry_android_binding log)
else()
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
include_directories(${JNI_INCLUDE_DIRS})
target_link_libraries(sentry_android_binding ${JNI_LIBRARIES})
endif()
Loading