Update conscrypt build.gradle for the native generator

Change-Id: Ifd5ae43f09eafe11f54acc6dd66c55e4b52b5e30
diff --git a/build.gradle b/build.gradle
index a2db9fa..1a5e334 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,5 @@
 apply plugin: 'java'
+apply plugin: 'cpp'
 
 sourceSets {
     stub {
@@ -12,6 +13,7 @@
     java.srcDirs = [
         'src/main/java',
         'src/compat/java',
+        "${project.buildDir}/gen",
     ]
     compileClasspath += sourceSets.stub.output
 }
@@ -21,4 +23,35 @@
 
 dependencies {
     compile getAndroidPrebuilt('9')
+    compile files("${project.buildDir}/gen") {
+        builtBy 'gen_constants'
+    }
 }
+
+model {
+    components {
+        genconst(NativeExecutableSpec) {
+            sources {
+                cpp {
+                    source {
+                        srcDir "src/gen/native"
+                    }
+                    exportedHeaders {
+                        srcDirs "../openssl/include", "../boringssl/include"
+                    }
+                }
+            }
+        }
+    }
+}
+
+task gen_constants(type:Exec)  {
+    File genDir = new File("${project.buildDir}", "gen")
+    genDir.mkdirs()
+
+    workingDir new File("${project.buildDir}")
+    executable 'binaries/genconstExecutable/genconst'
+    standardOutput = new FileOutputStream(new File(genDir, "NativeConstants.java"))
+}
+
+gen_constants.dependsOn 'genconstExecutable'