Sinister is Dairy’s classpath scanning utility library.

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:

  1. Collect static instances of classes and pre-load and register them. (e.g. Core’s Features, Mercurial’s Subsystems)
  2. 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.

  1. Repository

This only needs to be done once, if you already have this, no need to add it again.

Add

repositories {
	maven {
		url "https://repo.dairy.foundation/releases"
	}
}

To TeamCode’s build.gradle, above dependencies.

  1. Implementation

Add the newest version of Sinister found here to the dependencies block:

dependencies {
	// ...
	implementation "dev.frozenmilk:Sinister:<MAJ.MIN.ENG>"
	// ...
}

The repo will give you the line to add.

  1. Sync

Run a gradle sync.