diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85e7c1d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..5647788 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,5 @@ +# Authors + +* Vitaliy Zarubin, + * Product owner, 2023 + * Maintainer, 2023 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f98331d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,83 @@ +# Code of Conduct + +## What is this code of conduct for? + +Code of conduct is a current set of rules of the Open Mobile Platform +which informs you how we expect +the members of the Open Mobile Platform community +will interact while contributing and communicating. +We are committed to providing a friendly, safe and welcoming +environment for all, regardless of gender, gender identity and expression, +sexual orientation, ability, physical appearance, body size, race, age, +socioeconomic status, religion (or lack thereof), +or other marginalized aspect of community members. +We expect all members of the Open Mobile Platform community +to abide by this Code of Conduct whenever interacting +in Open Mobile Platform venues +(merge requests, pull requests, issues, 1-1 or group chat, meetups, conferences, etc.) + +## Examples of appropriate behavior + +* Using welcoming and inclusive language. +* Being respectful of differing viewpoints and experiences. +* Gracefully accepting constructive criticism. +* Focusing on what is best for the community. +* Showing empathy towards other community members. + +## Examples of inappropriate behavior + +Because we come from a variety of backgrounds, +we do not want to assume that everyone has the same assumptions +about what is and is not appropriate. +Here are some examples of inappropriate behavior +that are incompatible with our community's ethos: + +* spamming, trolling, intentionally disrupting conversations, + or irrelevant solicitation or advertisement; +* making demeaning or discriminatory comments; +* making negative assumptions about someone's background, + abilities, or intentions; +* harassing or stalking individuals (online or in person). + +In general: treat others how you would like to be treated, +were you in their place. +Do ask questions. +Do keep conflicts productively focused on technical issues. +Do remember that we are all people, not robots, +and all equally deserving of sensitivity and respect. + +## What will organizers do about inappropriate behavior? + +If we notice you doing or saying something inappropriate, +an organizer will ask you to stop. +We will not demonize you. +But please do stop the inappropriate behavior +so we can get back to writing and discussing code in a safe environment. +If you have philosophical disagreements about what is actually inappropriate, +please take them to a separate public or private conversation +with an Open Mobile Platform maintainer +so we don't turn pull requests into an ethics debate. +If you keep doing unacceptable things, +we will likely ban you, report you to the administration, +or take other appropriate action. + +## What if I see or am subject to what feels like inappropriate behavior? + +Let us know. +Please notify a community organizer as soon as possible. +Full contact information is listed in the Contact Info section of this document. +All communications will be kept strictly confidential, +unless otherwise required by law. +No issue will be considered too inconsequential or unimportant for us +to have a conversation about. + +## Contact Info + +If you need to report an incident, +please contact . + +This work is licensed under a Creative Commons Attribution 3.0 Unported License +For attribution requirements: +«Open Mobile Platform Code of Conduct» +Copyright (c) 2021 Open Mobile Platform LLC, +used under a [Creative Commons Attribution Unported license](http://creativecommons.org/licenses/by/3.0/). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5fc75b6 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,169 @@ +# Contributor License Agreements + +Thank you for your interest in contributing +to software projects managed by Open Mobile Platform («We» or «Us»). +This contributor agreement («Agreement») +documents the rights granted by contributors to Us. +To make this document effective, +please sign it and send it to Us by email or electronic submission. +This is a legally binding document, +so please read it carefully before agreeing to it. +The Agreement may cover more than one software project managed by Us. + +## 1. Definitions + +**«We» or «Us»** means Open Mobile Platform Limited Liability Company +(Open Mobile Platform LLC), +420500, Republic of Tatarstan, Verkhneuslonsky District, +Innopolis, Universitetskaya Street, h. 7, office 59, +OGRN (Primary State Registration Number) 1161690087020. + +**«You»** means the individual who Submits a Contribution to Us. + +**«Contribution»** means any work of authorship +that is Submitted by You to Us +in which You own or assert ownership of the Copyright. + +**«Copyright»** means all rights protecting works of authorship +owned or controlled by You, +including copyright, moral and neighboring rights, as appropriate, +for the full term of their existence including any extensions by You. + +**«Material»** means the work of authorship +which is made available by Us to third parties. +When this Agreement covers more than one software project, +the Material means the work of authorship +to which the Contribution was Submitted. +After You Submit the Contribution, +it may be included in the Material. + +**«Submit»** means any form of electronic, verbal, or written communication +sent to Us or our representatives, +including but not limited to electronic mailing lists, +source code control systems, and issue tracking systems +that are managed by, or on behalf of, Us +for the purpose of discussing and improving the Material, +but excluding communication that is conspicuously marked +or otherwise designated in writing by You as «Not a Contribution». + +**«Submission Date»** means the date +on which You Submit a Contribution to Us. + +**«Effective Date»** means the date You execute this Agreement +or the date You first Submit a Contribution to Us, +whichever is earlier. + +**«Media»** means any portion of a Contribution which is not software. + +## 2. Grant of Rights + +### 2.1. Copyright License + +(a) You retain ownership of the Copyright in Your Contribution +and have the same rights to use or license the Contribution +which You would have had without entering into the Agreement. + +(b) To the maximum extent permitted by the relevant law, +You grant to Us a perpetual, worldwide, non-exclusive, +transferable, royalty-free, irrevocable license +under the Copyright covering the Contribution, +with the right to sublicense +such rights through multiple tiers of sublicensees, +to reproduce, modify, display, perform and distribute +the Contribution as part of the Material; +provided that this license is conditioned upon compliance with Section 2.3. + +### 2.2. Patent License + +For patent claims including, without limitation, +method, process, and apparatus claims +which You own, control or have the right to grant, now or in the future, +You grant to Us a perpetual, worldwide, non-exclusive, +transferable, royalty-free, irrevocable patent license, +with the right to sublicense these rights to multiple tiers of sublicensees, +to make, have made, use, sell, offer for sale, import +and otherwise transfer the Contribution +and the Contribution in combination with the Material +(and portions of such combination). +This license is granted only to the extent +that the exercise of the licensed rights infringes such patent claims; +and provided that this license is conditioned upon compliance with Section 2.3. + +### 2.3. Outbound License + +Based on the grant of rights in Sections 2.1 and 2.2, +if We include Your Contribution in a Material, +We may license the Contribution under any license, +including copyleft, permissive, commercial, or proprietary licenses. +As a condition on the exercise of this right, +We agree to also license the Contribution +under the terms of the license or licenses +which We are using for the Material on the Submission Date. + +### 2.4. Our Rights + +You acknowledge that We are not obligated +to use Your Contribution as part of the Material +and may decide to include any Contribution We consider appropriate. + +## 3. Agreement + +You confirm that: + +(a) You have the legal authority to enter into this Agreement. + +(b) You own the Copyright and patent claims +covering the Contribution which are required +to grant the rights under Section 2. + +(c) The grant of rights under Section 2 +does not violate any grant of rights +which You have made to third parties, including Your employer. +If You are an employee, +You have had Your employer approve this Agreement +or sign the Entity version of this document. +If You are less than eighteen years old, +please have Your parents or guardian sign the Agreement. + +## 4. Disclaimer + +EXCEPT FOR THE EXPRESS WARRANTIES IN SECTION 3, +THE CONTRIBUTION IS PROVIDED «AS IS». +MORE PARTICULARLY, ALL EXPRESS OR IMPLIED WARRANTIES +INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE +AND NON-INFRINGEMENT ARE EXPRESSLY DISCLAIMED BY YOU TO US. +TO THE EXTENT THAT ANY SUCH WARRANTIES CANNOT BE DISCLAIMED, +SUCH WARRANTY IS LIMITED IN DURATION TO THE MINIMUM PERIOD PERMITTED BY LAW. + +## 5. Miscellaneous + +5.1. This Agreement will be governed by and construed +in accordance with the laws of Russian Federation. + +5.2. This Agreement sets out the entire agreement between You +and Us for Your Contributions to Us +and overrides all other agreements or understandings. + +5.3. If You or We assign the rights or obligations +received through this Agreement to a third party, +as a condition of the assignment, +that third party must agree in writing +to abide by all the rights and obligations in the Agreement. + +5.4. The failure of either party to require performance +by the other party of any provision of this Agreement in one situation +shall not affect the right of a party +to require such performance at any time in the future. +A waiver of performance under a provision in one situation +shall not be considered a waiver of the performance +of the provision in the future or a waiver of the provision in its entirety. + +5.5. If any provision of this Agreement is found void and unenforceable, +such provision will be replaced to the extent possible with a provision +that comes closest to the meaning of the original provision +and which is enforceable. +The terms and conditions set forth in this Agreement +shall apply notwithstanding any failure of essential purpose +of this Agreement or any limited remedy +to the maximum extent possible under law. diff --git a/LICENSE.BSD-3-CLAUSE.md b/LICENSE.BSD-3-CLAUSE.md new file mode 100644 index 0000000..f040be6 --- /dev/null +++ b/LICENSE.BSD-3-CLAUSE.md @@ -0,0 +1,30 @@ +# The 3-Clause BSD License + +_Copyright (C) 2022 ru.auroraos_ + +Redistribution and use in source and binary forms, +with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain + the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce + the above copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b2be87a --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Flutter Packages Aurora OS + +This repo is a companion repo to the main flutter repo. +It contains the source code for Aurora Flutter's packages (i.e., packages developed by the Aurora team). +Check the packages directory to see all packages. \ No newline at end of file diff --git a/packages/xdga_directories/.gitignore b/packages/xdga_directories/.gitignore new file mode 100644 index 0000000..6f08bb1 --- /dev/null +++ b/packages/xdga_directories/.gitignore @@ -0,0 +1,31 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ +/.metadata diff --git a/packages/xdga_directories/README.md b/packages/xdga_directories/README.md new file mode 100644 index 0000000..ed5049b --- /dev/null +++ b/packages/xdga_directories/README.md @@ -0,0 +1,17 @@ +# xdga_directories + +A Dart package for reading directory path on Aurora OS. + +To use this package, the basic XDG values for the following are available via a Dart API: + +- `getCacheLocation` - User cache folder +- `getDocumentsLocation` - Documents of the user +- `getDownloadLocation` - User downloads +- `getMusicLocation` - Music and other audio files of the user +- `getPicturesLocation` - Photos and other images of the user +- `getGenericDataLocation` - General user application data +- `getMoviesLocation` - Movies and other user videos + +### Preview + +![preview.png](data%2Fpreview.png) \ No newline at end of file diff --git a/packages/xdga_directories/analysis_options.yaml b/packages/xdga_directories/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/packages/xdga_directories/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/xdga_directories/aurora/CMakeLists.txt b/packages/xdga_directories/aurora/CMakeLists.txt new file mode 100644 index 0000000..2fb2126 --- /dev/null +++ b/packages/xdga_directories/aurora/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.10) + +set(PLUGIN_NAME xdga_directories) +project(${PLUGIN_NAME} LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR}/shared) diff --git a/packages/xdga_directories/data/preview.png b/packages/xdga_directories/data/preview.png new file mode 100644 index 0000000..640ba9c Binary files /dev/null and b/packages/xdga_directories/data/preview.png differ diff --git a/packages/xdga_directories/example/.gitignore b/packages/xdga_directories/example/.gitignore new file mode 100644 index 0000000..24476c5 --- /dev/null +++ b/packages/xdga_directories/example/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/xdga_directories/example/README.md b/packages/xdga_directories/example/README.md new file mode 100644 index 0000000..7af8517 --- /dev/null +++ b/packages/xdga_directories/example/README.md @@ -0,0 +1,16 @@ +# xdga_directories_example + +Demonstrates how to use the xdga_directories plugin. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/packages/xdga_directories/example/analysis_options.yaml b/packages/xdga_directories/example/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/packages/xdga_directories/example/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/xdga_directories/example/aurora/.gitignore b/packages/xdga_directories/example/aurora/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/packages/xdga_directories/example/aurora/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/packages/xdga_directories/example/aurora/CMakeLists.txt b/packages/xdga_directories/example/aurora/CMakeLists.txt new file mode 100644 index 0000000..48ee0cc --- /dev/null +++ b/packages/xdga_directories/example/aurora/CMakeLists.txt @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 3.10) +project(com.example.xdga_directories_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) +find_package(Qt5 COMPONENTS Core 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 Qt5::Core) +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/packages/xdga_directories/example/aurora/desktop/com.example.xdga_directories_example.desktop b/packages/xdga_directories/example/aurora/desktop/com.example.xdga_directories_example.desktop new file mode 100644 index 0000000..b025d3c --- /dev/null +++ b/packages/xdga_directories/example/aurora/desktop/com.example.xdga_directories_example.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=xdga_directories_example +Comment=Demonstrates how to use the xdga_directories plugin. +Icon=com.example.xdga_directories_example +Exec=/usr/bin/com.example.xdga_directories_example +X-Nemo-Application-Type=silica-qt5 + +[X-Application] +Permissions= +OrganizationName=com.example +ApplicationName=xdga_directories_example diff --git a/packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.cpp b/packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.cpp new file mode 100644 index 0000000..b315972 --- /dev/null +++ b/packages/xdga_directories/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/packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.h b/packages/xdga_directories/example/aurora/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..648dcb3 --- /dev/null +++ b/packages/xdga_directories/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/packages/xdga_directories/example/aurora/flutter/generated_plugins.cmake b/packages/xdga_directories/example/aurora/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2d7ab7b --- /dev/null +++ b/packages/xdga_directories/example/aurora/flutter/generated_plugins.cmake @@ -0,0 +1,31 @@ +# +# Generated file, do not edit. +# +set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}") + +function(add_library TARGET) + _add_library(${TARGET} ${ARGN}) + + if(NOT "${TARGET}" MATCHES "^PkgConfig::.*") + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + "$" + "${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$") + endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*") +endfunction() + +list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST + xdga_directories +) + +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/packages/xdga_directories/example/aurora/icons/108x108.png b/packages/xdga_directories/example/aurora/icons/108x108.png new file mode 100644 index 0000000..984893d Binary files /dev/null and b/packages/xdga_directories/example/aurora/icons/108x108.png differ diff --git a/packages/xdga_directories/example/aurora/icons/128x128.png b/packages/xdga_directories/example/aurora/icons/128x128.png new file mode 100644 index 0000000..2d552ef Binary files /dev/null and b/packages/xdga_directories/example/aurora/icons/128x128.png differ diff --git a/packages/xdga_directories/example/aurora/icons/172x172.png b/packages/xdga_directories/example/aurora/icons/172x172.png new file mode 100644 index 0000000..9dc271b Binary files /dev/null and b/packages/xdga_directories/example/aurora/icons/172x172.png differ diff --git a/packages/xdga_directories/example/aurora/icons/86x86.png b/packages/xdga_directories/example/aurora/icons/86x86.png new file mode 100644 index 0000000..5923bb1 Binary files /dev/null and b/packages/xdga_directories/example/aurora/icons/86x86.png differ diff --git a/packages/xdga_directories/example/aurora/main.cpp b/packages/xdga_directories/example/aurora/main.cpp new file mode 100644 index 0000000..2dd2f52 --- /dev/null +++ b/packages/xdga_directories/example/aurora/main.cpp @@ -0,0 +1,10 @@ +#include +#include "generated_plugin_registrant.h" + +int main(int argc, char *argv[]) { + Application::Initialize(argc, argv); + Application::SetPixelRatio(1.8); + RegisterPlugins(); + Application::Launch(); + return 0; +} diff --git a/packages/xdga_directories/example/aurora/rpm/com.example.xdga_directories_example.spec b/packages/xdga_directories/example/aurora/rpm/com.example.xdga_directories_example.spec new file mode 100644 index 0000000..57c2e5a --- /dev/null +++ b/packages/xdga_directories/example/aurora/rpm/com.example.xdga_directories_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.xdga_directories_example +Summary: Demonstrates how to use the xdga_directories plugin. +Version: 0.1.0 +Release: 1 +License: Proprietary +Source0: %{name}-%{version}.tar.bz2 + +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/packages/xdga_directories/example/lib/main.dart b/packages/xdga_directories/example/lib/main.dart new file mode 100644 index 0000000..bc3970a --- /dev/null +++ b/packages/xdga_directories/example/lib/main.dart @@ -0,0 +1,158 @@ +import 'package:flutter/material.dart'; +import 'package:xdga_directories/xdga_directories.dart' as xdga_directories; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + late String cacheLocation; + late String documentsLocation; + late String downloadLocation; + late String musicLocation; + late String picturesLocation; + late String genericDataLocation; + late String moviesLocation; + + @override + void initState() { + super.initState(); + cacheLocation = xdga_directories.getCacheLocation(); + documentsLocation = xdga_directories.getDocumentsLocation(); + downloadLocation = xdga_directories.getDownloadLocation(); + musicLocation = xdga_directories.getMusicLocation(); + picturesLocation = xdga_directories.getPicturesLocation(); + genericDataLocation = xdga_directories.getGenericDataLocation(); + moviesLocation = xdga_directories.getMoviesLocation(); + } + + @override + Widget build(BuildContext context) { + const textStyleNormal = TextStyle(fontSize: 20); + final textStyleSmall = const TextStyle(fontSize: 18).copyWith(color: Colors.black54); + + const spacerNormal = SizedBox(height: 16); + const spacerSmall = SizedBox(height: 8); + + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Native Packages'), + ), + body: SingleChildScrollView( + child: Container( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + Container( + decoration: const BoxDecoration( + color: Colors.green, + borderRadius: BorderRadius.all(Radius.circular(10.0))), + child: Padding( + padding: const EdgeInsets.all(20), + child: Text( + 'A Dart package for reading directory path on Aurora OS.', + style: textStyleNormal.copyWith(color: Colors.white), + textAlign: TextAlign.center, + ), + ), + ), + const SizedBox(height: 30), + const Text( + 'getCacheLocation()', + style: textStyleNormal, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + cacheLocation, + style: textStyleSmall, + textAlign: TextAlign.center, + ), + spacerNormal, + const Text( + 'getDocumentsLocation()', + style: textStyleNormal, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + documentsLocation, + style: textStyleSmall, + textAlign: TextAlign.center, + ), + spacerNormal, + const Text( + 'getDownloadLocation()', + style: textStyleNormal, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + downloadLocation, + style: textStyleSmall, + textAlign: TextAlign.center, + ), + spacerNormal, + const Text( + 'getMusicLocation()', + style: textStyleNormal, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + musicLocation, + style: textStyleSmall, + textAlign: TextAlign.center, + ), + spacerNormal, + const Text( + 'getPicturesLocation()', + style: textStyleNormal, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + picturesLocation, + style: textStyleSmall, + textAlign: TextAlign.center, + ), + spacerNormal, + const Text( + 'getGenericDataLocation()', + style: textStyleNormal, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + genericDataLocation, + style: textStyleSmall, + textAlign: TextAlign.center, + ), + spacerNormal, + const Text( + 'getMoviesLocation()', + style: textStyleNormal, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + moviesLocation, + style: textStyleSmall, + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/packages/xdga_directories/example/pubspec.lock b/packages/xdga_directories/example/pubspec.lock new file mode 100644 index 0000000..2ee3257 --- /dev/null +++ b/packages/xdga_directories/example/pubspec.lock @@ -0,0 +1,182 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.9.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.16.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.2" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.12" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + xdga_directories: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.0.1" +sdks: + dart: ">=2.18.6 <3.0.0" + flutter: ">=2.11.0" diff --git a/packages/xdga_directories/example/pubspec.yaml b/packages/xdga_directories/example/pubspec.yaml new file mode 100644 index 0000000..b9c0bea --- /dev/null +++ b/packages/xdga_directories/example/pubspec.yaml @@ -0,0 +1,98 @@ +name: xdga_directories_example +description: Demonstrates how to use the xdga_directories plugin. + +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=2.18.6 <3.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + xdga_directories: + # When depending on this package from a real application you should use: + # xdga_directories: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # The example app is bundled with the plugin so we use a path dependency on + # the parent directory to use the current plugin's version. + path: ../ + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/xdga_directories/ffigen.yaml b/packages/xdga_directories/ffigen.yaml new file mode 100644 index 0000000..fcd032d --- /dev/null +++ b/packages/xdga_directories/ffigen.yaml @@ -0,0 +1,17 @@ +# Run with `flutter pub run ffigen --config ffigen.yaml`. +name: XdgaDirectoriesBindings +llvm-path: + - '/usr/lib/llvm-14/lib/libclang.so' # Ubuntu 22.04 +description: | + Bindings for `src/xdga_directories.h`. + + Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`. +output: 'lib/xdga_directories_bindings_generated.dart' +headers: + entry-points: + - 'src/xdga_directories.h' + include-directives: + - 'src/xdga_directories.h' +comments: + style: any + length: full diff --git a/packages/xdga_directories/lib/xdga_directories.dart b/packages/xdga_directories/lib/xdga_directories.dart new file mode 100644 index 0000000..7533176 --- /dev/null +++ b/packages/xdga_directories/lib/xdga_directories.dart @@ -0,0 +1,36 @@ +import 'dart:ffi'; + +import 'package:ffi/ffi.dart'; + +import 'xdga_directories_bindings_generated.dart'; + +const String _libName = 'xdga_directories'; + +/// The dynamic library in which the symbols for [XdgaDirectoriesBindings] can be found. +final DynamicLibrary _dylib = () { + return DynamicLibrary.open('lib$_libName.so'); +}(); + +/// The bindings to the native functions in [_dylib]. +final XdgaDirectoriesBindings _bindings = XdgaDirectoriesBindings(_dylib); + +/// QStandardPaths::CacheLocation +String getCacheLocation() => _bindings.getCacheLocation().cast().toDartString(); + +/// QStandardPaths::DocumentsLocation +String getDocumentsLocation() => _bindings.getDocumentsLocation().cast().toDartString(); + +/// QStandardPaths::DownloadLocation +String getDownloadLocation() => _bindings.getDownloadLocation().cast().toDartString(); + +/// QStandardPaths::MusicLocation +String getMusicLocation() => _bindings.getMusicLocation().cast().toDartString(); + +/// QStandardPaths::PicturesLocation +String getPicturesLocation() => _bindings.getPicturesLocation().cast().toDartString(); + +/// QStandardPaths::GenericDataLocation +String getGenericDataLocation() => _bindings.getGenericDataLocation().cast().toDartString(); + +/// QStandardPaths::MoviesLocation +String getMoviesLocation() => _bindings.getMoviesLocation().cast().toDartString(); diff --git a/packages/xdga_directories/lib/xdga_directories_bindings_generated.dart b/packages/xdga_directories/lib/xdga_directories_bindings_generated.dart new file mode 100644 index 0000000..0350b39 --- /dev/null +++ b/packages/xdga_directories/lib/xdga_directories_bindings_generated.dart @@ -0,0 +1,94 @@ +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +import 'dart:ffi' as ffi; + +/// Bindings for `src/xdga_directories.h`. +/// +/// Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`. +/// +class XdgaDirectoriesBindings { + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + XdgaDirectoriesBindings(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + /// The symbols are looked up with [lookup]. + XdgaDirectoriesBindings.fromLookup( + ffi.Pointer Function(String symbolName) + lookup) + : _lookup = lookup; + + ffi.Pointer getCacheLocation() { + return _getCacheLocation(); + } + + late final _getCacheLocationPtr = + _lookup Function()>>( + 'getCacheLocation'); + late final _getCacheLocation = + _getCacheLocationPtr.asFunction Function()>(); + + ffi.Pointer getDocumentsLocation() { + return _getDocumentsLocation(); + } + + late final _getDocumentsLocationPtr = + _lookup Function()>>( + 'getDocumentsLocation'); + late final _getDocumentsLocation = + _getDocumentsLocationPtr.asFunction Function()>(); + + ffi.Pointer getDownloadLocation() { + return _getDownloadLocation(); + } + + late final _getDownloadLocationPtr = + _lookup Function()>>( + 'getDownloadLocation'); + late final _getDownloadLocation = + _getDownloadLocationPtr.asFunction Function()>(); + + ffi.Pointer getMusicLocation() { + return _getMusicLocation(); + } + + late final _getMusicLocationPtr = + _lookup Function()>>( + 'getMusicLocation'); + late final _getMusicLocation = + _getMusicLocationPtr.asFunction Function()>(); + + ffi.Pointer getPicturesLocation() { + return _getPicturesLocation(); + } + + late final _getPicturesLocationPtr = + _lookup Function()>>( + 'getPicturesLocation'); + late final _getPicturesLocation = + _getPicturesLocationPtr.asFunction Function()>(); + + ffi.Pointer getGenericDataLocation() { + return _getGenericDataLocation(); + } + + late final _getGenericDataLocationPtr = + _lookup Function()>>( + 'getGenericDataLocation'); + late final _getGenericDataLocation = + _getGenericDataLocationPtr.asFunction Function()>(); + + ffi.Pointer getMoviesLocation() { + return _getMoviesLocation(); + } + + late final _getMoviesLocationPtr = + _lookup Function()>>( + 'getMoviesLocation'); + late final _getMoviesLocation = + _getMoviesLocationPtr.asFunction Function()>(); +} diff --git a/packages/xdga_directories/pubspec.yaml b/packages/xdga_directories/pubspec.yaml new file mode 100644 index 0000000..b7947cc --- /dev/null +++ b/packages/xdga_directories/pubspec.yaml @@ -0,0 +1,26 @@ +name: xdga_directories +description: A Dart package for reading XDG directory configuration information on Aurora OS. +version: 0.0.1 +homepage: https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/packages/xdga_directories + +environment: + sdk: '>=2.18.6 <3.0.0' + flutter: ">=2.11.0" + +dependencies: + flutter: + sdk: flutter + ffi: ^1.2.1 + plugin_platform_interface: ^2.0.2 + +dev_dependencies: + ffigen: ^5.0.1 + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + plugin: + platforms: + aurora: + ffiPlugin: true \ No newline at end of file diff --git a/packages/xdga_directories/src/CMakeLists.txt b/packages/xdga_directories/src/CMakeLists.txt new file mode 100644 index 0000000..d3a5eb0 --- /dev/null +++ b/packages/xdga_directories/src/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) +project(xdga_directories VERSION 0.0.1) + +find_package(Qt5 COMPONENTS Core REQUIRED) + +add_library(xdga_directories SHARED xdga_directories.cpp) + +target_link_libraries(xdga_directories Qt5::Core) + +set_target_properties(xdga_directories PROPERTIES + PUBLIC_HEADER xdga_directories.h + OUTPUT_NAME "xdga_directories" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Hex_Identity_ID_Goes_Here" +) + diff --git a/packages/xdga_directories/src/xdga_directories.cpp b/packages/xdga_directories/src/xdga_directories.cpp new file mode 100644 index 0000000..e0ef7b2 --- /dev/null +++ b/packages/xdga_directories/src/xdga_directories.cpp @@ -0,0 +1,38 @@ +#include + +#include "xdga_directories.h" + +char *getCacheLocation() +{ + return QStandardPaths::writableLocation(QStandardPaths::CacheLocation).toUtf8().data(); +} + +char *getDocumentsLocation() +{ + return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation).toUtf8().data(); +} + +char *getDownloadLocation() +{ + return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation).toUtf8().data(); +} + +char *getMusicLocation() +{ + return QStandardPaths::writableLocation(QStandardPaths::MusicLocation).toUtf8().data(); +} + +char *getPicturesLocation() +{ + return QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).toUtf8().data(); +} + +char *getGenericDataLocation() +{ + return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation).toUtf8().data(); +} + +char *getMoviesLocation() +{ + return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation).toUtf8().data(); +} \ No newline at end of file diff --git a/packages/xdga_directories/src/xdga_directories.h b/packages/xdga_directories/src/xdga_directories.h new file mode 100644 index 0000000..e72656d --- /dev/null +++ b/packages/xdga_directories/src/xdga_directories.h @@ -0,0 +1,21 @@ +#ifdef __cplusplus +extern "C" { +#endif + +char *getCacheLocation(); + +char *getDocumentsLocation(); + +char *getDownloadLocation(); + +char *getMusicLocation(); + +char *getPicturesLocation(); + +char *getGenericDataLocation(); + +char *getMoviesLocation(); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/script/build_example.sh b/script/build_example.sh new file mode 100755 index 0000000..a891325 --- /dev/null +++ b/script/build_example.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +## Build example, sign rpm, upload rpm to device + +## Usage +## chmod +x ./build_example.sh +## ./build_example.sh -p xdga_directories -u 192.168.1.59:/home/defaultuser/Downloads -k /home/user/sign/system_keys + +## Flatter path +FLATTER="$HOME/.local/opt/flutter-sdk/bin/flutter" +## Install Platform SDK path +PLATFORM_SDK_ROOT="/srv/mer" + +## https://community.omprussia.ru/documentation/software_development/psdk/setup.html +## You may not have set the PSDK_DIR environment variable. +export PSDK_DIR="$PLATFORM_SDK_ROOT/sdks/sfossdk" + +while getopts p:u:k: flag; do + case "${flag}" in + p) package=${OPTARG} ;; + u) upload=${OPTARG} ;; + k) keys_folder=${OPTARG} ;; + *) + echo "usage: $0 [-v] [-r]" >&2 + exit 1 + ;; + esac +done + +if [ -z "$package" ]; then + echo "Specify a build package" + exit +else + cd "../packages/$package" 2>/dev/null || eval 'echo "Package \"$package\" not found." && exit' + $FLATTER pub run ffigen --config ffigen.yaml + cd "example" || exit + $FLATTER build aurora --release +fi + +if [ -n "$keys_folder" ]; then + + key=$(ls "$keys_folder"/*key.pem) + + if [ -z "$key" ]; then + echo "Key *key.pem not found." + exit + fi + + cert=$(ls "$keys_folder"/*cert.pem) + + if [ -z "$cert" ]; then + echo "Key *cert.pem not found." + exit + fi + + ## Sign rpm system key + "$PSDK_DIR"/sdk-chroot rpmsign-external sign \ + --key "$key" \ + --cert "$cert" \ + build/aurora/arm/release/RPMS/*.rpm +fi + +if [ -n "$upload" ]; then + + # shellcheck disable=SC2012 + rpm=$(ls "$PWD"/build/aurora/arm/release/RPMS/*.rpm | sort -r | head -n 1) + + scp "$rpm" defaultuser@"$upload" +fi