Overview
Its unlilkely that the vast majority of Dairy users will ever use Sinister directly themselves, for this reason, Sinister is currently under documented, if you’ve used Sinster, and you’re interested in writing some documentation, we’d love a hand!
Classpath scanning is performed by the FTC SDK, both to find OpModes with
@Teleop
and @Autonomous
annotations, and to find methods that are annotated
with the internal hook annotations.
Unfortunately, to add your own classpath scanning, you need to modify the
FTCRobotControllerActivity class, which must be done manually for all users.
Sinister takes a different approach, Sinister starts in the OnCreate
stage,
and performs its own classpath scanning, in the same manner that the FTC SDK
does, but instead is ‘Bootstrapping’. Sinister looks for static instances of
SinisterFilter
, and runs those found filters on the classes as well.
Sinister is used in Dairy to:
- Collect static instances of classes and pre-load and register them. (e.g.
Core’s
Feature
s, Mercurial’sSubsystem
s) - Provide a more type safe way to do the FTC SDK’s apphooks.
Features:
- Classpath scanning filters (
SinisterFilter
). - Reflection utilities for scanning filters.
- Search target system.
- Interface based AppHooks which replace the FTC SDK’s public static annotated method AppHooks.
Installation:
Core contains an installation of Sinister, but you may wish to install a custom version of it.
- Repository
This only needs to be done once, if you already have this, no need to add it again.
Add
To TeamCode
’s build.gradle
, above dependencies
.
- Implementation
Add the newest version of Sinister found
here to
the dependencies
block:
The repo will give you the line to add.
- Sync
Run a gradle sync.