Skip to content

Commit

Permalink
Update publishing plugin and simplify gradle build
Browse files Browse the repository at this point in the history
  • Loading branch information
nshmyrev committed Mar 15, 2023
1 parent a40742b commit 9cee289
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 81 deletions.
64 changes: 26 additions & 38 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,50 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.24.0'
}
}

allprojects {
version = '0.3.46'
version = '0.3.47'
}

subprojects {

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'com.vanniktech.maven.publish'

plugins.withId('com.vanniktech.maven.publish') {
mavenPublish {
group = 'com.alphacephei'
version = version
sonatypeHost = 's01'
androidVariantToPublish = 'release'
}
}

repositories {
google()
mavenCentral()
}

publishing {
publications {
aar(MavenPublication) {
groupId 'com.alphacephei'
version version
pom {
url = 'http://www.alphacephei.com.com/vosk/'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'com.alphacephei'
name = 'Alpha Cephei Inc'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/alphacep/vosk-api.git'
url = 'https://github.com/alphacep/vosk-api/'
}
mavenPublishing {
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.S01, false)
signAllPublications()
}

mavenPublishing {
pom {
url = 'http://www.alphacephei.com.com/vosk/'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'com.alphacephei'
name = 'Alpha Cephei Inc'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/alphacep/vosk-api.git'
url = 'https://github.com/alphacep/vosk-api/'
}
}
}

}
36 changes: 10 additions & 26 deletions android/lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ def pomName = "Vosk Android"
def pomDescription = "Vosk speech recognition library for Android"

android {
compileSdkVersion 29
namespace 'org.vosk'
compileSdkVersion 33
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 6
targetSdkVersion 33
versionCode 10
versionName = version
archivesBaseName = archiveName
ndkVersion = "23.1.7779620"
ndkVersion = "25.2.9519653"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -29,27 +30,10 @@ dependencies {

//preBuild.dependsOn buildVosk

publishing {
publications {
aar(MavenPublication) {
artifactId = archiveName
artifact("$buildDir/outputs/aar/$archiveName-release.aar")
pom {
name = pomName
description = pomDescription
}
//generate pom nodes for dependencies
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each { dependency ->
if (dependency.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dependency.group)
dependencyNode.appendNode('artifactId', dependency.name)
dependencyNode.appendNode('version', dependency.version)
}
}
}
}
mavenPublishing {
coordinates("com.alphacephei", archiveName, version)
pom {
name = pomName
description = pomDescription
}
}
2 changes: 1 addition & 1 deletion android/lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.vosk">
<manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import android.media.MediaRecorder.AudioSource;
import android.os.Handler;
import android.os.Looper;
import android.annotation.SuppressLint;

import org.vosk.Recognizer;

import java.io.IOException;

/**
Expand All @@ -48,6 +48,7 @@ public class SpeechService {
*
* @throws IOException thrown if audio recorder can not be created for some reason.
*/
@SuppressLint("MissingPermission")
public SpeechService(Recognizer recognizer, float sampleRate) throws IOException {
this.recognizer = recognizer;
this.sampleRate = (int) sampleRate;
Expand Down
22 changes: 9 additions & 13 deletions android/model-en/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ def pomName = "Vosk English Model"
def pomDescription = "Small English model for Android"

android {
compileSdkVersion 29
namespace "org.vosk"
compileSdkVersion 33
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 6
targetSdkVersion 33
versionCode 10
versionName = version
archivesBaseName = archiveName
}
Expand All @@ -33,15 +34,10 @@ tasks.register('genUUID') {

preBuild.dependsOn(genUUID)

publishing {
publications {
aar(MavenPublication) {
artifactId = archiveName
artifact("$buildDir/outputs/aar/$archiveName-release.aar")
pom {
name = pomName
description = pomDescription
}
}
mavenPublishing {
coordinates("com.alphacephei", archiveName, version)
pom {
name = pomName
description = pomDescription
}
}
3 changes: 1 addition & 2 deletions android/model-en/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.vosk.model.en">
<manifest>
</manifest>

0 comments on commit 9cee289

Please sign in to comment.