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