AsteroidOS / asteroidos.org

AsteroidOS official website. Built using Assemble, Grunt, Bootstrap and Less.
Other
23 stars 37 forks source link

Add more indepth information for app development/API usage. #125

Open MagneFire opened 2 years ago

MagneFire commented 2 years ago

Currently we have a wiki for creating an app for AsteroidOS: https://asteroidos.org/wiki/creating-an-asteroid-app/ While sufficient for simply building and creating a new app, it does not show what APIs are available for everyone to use. Generally people have to search through this GitHub organization, which is not desirable.

Instead we should provide a new wiki page that provides this information.

Things that this page should have (more to be added/suggestions welcome :wink: ):

beroset commented 2 years ago

I love this idea. Another thing that would be useful is to document what SailfishOS refers to as "callchains" for example:

Sensors: sensorfw-qt5 <> sensorfw-qt5-hybris <> libgbinder <> Android BSP HAL: android.hardware.sensors

Could such mapping be automated? Automating documentation from the code is a good way to make sure that they stay in synchronization. Doxygen uses this approach.

MagneFire commented 2 years ago

For reference on your comment that information is provided by https://sailfishos.org/wiki/Architecture.

Doxygen is an awesome tool to get documentation from the code. However, I'm not familiar with a method that would allow doing the same for all different source codes (QtSensors, General Qt modules, MCE APIs, etc)

lepras commented 1 year ago

Also we need simple logging and linux commands one can use for debugging (like journalctl). It maybe redundant but it would be helpful for people coming from other dev environments cough (flutter + windows) cough. And running and setting up command line things not GUI coz qtcreator breaks a lot. (aos docs are not clear on that)

Some developing tips like setting up qmltester on watch and reduction of testing cycles by separating logic and design.

Again it may be redundant but seeing how easy it is for developers to pick up something like flutter and make up a simple app, we should be inspired by that. I know it isn't fair to compare two projects that have vastly different amounts of resources and organizations backing them up, but atleast we can take inspiration and move in the right direction.

If nobody is writing this, can I?, I will try and make up a PR. and then somebody more experienced and nuanced than me can review it.

I am exploring setting up the environment in vscode (the IDE noobs like me use :P), if I got things working I will mention that also!

lepras commented 1 year ago

have 2 terminals

  1. do ssh and journalctl in one
  2. other build app or vim

Useful Vs Code Extensions:

  1. ms-vscode.cpptools
  2. twxs.cmake
  3. tonka3000.qtvsctools
  4. felgo.felgo or bbenoist.QML
  5. Gruntfuggly.todo-tree: for project management

not related to qml/qt but Codeium.codeium is the only thing that works well for qml autocomplete

lepras commented 1 year ago

here is a shell script to quickly install an app:

#!/bin/sh

source /usr/local/oecore-x86_64/environment-setup-armv7vehf-neon-oe-linux-gnueabi
export CMAKE_PROGRAM_PATH=/usr/local/oecore-x86_64/sysroots/armv7vehf-neon-oe-linux-gnueabi/usr/bin/
cmake -B build
cmake --build build
cmake --build build -t package

file="$(ls ./build/*.ipk | sort -V | tail -n1)"
filename="$(basename $file)"
sshpass -p "<password>" scp $file ceres@192.168.2.15:/home/ceres/
sshpass -p "<password>" ssh root@192.168.2.15 << EOF
  cd /home/ceres/
  opkg install --force-overwrite $filename
EOF
lepras commented 1 year ago

Add these lines at the end of CMakeLists.txt for package automation:

set(CPACK_GENERATOR "DEB")
string(TOLOWER "${CMAKE_PROJECT_NAME}" lcproject_name)
set(CPACK_DEBIAN_FILE_NAME "${lcproject_name}-${CMAKE_PROJECT_VERSION}.ipk")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armv7vehf-neon)
if (NOT CPACK_PACKAGE_CONTACT) 
    set(CPACK_PACKAGE_CONTACT bogus@example.org)
    message(WARNING "No package contact specified: using ${CPACK_PACKAGE_CONTACT}")
endif()
include(CPack)
lepras commented 1 year ago

Main docs: https://doc.qt.io/ (AOS uses qt5) AOS specific component/API: https://github.com/AsteroidOS/qml-asteroid Examples of use of most of those can be found by searching the AsteroidOS codebase: https://github.com/search?q=org%3AAsteroidOS+StatusPage&type=code

lepras commented 1 year ago

Dump logs by

sshpass -p "<password>" ssh root@192.168.2.15 << EOF
   journalctl -e --no-pager > /home/ceres/log.txt
EOF
sshpass -p "<password>" scp ceres@192.168.2.15:/home/ceres/log.txt ./build/

Follow Along by

journalctl -f
lepras commented 1 year ago

Using QML tester for small testing cycles:

opkg install qmltester

Edit qmls by vim and scp

vim scp://user@myserver[:port]//path/to/file.txt

Follow along by

journalctl -f
FlorentRevest commented 1 year ago

Useful Vs Code Extensions:

  1. ms-vscode.cpptools
  2. twxs.cmake
  3. tonka3000.qtvsctools
  4. felgo.felgo or bbenoist.QML
  5. Gruntfuggly.todo-tree: for project management

We could add a .vscode/extensions.json and useful tasks.json to our helloworld repo (and more if people find that useful)