Browse Source

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.
master
Alexander Epaneshnikov 3 years ago
parent
commit
042ac06b9e
No account linked to committer's email address
2 changed files with 45 additions and 14 deletions
  1. 1
    14
      Makefile.am
  2. 44
    0
      android/build.gradle

+ 1
- 14
Makefile.am View File

apk-check: espeakdata apk-check: espeakdata
cd android && $(GRADLE) connectedCheck cd android && $(GRADLE) connectedCheck


android/res/raw/espeakdata.zip: espeak-ng-data/phontab dictionaries
mkdir -pv android/res/raw
rm -f $@
find espeak-ng-data/{intonations,phondata,phonindex,phontab} | zip -@ $@
find espeak-ng-data/*_dict | zip -@ $@
find espeak-ng-data/lang -type f | zip -@ $@
find espeak-ng-data/voices -type f | grep -vF "/mb/" | zip -@ $@

android/res/raw/espeakdata_version: android/res/raw/espeakdata.zip
sha1sum $< | awk '{ print $$1 }' > $@

espeakdata: \
android/res/raw/espeakdata.zip \
android/res/raw/espeakdata_version
espeakdata: espeak-ng-data/phontab dictionaries


##### dictionaries: ##### dictionaries:



+ 44
- 0
android/build.gradle View File

classpath 'com.android.tools.build:gradle:7.1.2' 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' apply plugin: 'com.android.application'


repositories { repositories {
mavenCentral() mavenCentral()
} }



dependencies { dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'org.hamcrest:hamcrest-all:1.3' 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 { android {
compileSdkVersion 26 compileSdkVersion 26



Loading…
Cancel
Save