1description = 'Conscrypt: Constants' 2 3ext { 4 genDir = "${project.buildDir}/generated-sources" 5} 6 7// Needs to be binary-compatible with Android minSdkVersion. 8sourceCompatibility = androidMinJavaVersion 9targetCompatibility = androidMinJavaVersion 10 11sourceSets.main { 12 java { 13 srcDirs = [ 14 "${genDir}" 15 ] 16 } 17} 18 19dependencies { 20 compile files("${genDir}") { 21 builtBy 'runGen' 22 } 23} 24 25model { 26 components { 27 // Builds exe/ which generates the content of NativeConstants.java 28 gen(NativeExecutableSpec) { 29 sources { 30 cpp { 31 // Sources assumed to be in src/gen/cpp by default. 32 exportedHeaders { 33 srcDirs "${boringsslIncludeDir}" 34 include "**/*.cc" 35 } 36 } 37 } 38 39 binaries.all { 40 if (toolChain in VisualCpp) { 41 cppCompiler.define "WIN32_LEAN_AND_MEAN" 42 } else if (toolChain in Clang || toolChain in Gcc) { 43 cppCompiler.args "-std=c++11" 44 } 45 } 46 } 47 } 48 49 tasks { 50 // Runs generateNativeConstants to create build/NativeConstants.java 51 runGen(Exec) { 52 def gen = $.binaries.get("genExecutable") 53 54 dependsOn gen 55 outputs.dir genDir 56 File genDir = new File("${genDir}/org/conscrypt") 57 58 executable gen.executable.file 59 60 doFirst { 61 genDir.mkdirs() 62 standardOutput = new FileOutputStream(new File(genDir, "NativeConstants.java")) 63 } 64 doLast { 65 if (standardOutput != null) { 66 standardOutput.close(); 67 } 68 } 69 } 70 } 71} 72 73// Disable the javadoc task. 74tasks.withType(Javadoc).configureEach { enabled = false } 75