diff --git a/.metadata b/.metadata index c547ef0..0b77714 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,42 @@ # This file should be version controlled and should not be manually edited. version: - revision: 67826bdce54505760fe83b7ead70bdb5af6fe9f2 - channel: dev + revision: "2828ddd9a707d09af00b793a42faaa0f0e2b957f" + channel: "master" project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + - platform: android + create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + - platform: ios + create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + - platform: linux + create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + - platform: aurora + create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + - platform: macos + create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + - platform: windows + create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/aurora/CMakeLists.txt b/aurora/CMakeLists.txt new file mode 100644 index 0000000..5134de3 --- /dev/null +++ b/aurora/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.10) + +set(PROJECT_NAME argon2_ffi) +set(PLUGIN_NAME ${PROJECT_NAME}_platform_plugin) + +project(${PROJECT_NAME} LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) + +add_library(${PLUGIN_NAME} SHARED + argon2_ffi_plugin.cpp + + ../ios/Classes/argon2_ffi.c + + ../ios/Classes/argon2src/argon2.c + ../ios/Classes/argon2src/core.c + ../ios/Classes/argon2src/encoding.c + ../ios/Classes/argon2src/genkat.c + ../ios/Classes/argon2src/ref.c + ../ios/Classes/argon2src/thread.c + ../ios/Classes/argon2src/blake2/blake2b.c +) + +set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) +target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) + +target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) diff --git a/aurora/argon2_ffi_plugin.cpp b/aurora/argon2_ffi_plugin.cpp new file mode 100644 index 0000000..1ede058 --- /dev/null +++ b/aurora/argon2_ffi_plugin.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +void Argon2FfiPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) +{ + registrar.RegisterMethodChannel("argon2_ffi", + MethodCodecType::Standard, + [this](const MethodCall &call) { this->onMethodCall(call); }); +} + +void Argon2FfiPlugin::onMethodCall(const MethodCall &call) +{ + call.SendSuccessResponse(nullptr); +} diff --git a/aurora/include/argon2_ffi/argon2_ffi_plugin.h b/aurora/include/argon2_ffi/argon2_ffi_plugin.h new file mode 100644 index 0000000..e93132d --- /dev/null +++ b/aurora/include/argon2_ffi/argon2_ffi_plugin.h @@ -0,0 +1,16 @@ +#ifndef FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_H +#define FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_H + +#include +#include + +class PLUGIN_EXPORT Argon2FfiPlugin final : public PluginInterface +{ +public: + void RegisterWithRegistrar(PluginRegistrar ®istrar) override; + +private: + void onMethodCall(const MethodCall &call); +}; + +#endif /* FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_H */ diff --git a/aurora/include/argon2_ffi/globals.h b/aurora/include/argon2_ffi/globals.h new file mode 100644 index 0000000..66ef319 --- /dev/null +++ b/aurora/include/argon2_ffi/globals.h @@ -0,0 +1,10 @@ +#ifndef FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_GLOBALS_H +#define FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_GLOBALS_H + +#ifdef PLUGIN_IMPL +#define PLUGIN_EXPORT __attribute__((visibility("default"))) +#else +#define PLUGIN_EXPORT +#endif + +#endif /* FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_GLOBALS_H */ diff --git a/example/aurora/.gitignore b/example/aurora/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/example/aurora/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/example/aurora/CMakeLists.txt b/example/aurora/CMakeLists.txt new file mode 100644 index 0000000..e108a9f --- /dev/null +++ b/example/aurora/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.10) +project(com.example.argon2_ffi_example LANGUAGES CXX) + +include(GNUInstallDirs) + +set(BINARY_NAME ${CMAKE_PROJECT_NAME}) +set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + +set(CMAKE_SKIP_RPATH OFF) +set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) + +add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder) +target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR}) + +include(flutter/generated_plugins.cmake) + +set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) +set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications) +set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor) + +add_custom_command(TARGET ${BINARY_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so + ${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so) + +install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR}) +install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR}) +install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR}) + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR}) + +foreach(ICONS_SIZE 86x86 108x108 128x128 172x172) + install(FILES icons/${ICONS_SIZE}.png + RENAME ${BINARY_NAME}.png + DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/) +endforeach(ICONS_SIZE) diff --git a/example/aurora/desktop/com.example.argon2_ffi_example.desktop b/example/aurora/desktop/com.example.argon2_ffi_example.desktop new file mode 100644 index 0000000..32b4948 --- /dev/null +++ b/example/aurora/desktop/com.example.argon2_ffi_example.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=argon2_ffi_example +Comment=Demonstrates how to use the argon2_ffi plugin. +Icon=com.example.argon2_ffi_example +Exec=/usr/bin/com.example.argon2_ffi_example +X-Nemo-Application-Type=silica-qt5 + +[X-Application] +Permissions= +OrganizationName=com.example +ApplicationName=argon2_ffi_example diff --git a/example/aurora/flutter/generated_plugin_registrant.cpp b/example/aurora/flutter/generated_plugin_registrant.cpp new file mode 100644 index 0000000..b315972 --- /dev/null +++ b/example/aurora/flutter/generated_plugin_registrant.cpp @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include + +#include "generated_plugin_registrant.h" + +void RegisterPlugins() { + Application::RegisterPlugins({ + }); +} diff --git a/example/aurora/flutter/generated_plugin_registrant.h b/example/aurora/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..648dcb3 --- /dev/null +++ b/example/aurora/flutter/generated_plugin_registrant.h @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT +#define GENERATED_PLUGIN_REGISTRANT + +void RegisterPlugins(); + +#endif /* GENERATED_PLUGIN_REGISTRANT */ diff --git a/example/aurora/flutter/generated_plugins.cmake b/example/aurora/flutter/generated_plugins.cmake new file mode 100644 index 0000000..008ff29 --- /dev/null +++ b/example/aurora/flutter/generated_plugins.cmake @@ -0,0 +1,32 @@ +# +# Generated file, do not edit. +# +set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}") + +function(add_library TARGET) + _add_library(${TARGET} ${ARGN}) + + if ( + FALSE + ) + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "$" + "${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$") + endif() +endfunction() + +list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN}) + target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin) +endforeach(PLUGIN) + +foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN}) +endforeach(FFI_PLUGIN) diff --git a/example/aurora/icons/108x108.png b/example/aurora/icons/108x108.png new file mode 100644 index 0000000..984893d Binary files /dev/null and b/example/aurora/icons/108x108.png differ diff --git a/example/aurora/icons/128x128.png b/example/aurora/icons/128x128.png new file mode 100644 index 0000000..2d552ef Binary files /dev/null and b/example/aurora/icons/128x128.png differ diff --git a/example/aurora/icons/172x172.png b/example/aurora/icons/172x172.png new file mode 100644 index 0000000..9dc271b Binary files /dev/null and b/example/aurora/icons/172x172.png differ diff --git a/example/aurora/icons/86x86.png b/example/aurora/icons/86x86.png new file mode 100644 index 0000000..5923bb1 Binary files /dev/null and b/example/aurora/icons/86x86.png differ diff --git a/example/aurora/main.cpp b/example/aurora/main.cpp new file mode 100644 index 0000000..331e26e --- /dev/null +++ b/example/aurora/main.cpp @@ -0,0 +1,9 @@ +#include +#include "generated_plugin_registrant.h" + +int main(int argc, char *argv[]) { + Application::Initialize(argc, argv); + RegisterPlugins(); + Application::Launch(); + return 0; +} diff --git a/example/aurora/rpm/com.example.argon2_ffi_example.spec b/example/aurora/rpm/com.example.argon2_ffi_example.spec new file mode 100644 index 0000000..50306ef --- /dev/null +++ b/example/aurora/rpm/com.example.argon2_ffi_example.spec @@ -0,0 +1,31 @@ +%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ +%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|.+_platform_plugin)\\.so.*$ + +Name: com.example.argon2_ffi_example +Summary: Demonstrates how to use the argon2_ffi plugin. +Version: 0.1.0 +Release: 1 +License: Proprietary +Source0: %{name}-%{version}.tar.zst + +BuildRequires: cmake +BuildRequires: pkgconfig(flutter-embedder) + +%description +%{summary}. + +%prep +%autosetup + +%build +%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type} +%make_build + +%install +%make_install + +%files +%{_bindir}/%{name} +%{_datadir}/%{name}/* +%{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/*/apps/%{name}.png diff --git a/example/pubspec.lock b/example/pubspec.lock index 572096a..5da32b7 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: path: ".." relative: true source: path - version: "1.0.0" + version: "1.0.0+1" argon2_ffi_base: dependency: "direct main" description: @@ -68,10 +68,10 @@ packages: dependency: transitive description: name: ffi - sha256: d97fffd9d86f3dccc7a9059128b468a99320c69007cc9d41a3a1bda07d4e86dc + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.1.0" flutter: dependency: "direct main" description: flutter @@ -86,10 +86,10 @@ packages: dependency: transitive description: name: logging - sha256: "3730d4c02b0c2d1db80ef9904e27fa796d75474f572a70011e0e616ee6bfc0ff" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.2.0" matcher: dependency: transitive description: diff --git a/pubspec.lock b/pubspec.lock index 7e570c3..d437245 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: ffi - sha256: d97fffd9d86f3dccc7a9059128b468a99320c69007cc9d41a3a1bda07d4e86dc + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.1.0" flutter: dependency: "direct main" description: flutter @@ -79,10 +79,10 @@ packages: dependency: transitive description: name: logging - sha256: "3730d4c02b0c2d1db80ef9904e27fa796d75474f572a70011e0e616ee6bfc0ff" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.2.0" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 362a8ea..02e0a19 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,6 +37,8 @@ flutter: android: package: com.example.argon2_ffi pluginClass: Argon2FfiPlugin + aurora: + pluginClass: Argon2FfiPlugin ios: pluginClass: Argon2FfiPlugin macos: