The -gengradle option causes a Gradle build.gradle script to be generated.
Only use -objdir with asn1c if your version of Gradle supports the java.outputDir property for a SourceSet in the Java plugin. As of this writing, java.outputDir is incubating.
The generated file uses the Java Library plugin. This was done with the thought that asn1c-generated code would likely be incorporated into a Java library.
A task, cleanGenSource, is generated for deleting the generated code. Task "clean" is made dependent upon this task. Because of this, you will want to ensure that source code is generated into a separate folder from your own, handwritten code. Otherwise, you will need to edit the task's configuration to exclude your handwritten code.
A task, asn1c, is generated for running asn1c. Task "compileJava" is made dependent on this task. If the output folder (where code is generated) contains handwritten code, Gradle may see output files for this task as perpetually out-of-date and actually execute this task for every build. In this case, you can edit the configuration of the task's output.files to exclude your handwritten files.
If you opt to generate sample writer and reader programs, tasks for running these will be generated. Gradle will automatically make these tasks depend upon task "compileJava", since that task produces output to the classpath used for the writer and reader programs.