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 "**/*.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.
     71 tasks.install.enabled = false
     72 tasks.uploadArchives.enabled = false;
     73