普通文本  |  58行  |  1.31 KB

apply plugin: 'java'
apply plugin: 'cpp'

sourceSets {
    stub {
        java.srcDirs = [
            'src/stub/java'
        ]
    }
}
// this is the "Unbundled Conscrypt jar"
sourceSets.main {
    java.srcDirs = [
        'src/main/java',
        'src/compat/java',
        "${project.buildDir}/gen",
    ]
    compileClasspath += sourceSets.stub.output
}

compileJava.options.encoding = 'UTF-8'
compileJava.options.compilerArgs += ['-Xmaxwarns', '9999999']

dependencies {
    compile getAndroidPrebuilt('9')
    compile files("${project.buildDir}/gen") {
        builtBy 'gen_constants'
    }
}

model {
    components {
        genconst(NativeExecutableSpec) {
            sources {
                cpp {
                    source {
                        srcDir "src/gen/native"
                    }
                    exportedHeaders {
                        srcDirs "../openssl/include", "../boringssl/include"
                    }
                }
            }
        }
    }
}

task gen_constants(type:Exec)  {
    File genDir = new File("${project.buildDir}", "gen")
    genDir.mkdirs()

    workingDir new File("${project.buildDir}")
    executable 'binaries/genconstExecutable/genconst'
    standardOutput = new FileOutputStream(new File(genDir, "NativeConstants.java"))
}

gen_constants.dependsOn 'genconstExecutable'