Ed M
06/02/2018, 4:39 PMxenoterracide
06/03/2018, 10:35 AMxenoterracide
06/03/2018, 10:46 AMpublic class JavaLib implements Plugin<Project> {
@Override
public void apply( Project project ) {
project.getPluginManager().apply( JavaLibraryPlugin.class );
DependencyHandler deps = project.getDependencies();
deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Api.A ) );
deps.add( TEST_RUN, String.join( D, Junit.G, Junit.Engine.A ) );
deps.add( TEST_IMPL, String.join( D, AssertJ.G, AssertJ.A ) );
project.getTasks().withType( Test.class, task -> {
task.useJUnitPlatform();
task.testLogging( log -> <http://log.info|log.info>( info -> info.getEvents().add( TestLogEvent.PASSED ) ) );
task.reports( reports -> {
reports.getJunitXml().setEnabled( false );
reports.getHtml().setEnabled( false );
} );
} );
project.getTasks().withType( JavaCompile.class, task -> {
task.getOptions().getCompilerArgs().add( "-parameters" );
} );
project.getConvention().configure( JavaPluginConvention.class, conv -> {
XenoExtension xeno = project.getExtensions().getByType( XenoExtension.class );
xeno.setSourceSets( Collections.singleton( conv.getSourceSets().findByName( "main" ) ) );
} );
}
}
even put it after JavaLibraryPlugin has been applied isn't helpingEd M
06/03/2018, 3:36 PMEd M
06/03/2018, 3:38 PMproject.getExtensions.configure(JavaPluginConvention.class, [...]);
Ed M
06/04/2018, 3:44 AMxenoterracide
06/04/2018, 4:11 AMEd M
06/04/2018, 4:56 AMxenoterracide
06/04/2018, 2:18 PMxenoterracide
06/04/2018, 2:31 PMproject.afterEvaluate( p1 -> {
ExtensionContainer ext = p1.getExtensions();
XenoExtension xeno = ext.getByType( XenoExtension.class );
if ( xeno.getSourceSets().isEmpty() ) {
JavaPluginConvention plugin = p1.getConvention().getPlugin( JavaPluginConvention.class );
SourceSet main = plugin.getSourceSets().findByName( SourceSet.MAIN_SOURCE_SET_NAME );
xeno.setSourceSets( Collections.singleton( main ) );
}
ext.getByType( SpotBugsExtension.class ).setSourceSets( xeno.getSourceSets() );
});
but when I do this, or anything else that doesn't end up with the java convention stacktrace missing, spot bugs extension ends up with a null sourceset, and thus isn't getting scanned...Ed M
06/04/2018, 2:57 PM