Alternate way of generating the bindings inside Gradle.

Bug: 330292647
Change-Id: I6a80c7e432cf755e2e2ccb6166637ee4f9e04f07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/193041
Reviewed-by: Alex Benton <bentonian@google.com>
Commit-Queue: Jim Blackler <jimblackler@google.com>
Reviewed-by: Sonakshi Saxena <nexa@google.com>
diff --git a/tools/android/webgpu/build.gradle b/tools/android/webgpu/build.gradle
index b6d1fb8..28e65a4 100644
--- a/tools/android/webgpu/build.gradle
+++ b/tools/android/webgpu/build.gradle
@@ -65,6 +65,11 @@
     compileOptions {
         targetCompatibility JavaVersion.VERSION_17
     }
+    sourceSets {
+        main {
+            java.srcDirs += "$project.projectDir/../../../out/Debug/gen/java"
+        }
+    }
 }
 
 dependencies {
@@ -84,3 +89,17 @@
         }
     }
 }
+
+tasks.register('generateBindings', Exec) {
+    workingDir('../../..')
+    commandLine 'python3', 'generator/dawn_json_generator.py',
+    '--template-dir', 'generator/templates',
+    '--output-dir', "$project.projectDir/../../../out/Debug/gen",
+    '--dawn-json', 'src/dawn/dawn.json',
+    '--targets', 'kotlin',
+    '--kotlin-json', 'src/dawn/dawn_kotlin.json'
+}
+
+preBuild {
+    dependsOn generateBindings
+}