1apply plugin: 'java'
2apply plugin: 'cpp'
3
4sourceSets {
5    stub {
6        java.srcDirs = [
7            'src/stub/java'
8        ]
9    }
10}
11// this is the "Unbundled Conscrypt jar"
12sourceSets.main {
13    java.srcDirs = [
14        'src/main/java',
15        'src/compat/java',
16        "${project.buildDir}/gen",
17    ]
18    compileClasspath += sourceSets.stub.output
19}
20
21compileJava.options.encoding = 'UTF-8'
22compileJava.options.compilerArgs += ['-Xmaxwarns', '9999999']
23
24dependencies {
25    compile getAndroidPrebuilt('9')
26    compile files("${project.buildDir}/gen") {
27        builtBy 'gen_constants'
28    }
29}
30
31model {
32    components {
33        genconst(NativeExecutableSpec) {
34            sources {
35                cpp {
36                    source {
37                        srcDir "src/gen/native"
38                    }
39                    exportedHeaders {
40                        srcDirs "../openssl/include", "../boringssl/include"
41                    }
42                }
43            }
44        }
45    }
46}
47
48task gen_constants(type:Exec)  {
49    File genDir = new File("${project.buildDir}", "gen")
50    genDir.mkdirs()
51
52    workingDir new File("${project.buildDir}")
53    executable 'binaries/genconstExecutable/genconst'
54    standardOutput = new FileOutputStream(new File(genDir, "NativeConstants.java"))
55}
56
57gen_constants.dependsOn 'genconstExecutable'
58