use of org.gradle.jvm.internal.JvmAssembly in project gradle by gradle.
the class JvmLocalLibraryMetaDataAdapter method createLocalComponentMetaData.
@Override
@SuppressWarnings("unchecked")
public DefaultLibraryLocalComponentMetadata createLocalComponentMetaData(Binary selectedBinary, String projectPath, boolean toAssembly) {
EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage = new EnumMap<UsageKind, Iterable<DependencySpec>>(UsageKind.class);
EnumMap<UsageKind, List<PublishArtifact>> artifacts = new EnumMap<UsageKind, List<PublishArtifact>>(UsageKind.class);
initializeUsages(dependenciesPerUsage, artifacts);
if (selectedBinary instanceof JarBinarySpecInternal) {
JarBinarySpecInternal jarBinarySpec = (JarBinarySpecInternal) selectedBinary;
createJarBinarySpecLocalComponentMetaData(artifacts, jarBinarySpec, dependenciesPerUsage, toAssembly);
}
if (selectedBinary instanceof WithJvmAssembly) {
// a local component that provides a JVM assembly
JvmAssembly assembly = ((WithJvmAssembly) selectedBinary).getAssembly();
createJvmAssemblyLocalComponentMetaData(artifacts, assembly, dependenciesPerUsage, toAssembly);
}
return createResolvedMetaData((BinarySpecInternal) selectedBinary, projectPath, dependenciesPerUsage, artifacts);
}
use of org.gradle.jvm.internal.JvmAssembly in project gradle by gradle.
the class JvmTestSuiteBasePlugin method createJvmTestSuiteTasks.
@BinaryTasks
void createJvmTestSuiteTasks(ModelMap<Task> tasks, final JvmTestSuiteBinarySpecInternal binary, @Path("buildDir") final File buildDir) {
final JvmAssembly jvmAssembly = ((WithJvmAssembly) binary).getAssembly();
tasks.create(testTaskNameFor(binary), Test.class, new Action<Test>() {
@Override
public void execute(final Test test) {
test.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
test.setDescription(String.format("Runs %s.", WordUtils.uncapitalize(binary.getDisplayName())));
test.dependsOn(jvmAssembly);
test.setTestClassesDirs(new SimpleFileCollection(binary.getClassesDir()));
test.setClasspath(binary.getRuntimeClasspath());
configureReports(binary, test);
}
private void configureReports(JvmTestSuiteBinarySpecInternal binary, Test test) {
// todo: improve configuration of reports
TestTaskReports reports = test.getReports();
File reportsDirectory = new File(buildDir, "reports");
File reportsOutputDirectory = binary.getNamingScheme().getOutputDirectory(reportsDirectory);
File htmlDir = new File(reportsOutputDirectory, "tests");
File xmlDir = new File(buildDir, "test-results");
File xmlDirOutputDirectory = binary.getNamingScheme().getOutputDirectory(xmlDir);
File binDir = new File(xmlDirOutputDirectory, "binary");
reports.getHtml().setDestination(htmlDir);
reports.getJunitXml().setDestination(xmlDirOutputDirectory);
test.setBinResultsDir(binDir);
}
});
}
Aggregations