Home | History | Annotate | Download | only in constants
      1 description = 'Conscrypt: Constants'
      2 
      3 ext {
      4     genDir = "${project.buildDir}/generated-sources"
      5 }
      6 
      7 // Needs to be binary-compatible with Android minSdkVersion.
      8 sourceCompatibility = androidMinJavaVersion
      9 targetCompatibility = androidMinJavaVersion
     10 
     11 sourceSets.main {
     12     java {
     13         srcDirs = [
     14             "${genDir}"
     15         ]
     16     }
     17 }
     18 
     19 dependencies {
     20     compile files("${genDir}") {
     21         builtBy 'runGen'
     22     }
     23 }
     24 
     25 // Generate sources JAR
     26 artifacts {
     27     archives sourcesJar
     28 }
     29 
     30 model {
     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 "**/*.cc"
     40                     }
     41                 }
     42             }
     43 
     44             binaries.all {
     45                 if (toolChain in VisualCpp) {
     46                     cppCompiler.define "WIN32_LEAN_AND_MEAN"
     47                 } else if (toolChain in Clang || toolChain in Gcc) {
     48                     cppCompiler.args "-std=c++11"
     49                 }
     50             }
     51         }
     52     }
     53 
     54     tasks {
     55         // Runs generateNativeConstants to create build/NativeConstants.java
     56         runGen(Exec) {
     57             def gen = $.binaries.get("genExecutable")
     58 
     59             dependsOn gen
     60             outputs.dir genDir
     61             File genDir = new File("${genDir}/org/conscrypt")
     62 
     63             executable gen.executable.file
     64 
     65             doFirst {
     66                 genDir.mkdirs()
     67                 standardOutput = new FileOutputStream(new File(genDir, "NativeConstants.java"))
     68             }
     69             doLast {
     70                 if (standardOutput != null) {
     71                     standardOutput.close();
     72                 }
     73             }
     74         }
     75     }
     76 }
     77 
     78 
     79 // Don't include this artifact in the distribution.
     80 tasks.install.enabled = false
     81 tasks.uploadArchives.enabled = false;
     82 
     83 // Disable the javadoc task.
     84 tasks.withType(Javadoc).all { enabled = false }
     85