1description = 'Conscrypt: OpenJDK Integration Tests'
2
3evaluationDependsOn(':conscrypt-openjdk')
4
5def preferredNativeConfiguration = project(':conscrypt-openjdk').preferredNativeConfiguration
6def preferredNativeFileDir = project(':conscrypt-openjdk').preferredNativeFileDir
7
8sourceSets {
9    main {
10        resources {
11            // This shouldn't be needed but seems to help IntelliJ locate the native artifact.
12            srcDirs += preferredNativeFileDir
13        }
14    }
15}
16
17dependencies {
18    compile project(':conscrypt-openjdk')
19
20    // Add the preferred native openjdk configuration for this platform.
21    compile project(path: ':conscrypt-openjdk', configuration: "$preferredNativeConfiguration")
22
23    testCompile project(':conscrypt-constants'),
24                project(':conscrypt-testing')
25}
26
27// Check which version
28def javaError = new ByteArrayOutputStream()
29exec {
30    executable test.executable
31    args = ['-version']
32    ignoreExitValue true
33    errorOutput = javaError
34}
35
36test {
37    if (javaError.toString() =~ /"1[.]6[.].*"/) {
38        include "org/conscrypt/ConscryptJava6Suite.class"
39    } else {
40        include "org/conscrypt/ConscryptSuite.class"
41    }
42}
43
44// Add a second round of tests using the engine-based socket.
45task testEngineSocket(type: Test) {
46    dependsOn testClasses
47    // Use the engine socket by default.
48    jvmArgs "-Dorg.conscrypt.useEngineSocketByDefault=true"
49    testClassesDir = test.testClassesDir
50    includes = test.includes
51    doFirst {
52        classpath = test.classpath
53    }
54}
55test.dependsOn testEngineSocket
56
57// Don't include this artifact in the distribution.
58tasks.install.enabled = false
59tasks.uploadArchives.enabled = false;
60