use of org.gradle.jvm.platform.JavaPlatform in project gradle by gradle.
the class JvmTestSuiteRules method createJvmTestSuiteBinary.
private static <T extends JvmTestSuiteBinarySpec> void createJvmTestSuiteBinary(final ModelMap<BinarySpec> testBinaries, Class<T> testSuiteBinaryClass, final JvmTestSuiteSpec testSuite, final JvmBinarySpec testedBinary, final JavaToolChainRegistry toolChains, PlatformResolvers platformResolver) {
final List<JavaPlatform> javaPlatforms = resolvePlatforms(platformResolver);
final JavaPlatform platform = testedBinary != null ? testedBinary.getTargetPlatform() : javaPlatforms.get(0);
final BinaryNamingScheme namingScheme = namingSchemeFor(testSuite, testedBinary, javaPlatforms, platform);
testBinaries.create(namingScheme.getBinaryName(), testSuiteBinaryClass, new Action<T>() {
@Override
public void execute(T binary) {
JvmTestSuiteBinarySpecInternal testBinary = (JvmTestSuiteBinarySpecInternal) binary;
testBinary.setNamingScheme(namingScheme);
testBinary.setTargetPlatform(platform);
testBinary.setToolChain(toolChains.getForPlatform(platform));
testBinary.setTestedBinary(testedBinary);
addTestSuiteDependencies(testBinary);
configureCompileClasspath(testBinary);
}
private boolean addTestSuiteDependencies(JvmTestSuiteBinarySpecInternal testBinary) {
return testBinary.getDependencies().addAll(testSuite.getDependencies().getDependencies());
}
private void configureCompileClasspath(JvmTestSuiteBinarySpecInternal testSuiteBinary) {
if (testedBinary != null) {
Collection<DependencySpec> dependencies = testSuiteBinary.getDependencies();
BinarySpecInternal binary = (BinarySpecInternal) testedBinary;
LibraryBinaryIdentifier id = binary.getId();
dependencies.add(DefaultLibraryBinaryDependencySpec.of(id));
if (testedBinary instanceof JarBinarySpecInternal) {
dependencies.addAll(((JarBinarySpecInternal) testedBinary).getApiDependencies());
}
}
}
});
}
use of org.gradle.jvm.platform.JavaPlatform in project gradle by gradle.
the class PlayPlatformResolver method resolve.
private PlayPlatform resolve(String name, String playVersion, String scalaVersion, String javaVersion) {
PlayMajorVersion playMajorVersion = PlayMajorVersion.forPlayVersion(playVersion);
JavaPlatform javaPlatform = getJavaPlatform(javaVersion);
ScalaPlatform scalaPlatform = getScalaPlatform(playMajorVersion, scalaVersion);
return new DefaultPlayPlatform(name, playVersion, scalaPlatform, javaPlatform);
}
Aggregations