mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
android: use gradle to build data archive
this fixes #1161 separates the android application build system from automake and simplifies building an application on windows.
This commit is contained in:
@@ -7,7 +7,11 @@ buildscript {
|
||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id 'org.gradle.crypto.checksum' version '1.4.0'
|
||||
}
|
||||
|
||||
import org.gradle.crypto.checksum.Checksum
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
repositories {
|
||||
@@ -15,11 +19,51 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'org.hamcrest:hamcrest-all:1.3'
|
||||
}
|
||||
|
||||
tasks.register('checkData') {
|
||||
doFirst {
|
||||
assert file("../espeak-ng-data/en_dict").exists()
|
||||
assert file("../espeak-ng-data/intonations").exists()
|
||||
assert file("../espeak-ng-data/phondata").exists()
|
||||
assert file("../espeak-ng-data/phondata-manifest").exists()
|
||||
assert file("../espeak-ng-data/phonindex").exists()
|
||||
assert file("../espeak-ng-data/phontab").exists()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('createDataArchive', Zip) {
|
||||
dependsOn tasks.checkData
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
archiveFileName = "espeakdata.zip"
|
||||
destinationDirectory = file("res/raw")
|
||||
|
||||
from("../espeak-ng-data/") {
|
||||
into "espeak-ng-data"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('createDataHash', Checksum) {
|
||||
dependsOn tasks.createDataArchive
|
||||
checksumAlgorithm.set(Checksum.Algorithm.SHA256)
|
||||
inputFiles.setFrom(file("./res/raw/espeakdata.zip"))
|
||||
outputDirectory.set(layout.buildDirectory.dir('intermediates/datahash'))
|
||||
}
|
||||
|
||||
tasks.register('createDataVersion', Copy) {
|
||||
dependsOn tasks.createDataHash
|
||||
from layout.buildDirectory.file('intermediates/datahash/espeakdata.zip.sha256')
|
||||
rename { return 'espeakdata_version' }
|
||||
into file("./res/raw")
|
||||
}
|
||||
preBuild.dependsOn createDataVersion
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
|
||||
|
||||
Reference in New Issue
Block a user