Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin: Use Coroutines #1597

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[submodule "kotlin/openblas/src/main/cpp"]
path = kotlin/openblas/src/main/cpp
url = https://github.com/OpenMathLib/OpenBLAS.git
[submodule "kotlin/clapack/src/main/cpp"]
path = kotlin/clapack/src/main/cpp
url = https://github.com/alphacep/clapack.git
branch = v3.2.1
[submodule "kotlin/kaldi/src/main/cpp"]
path = kotlin/kaldi/src/main/cpp
url = https://github.com/alphacep/kaldi.git
branch = vosk-android
[submodule "kotlin/openfst/src/main/cpp"]
path = kotlin/openfst/src/main/cpp
url = https://github.com/messiaen/openfst.git
2 changes: 1 addition & 1 deletion kotlin/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions kotlin/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions kotlin/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions kotlin/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 31 additions & 4 deletions kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ plugins {
`maven-publish`
id("org.jetbrains.dokka") version "1.9.20"
kotlin("plugin.serialization") version "2.0.0"
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}

group = "com.alphacephei"
version = "0.3.50"

repositories {
google()
mavenCentral()
allprojects {
repositories {
google()
mavenCentral()
}
}

val dokkaOutputDir = "$buildDir/dokka"
Expand Down Expand Up @@ -159,7 +162,15 @@ kotlin {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version")
}
}
val commonJVM = create("commonJVM") {
dependsOn(commonMain)
dependencies {
compileOnly("net.java.dev.jna:jna:$jna_version")
}
}

val jvmMain by getting {
dependsOn(commonJVM)
dependencies {
api("net.java.dev.jna:jna:$jna_version")
}
Expand All @@ -169,9 +180,12 @@ kotlin {
val nativeMain by getting
}
val androidMain by getting {
dependsOn(jvmMain)
dependsOn(commonJVM)
dependencies {
api("net.java.dev.jna:jna:$jna_version@aar")
implementation(project(":kaldi"))
implementation(project(":openfst"))
implementation(project(":openblas"))
}
}
val androidUnitTest by getting {
Expand All @@ -189,6 +203,12 @@ android {
defaultConfig {
minSdk = 24
targetSdk = 34
externalNativeBuild {
cmake {
cppFlags("")
arguments("-Wno-dev")
}
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
Expand All @@ -201,4 +221,11 @@ android {
allVariants()
}
}

externalNativeBuild {
cmake {
path("../CMakeLists.txt")
version = "3.22.1"
}
}
}
1 change: 1 addition & 0 deletions kotlin/clapack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
45 changes: 45 additions & 0 deletions kotlin/clapack/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins {
id("com.android.library")
}

android {
namespace = "page.doomsdayrs.libs.clapack"
compileSdk = 34

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
externalNativeBuild {
cmake {
arguments(
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY",
"-DCMAKE_CROSSCOMPILING=True",
"-DCMAKE_SYSTEM_NAME=Generic",
"-Wno-dev"
)
}
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
externalNativeBuild {
cmake {
path("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
Empty file.
21 changes: 21 additions & 0 deletions kotlin/clapack/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
4 changes: 4 additions & 0 deletions kotlin/clapack/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
1 change: 1 addition & 0 deletions kotlin/clapack/src/main/cpp
Submodule cpp added at 1cdd62
1 change: 1 addition & 0 deletions kotlin/kaldi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
53 changes: 53 additions & 0 deletions kotlin/kaldi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
plugins {
id("com.android.library")
}

android {
namespace = "page.doomsdayrs.libs.kaldi"
compileSdk = 34

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
externalNativeBuild {
cmake {
arguments(
"-DMATHLIB=OpenBLAS",
"-DBUILD_SHARED_LIBS=ON",

"-Wno-dev",
"-DKALDI_BUILD_EXE=OFF",
"-DKALDI_BUILD_TEST=OFF",
)
cppFlags("-O3", "-DFST_NO_DYNAMIC_LINKING")
}
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
externalNativeBuild {
cmake {
path("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

dependencies {
compileOnly(project(":openfst"))
compileOnly(project(":openblas"))
}
Empty file added kotlin/kaldi/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions kotlin/kaldi/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
4 changes: 4 additions & 0 deletions kotlin/kaldi/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
1 change: 1 addition & 0 deletions kotlin/kaldi/src/main/cpp
Submodule cpp added at b69207
1 change: 1 addition & 0 deletions kotlin/openblas/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
45 changes: 45 additions & 0 deletions kotlin/openblas/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins {
id("com.android.library")
}

android {
namespace = "page.doomsdayrs.libs.openblas"
compileSdk = 34

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
ndk {
abiFilters += "arm64-v8a"
abiFilters += "armeabi-v7a"
// TODO x86
}
externalNativeBuild {
cmake {
cppFlags("-marm", "-mfpu=vfp", "-mfloat-abi=softfp", "-Wno-dev")
}
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
externalNativeBuild {
cmake {
path("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
Empty file.
21 changes: 21 additions & 0 deletions kotlin/openblas/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
4 changes: 4 additions & 0 deletions kotlin/openblas/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
1 change: 1 addition & 0 deletions kotlin/openblas/src/main/cpp
Submodule cpp added at d2b11c
1 change: 1 addition & 0 deletions kotlin/openfst/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading