Skip to content

Commit

Permalink
Android: restructure project
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykMis committed Apr 21, 2023
1 parent 01582e5 commit bd7b10e
Show file tree
Hide file tree
Showing 113 changed files with 134 additions and 223 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ android/icons/*.png

libttsespeak.so

android/res/raw/espeakdata.zip
android/app/src/main/res/raw/espeakdata.zip
android/app/src/main/res/raw/espeakdata_version
android/res/raw/espeakdata_version

local.properties
Expand Down
90 changes: 90 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import org.gradle.crypto.checksum.Checksum

plugins {
id 'com.android.application'
id 'org.gradle.crypto.checksum' version '1.4.0'
}

android {
compileSdk 33
buildToolsVersion "33.0.2"
ndkVersion "25.2.9519653"
namespace "com.reecedunn.espeak"

defaultConfig {
applicationId "com.reecedunn.espeak"
minSdk 19
targetSdk 33
versionCode 22
versionName "1.52-dev"

testApplicationId "com.reecedunn.espeak.test"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
arguments "-DUSE_ASYNC:BOOL=OFF", "-DUSE_MBROLA:BOOL=OFF"
targets "ttsespeak", "espeak-data"
}
}
}

externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version "3.22.1"
}
}

lint {
abortOnError false
}
}

dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'com.google.android:android-test:4.1.1.4'
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) {
preserveFileTimestamps = false
reproducibleFileOrder = true
archiveFileName = "espeakdata.zip"
destinationDirectory = file("src/main/res/raw")

from("build/generated/espeak-ng-data/") {
into "espeak-ng-data"
}
}

tasks.register('createDataHash', Checksum) {
dependsOn tasks.createDataArchive
checksumAlgorithm.set(Checksum.Algorithm.SHA256)
inputFiles.setFrom(file("./src/main/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("./src/main/res/raw")
}

project.afterEvaluate {
tasks.checkData.dependsOn(externalNativeBuildDebug)
tasks.createDataArchive.dependsOn(externalNativeBuildDebug)
javaPreCompileDebug.dependsOn(tasks.createDataVersion)
javaPreCompileRelease.dependsOn(tasks.createDataVersion)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="20"
android:versionName="1.52-dev" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-feature
android:name="android.hardware.touchscreen"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ cmake_minimum_required(VERSION 3.8)

project(espeak-android)

add_subdirectory(../../ espeakng)

add_subdirectory(../../../../../ espeakng)
add_custom_target(
espeak-data
COMMAND ${CMAKE_COMMAND} -B${CMAKE_CURRENT_BINARY_DIR}/../espeak-data ${CMAKE_CURRENT_SOURCE_DIR}/../../
COMMAND ${CMAKE_COMMAND} -B${CMAKE_CURRENT_BINARY_DIR}/../espeak-data ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/../espeak-data --target data
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/../espeak-data/espeak-ng-data ${CMAKE_SOURCE_DIR}/../build/generated/espeak-ng-data
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/../espeak-data/espeak-ng-data ${CMAKE_SOURCE_DIR}/../../../build/generated/espeak-ng-data
)

message(STATUS "Data: ${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
113 changes: 2 additions & 111 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,113 +1,4 @@
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
}
}
plugins {
id 'org.gradle.crypto.checksum' version '1.4.0'
}

import org.gradle.crypto.checksum.Checksum
apply plugin: 'com.android.application'

repositories {
google()
mavenCentral()
}


dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'org.hamcrest:hamcrest-all:1.3'
}

android {
compileSdk 33
buildToolsVersion "33.0.2"
ndkVersion "25.2.9519653"
namespace "com.reecedunn.espeak"

defaultConfig {
minSdk 19
targetSdk 33
versionCode 22
versionName "1.52-dev"

externalNativeBuild {
cmake {
arguments "-DUSE_ASYNC:BOOL=OFF", "-DUSE_MBROLA:BOOL=OFF"
targets "ttsespeak", "espeak-data"
}
}
}

externalNativeBuild {
cmake {
path "jni/CMakeLists.txt"
version "3.22.1"
}
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
androidTest.setRoot('eSpeakTests')
androidTest {
java.srcDirs = ['eSpeakTests/src']
}
}

lint {
abortOnError false
}
}

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) {
preserveFileTimestamps = false
reproducibleFileOrder = true
archiveFileName = "espeakdata.zip"
destinationDirectory = file("res/raw")

from("build/generated/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")
}

project.afterEvaluate {
tasks.checkData.dependsOn(externalNativeBuildDebug)
tasks.createDataArchive.dependsOn(externalNativeBuildDebug)
javaPreCompileDebug.dependsOn(tasks.createDataVersion)
javaPreCompileRelease.dependsOn(tasks.createDataVersion)
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
}
9 changes: 0 additions & 9 deletions android/eSpeakTests/.classpath

This file was deleted.

34 changes: 0 additions & 34 deletions android/eSpeakTests/.project

This file was deleted.

4 changes: 0 additions & 4 deletions android/eSpeakTests/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

17 changes: 0 additions & 17 deletions android/eSpeakTests/AndroidManifest.xml

This file was deleted.

20 changes: 0 additions & 20 deletions android/eSpeakTests/proguard-project.txt

This file was deleted.

14 changes: 0 additions & 14 deletions android/eSpeakTests/project.properties

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions android/eSpeakTests/res/values/strings.xml

This file was deleted.

21 changes: 21 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
# android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
15 changes: 15 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = 'espeak'
include ':app'

0 comments on commit bd7b10e

Please sign in to comment.