The following summarizes the process for contributing changes.
Map'A'Droid utilizes make
to build a consistent development environment across platforms. This helps ensure that any changes made pass required unit-tests and can identify regressions. To utilize make
the following requirements need to be met:
- Make
- pip
- pre-commit
- docker
- docker-compose
- Python
Some of the dependencies will give additional information if its not installed.
The following make
commands are available:
setup
- Install pre-commit and install the required git hooks. This should be run whenever new hooks are added (should be rare since most will be handled by pre-commit).clean
- Stop containers related to MAD development and cleanup ./tox folderbuild
- Multi-stage docker build. Build the MAD base image (local_mad_production) and build the development image (local_mad_development) without using the cacherebuild
- Same asbuild
but can re-use cacheup
- Start MariaDB and local_mad_development containers. MariaDB container does not have a persistent volumedown
- Execute MariaDB and local_mad_development containersshell
- Executeup
and gives user-level access to local_mad_development containerroot-shell
- Executeup
and gives root-level access to local_mad_development containerrun
- Start MariaDB and local_mad_development containers. MariaDB container has a persistent volumetests
- Executeup
and run all tests through toxunittests
- Executeup
and run tox tests for py37shell-<pyxx>
- Executeup
and grant user-level access with the tox virtual environment selected. IncludingRECREATE=1
will rebuild the tox environmentversions
- Lookup the current version for pip, pre-commit, docker, and docker-compose
.
├── cache -> Definition for caching classes/services used
├── db -> Anything in regards to DB access and model definitions (i.e. table definitions)
│ ├── helper -> Helpers to query the DB. A class per table.
│ └── resource_definitions -> Definitions of tables adding comments to render madmin pages. Planned to be replaced by using the table definitions directly.
├── geofence -> Geofence-related calculations/GeofenceHelper
├── mad_apk -> Wizard and APK storage (filesystem, DB) in order to maintain APK files that can be installed on devices
├── madmin
│ └── endpoints -> folder containing all endpoints of MADmin (i.e. a class per route)
│ ├── api -> "/api/..."
│ │ ├── apks
│ │ ├── autoconf
│ │ └── resources
│ └── routes
│ ├── apk
│ ├── autoconfig
│ ├── control
│ ├── event
│ ├── map
│ ├── misc
│ ├── settings
│ └── statistics
├── mapping_manager -> MappingManager basically is a central component of MAD. All routemanagers and configurations are loaded here and queried by workers.
├── mitm_receiver -> MITMReceiver receives data of Pogo (endpoint configured in PogoDroid), provides endpoints for autoconf and provides settings/details about the mode the worker/device should scan with
│ └── endpoints
│ ├── autoconfig
│ └── mad_apk
├── ocr -> OCR related functionality to detect certain windows and handle situations
├── patcher -> DB migrations
├── plugins -> Plugins allow for ANY code to be executed at startup to provide additional functionality to MAD
│ └── endpoints -> The endpoints relevant for plugins are loaded as AIOHTTP sub-applications. Thus plugins are provided by a sub-application, each plugin is then served with an additional sub-application (if needed)
├── route -> Routemanagers for all the modes supported by MAD. The base class RouteManagerBase provides the core logic. Template Method was used here since the core logic of routemanagers is pretty much the same: calculate routes, maintain a priority queue (optional) and provide locations to workers upon request.
│ └── routecalc -> Clustering and route calculation algorithms - TSP being the biggest enemy ;)
├── tests -> Unit tests likely broken since those are of times before asyncio was introduced -> needs fixing
│ ├── api
│ └── mad_apk
├── utils -> Utility classes/methods as well as the DeviceUpdater class dealing with MADmin jobs
├── webhook -> WebhookWorker querying the DB for changes to send changes detected towards the configured endpoints
├── websocket -> All devices using RGC connect to the WebsocketServer which allows communication (back and forth), thus screenshots can be queried, clicks/swipes executed, location adjustments etc.
└── worker -> Each device is represented by a Worker. Template Method was used given Workers are relatively straight forward: Check everything is fine (if not, handle accordingly), teleport/walk to location, do something, repeat.