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 25// Generate sources JAR 26artifacts { 27 archives sourcesJar 28} 29 30model { 31 components { 32 // Builds exe/ which generates the content of NativeConstants.java 33 gen(NativeExecutableSpec) { 34 sources { 35 cpp { 36 // Sources assumed to be in src/gen/cpp by default. 37 exportedHeaders { 38 srcDirs "${boringsslIncludeDir}" 39 include "**/*.cpp" 40 } 41 } 42 } 43 } 44 } 45 46 tasks { 47 // Runs generateNativeConstants to create build/NativeConstants.java 48 runGen(Exec) { 49 def gen = $.binaries.get("genExecutable") 50 51 dependsOn gen 52 File genDir = new File("${genDir}/org/conscrypt") 53 54 executable gen.executable.file 55 56 doFirst { 57 genDir.mkdirs() 58 standardOutput = new FileOutputStream(new File(genDir, "NativeConstants.java")) 59 } 60 doLast { 61 if (standardOutput != null) { 62 standardOutput.close(); 63 } 64 } 65 } 66 } 67} 68 69 70// Don't include this artifact in the distribution. 71tasks.install.enabled = false 72tasks.uploadArchives.enabled = false; 73 74// Disable the javadoc task. 75tasks.withType(Javadoc).all { enabled = false } 76