I’m working on a custom Sonar Plugin that will implement a custom RulesDefinition. I am generating the rules from resources contained in a jar file. Before generating the rules, I have to explode the jar to a org.sonar.api.batch.fs.FileSystem.
So far I only know how to access fs.FileSystem via SensorContext.fileSystem().
I’m trying to define the rules in the custom RulesDefinition inside define(Context), using NewRepository.
I can think of three possible ways to bridge the gap:
- Navigate (somehow) from org.sonar.api.server.rule.Context to org.sonar.api.batch.fs.FileSystem
- Ensure that the external jar is exploded before custom RulesDefinition define(Context) is called.
- Have the plugin initially install the custom RulesDefinition with an empty set of rules; provide a link from the RulesDefinition to the Sensor; call the RulesDefinition define(Context) from within the Sensor.execute(SensorContext)
Does anyone have any suggestions or advice?
Thanks in advance!