diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d0038b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.idea/ +/.vscode/ diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..28c38b7 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,6 @@ +Authors + +The following authors have created the source code of «flutter-plugins» owned by Open Mobile Platform LLC as the owner: + +Denis Glazkov d.glazkov@omp.ru +Vitaliy Zarubin v.zarubin@omp.ru diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c10629 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# 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). + +# Packages: + +* [battery_plus](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/battery_plus/battery_plus_aurora) - The Aurora implementation of [battery_plus](https://pub.dev/packages/battery_plus). +* [device_info_plus](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/device_info_plus/device_info_plus_aurora) - The Aurora implementation of [device_info_plus](https://pub.dev/packages/device_info_plus). +* [flutter_local_notifications](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/flutter_local_notifications/flutter_local_notifications_aurora) - The Aurora implementation of [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications). +* [flutter_secure_storage](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/flutter_secure_storage/flutter_secure_storage_aurora) - The Aurora implementation of [flutter_secure_storage](https://pub.dev/packages/flutter_secure_storage). +* [package_info_plus](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/package_info_plus/package_info_plus_aurora) - The Aurora implementation of [package_info_plus](https://pub.dev/packages/package_info_plus). +* [path_provider](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/path_provider/path_provider_aurora) - The Aurora implementation of [path_provider](https://pub.dev/packages/path_provider). +* [shared_preferences](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/shared_preferences/shared_preferences_aurora) - The Aurora implementation of [shared_preferences](https://pub.dev/packages/shared_preferences). +* [sqflite](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/sqflite/sqflite_aurora) - The Aurora OS implementation of [sqflite](https://pub.dev/packages/sqflite). +* [wakelock](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/wakelock/wakelock_aurora) - The Aurora OS implementation of [wakelock](https://pub.dev/packages/wakelock). +* [xdga_directories](https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/dev/packages/xdga_directories) - A Dart package for reading directory path on Aurora OS. diff --git a/script/build_example.sh b/script/build_example.sh new file mode 100755 index 0000000..bac91f4 --- /dev/null +++ b/script/build_example.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# Copyright (c) 2023. Open Mobile Platform LLC. +# License: Proprietary. + +## Build example, sign rpm, upload/install/run rpm to device + +## Usage +## +## chmod +x ./build_example.sh +## +## ./build_example.sh \ +## -p xdga_directories \ +## -d : \ +## -s /home/user/sign/system_keys + +## Flutter path +FLUTTER="$HOME/.local/opt/flutter-sdk/bin/flutter" + +## https://developer.auroraos.ru/doc/software_development/psdk/setup +## Install Platform SDK path +## You may not have set the PSDK_DIR environment variable. +## export PSDK_DIR=$HOME/AuroraPlatformSDK/sdks/aurora_psdk + +while getopts p:d:s: flag; do + case "${flag}" in + p) package=${OPTARG} ;; + d) device=${OPTARG} ;; + s) sign=${OPTARG} ;; + *) + echo "usage: $0 [-p] [-d] [-s]" >&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' + ## Update dependency + $FLUTTER pub get + ## Run ffigen if has + $FLUTTER pub run ffigen --config ffigen.yaml 2>/dev/null + ## Open example dir + cd "example" || exit + ## Build aurora example app + { + $FLUTTER build aurora --release + } || { + exit 1; + } +fi + +if [ -n "$sign" ]; then + + key=$(ls "$sign"/*key.pem) + + if [ -z "$key" ]; then + echo "Key *key.pem not found." + exit + fi + + cert=$(ls "$sign"/*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 "$device" ]; then + + IFS=':' read -ra ADDR <<< "$device" + IFS='/' read -ra ADDP <<< "$package" + + D_IP="${ADDR[0]}" + D_PASS="${ADDR[1]}" + APP_KEY="${ADDP[-1]}" + + # shellcheck disable=SC2012 + rpm=$(ls "$PWD"/build/aurora/arm/release/RPMS/*.rpm | sort -r | head -n 1) + + # upload rpm + scp "$rpm" defaultuser@"$D_IP:/home/defaultuser/Downloads" + + # install rpm + ssh -t defaultuser@$D_IP "echo $D_PASS | devel-su pkcon -y install-local /home/defaultuser/Downloads/*$APP_KEY*.rpm" + + # run application + ssh -t defaultuser@$D_IP "/usr/bin/com.example.${APP_KEY}_example" +fi diff --git a/script/vscode_properties.sh b/script/vscode_properties.sh new file mode 100755 index 0000000..e80ab79 --- /dev/null +++ b/script/vscode_properties.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# Copyright (c) 2023. Open Mobile Platform LLC. +# License: Proprietary. + +## Script create c_cpp_properties.json with dependencies for flutter aurora + +## Usage +## +## chmod +x ./vscode_properties.sh +## ./vscode_properties.sh + +## https://developer.auroraos.ru/doc/software_development/psdk/setup +## Install Platform SDK path +## You may not have set the PSDK_DIR environment variable. +## export PSDK_DIR=$HOME/AuroraPlatformSDK/sdks/aurora_psdk + +cd ../ + +## check file +[ -f .vscode/c_cpp_properties.json ] && { echo "File c_cpp_properties.json already exist!"; exit; } + +## find target +TARGET=$($PSDK_DIR/sdk-chroot sdk-assistant list | grep armv | grep default | sed 's/^.*A/A/g' | sed 's/\s.*//g') + +## mkdir .vscode if not exist +[ -d .vscode ] || mkdir .vscode + +## find targets path +TARGETS_PATH=$(cd "$PSDK_DIR/../../" && pwd)/targets + +## save file +tee -a .vscode/c_cpp_properties.json << END +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "\${workspaceFolder}/**", + "$TARGETS_PATH/$TARGET/usr/include", + "$TARGETS_PATH/$TARGET/usr/include/dconf", + "$TARGETS_PATH/$TARGET/usr/include/flutter-embedder", + "$TARGETS_PATH/$TARGET/usr/include/maliit", + "$TARGETS_PATH/$TARGET/usr/include/appmanifest-cpp", + "$TARGETS_PATH/$TARGET/usr/include/glib-2.0", + "$TARGETS_PATH/$TARGET/usr/lib/glib-2.0/include", + "$TARGETS_PATH/$TARGET/usr/include/sailfishapp", + "$TARGETS_PATH/$TARGET/usr/include/qt5", + "$TARGETS_PATH/$TARGET/usr/include/qt5/QtConcurrent", + "$TARGETS_PATH/$TARGET/usr/include/qt5/QtCore", + "$TARGETS_PATH/$TARGET/usr/include/qt5/QtDBus", + "$TARGETS_PATH/$TARGET/usr/include/qt5/QtGui", + "$TARGETS_PATH/$TARGET/usr/include/qt5/QtMultimedia", + "$TARGETS_PATH/$TARGET/usr/include/qt5/QtQuick" + ], + "defines": [ + "__ARM_PCS_VFP" + ], + "compilerPath": "/usr/bin/g++", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "clang-x64" + } + ], + "version": 4 +} +END