Skip to content

Commit

Permalink
fix #47: updated Gradle to 6.5 and AGP to 4.1.3. Implemented maven ce…
Browse files Browse the repository at this point in the history
…ntral publishing support. Dropped Bintray.
  • Loading branch information
gotev committed Apr 17, 2021
1 parent e495c38 commit 5f0fd11
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 130 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Android Speech [ ![Download](https://api.bintray.com/packages/gotev/maven/android-speech/images/download.svg) ](https://bintray.com/gotev/maven/android-speech/_latestVersion) [ ![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.gotev/speech/badge.svg) ](https://search.maven.org/search?q=g:net.gotev)
# Android Speech [ ![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.gotev/speech/badge.svg) ](https://search.maven.org/search?q=g:net.gotev)

Android speech recognition and text to speech made easy.

Expand All @@ -7,7 +7,7 @@ Android speech recognition and text to speech made easy.
```groovy
implementation 'net.gotev:speech:x.y.z'
```
Replace `x.y.z` with [![Download](https://api.bintray.com/packages/gotev/maven/android-speech/images/download.svg) ](https://bintray.com/gotev/maven/android-speech/_latestVersion)
Replace `x.y.z` with [ ![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.gotev/speech/badge.svg) ](https://search.maven.org/search?q=g:net.gotev)

## Initialization
To start using the library, you have to initialize it in your Activity
Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:$gradle_version"
classpath "com.github.ben-manes:gradle-versions-plugin:$gradle_versions_plugin_version"
classpath "com.github.dcendents:android-maven-gradle-plugin:$maven_gradle_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_plugin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 0 additions & 2 deletions examples/demoapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ buildscript {

//classpath dependencies to import library project
classpath "com.github.ben-manes:gradle-versions-plugin:$gradle_versions_plugin_version"
classpath "com.github.dcendents:android-maven-gradle-plugin:$maven_gradle_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_plugin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion examples/demoapp/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
16 changes: 7 additions & 9 deletions manifest.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
ext {
mavRepoInternalUrl = System.getenv('LOCAL_MAVEN_URL')

github_username = 'gotev'
github_repository_name = 'android-speech'

maintainer = 'Aleksandar Gotev'

library_description = 'Android speech recognition and text to speech made easy'
library_keywords = ['android', 'speech', 'library', 'text', 'voice', 'recognition', 'text to speech']
library_licenses = ["Apache-2.0"]
library_licenses_url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
library_project_group = 'net.gotev'
library_version = '1.6.1'
version_code = 1
library_version = '1.6.2'
version_code = 2
min_sdk = 18
target_sdk = 30
demo_app_id = 'net.gotev.speechdemo'

// Gradle classpath dependencies versions
kotlin_version = '1.3.10'
gradle_version = '4.0.0'
maven_gradle_version = '2.1'
gradle_versions_plugin_version = '0.20.0'
bintray_plugin_version = '1.7'
kotlin_version = '1.4.10'
gradle_version = '4.1.3'
gradle_versions_plugin_version = '0.28.0'

// Library and app testing dependencies versions
junit_version = '4.12'
Expand Down
31 changes: 24 additions & 7 deletions release
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
#!/bin/bash -e

cd examples/demoapp
./gradlew clean assembleDebug
cp app/build/outputs/apk/debug/app-debug.apk ../../speech-demo-debug.apk
cd ../..
if [ "x$1" == "xlocal" ]
then
echo "Local release..."
export LOCAL_MAVEN_URL="file://$(pwd)/releases"
mkdir -p releases
./gradlew clean test publish -PmavPublishToInternalRepo=true
version=$(cat manifest.gradle | grep library_version | awk '{print $3}' | tr "'" "\n" | head -n 2 | tail -n 1)
echo "released local version $version"
else
echo "Releasing on Maven Central ..."
./gradlew clean test publish -PmavSigning=true -PmavPublishToRemoteRepo=true --max-workers 1

./gradlew :speech:clean :speech:bintrayUpload
echo "Generating Demo Apk ..."
cd examples/demoapp
./gradlew clean assembleDebug
cp app/build/outputs/apk/debug/app-debug.apk ../../speech-demo-debug.apk
cd ../..

version=$(cat manifest.gradle | grep "library_version" | tr "'" '\n' | head -n 2 | tail -n 1)
hub release create -a speech-demo-debug.apk -m "$version" "$version"
echo "Creating GitHub Release ..."
version=$(cat manifest.gradle | grep "library_version" | tr "'" '\n' | head -n 2 | tail -n 1)
hub release create -a speech-demo-debug.apk -m "$version" "$version"

echo
echo "Done!"
echo "Visit https://oss.sonatype.org/#stagingRepositories and confirm the release"
fi
113 changes: 11 additions & 102 deletions speech/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.ben-manes.versions'

// start - do not modify this if your project is on github
def siteUrl = "https://github.com/${github_username}/${github_repository_name}"
def gitUrl = siteUrl + '.git'
def bugTrackerUrl = siteUrl + '/issues/'
def projectName = github_repository_name
project.ext {
mavDevelopers = [(github_username): (maintainer)]
mavSiteUrl = "https://github.com/${github_username}/${github_repository_name}"
mavGitUrl = mavSiteUrl + '.git'
bugTrackerUrl = mavSiteUrl + '/issues/'
mavProjectName = "speech"
mavLibraryLicenses = ["Apache-2.0": 'http://www.apache.org/licenses/LICENSE-2.0.txt']
mavLibraryDescription = "Android speech recognition and text to speech made easy"
mavVersion = library_version
}
// end - do not modify this if your project is on github

group = library_project_group
Expand Down Expand Up @@ -61,99 +65,4 @@ dependencies {
androidTestImplementation "androidx.test.espresso:espresso-core:$androidx_test_espresso_version"
}

// add the following information to the file: local.properties situated in the parent directory of
// where this file is:
//
// bintray.user=gotev
// bintray.apikey=api key got from the bintray profile
//
// be sure to add local.properties to the .gitignore!

Properties properties = new Properties()
if (project.rootProject.file("local.properties").exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}

install {
repositories.mavenInstaller {
pom.project {
name projectName
description library_description
packaging 'aar'
groupId library_project_group
version version
url siteUrl
licenses {
license {
name library_licenses[0]
url library_licenses_url
}
}
developers {
developer {
id properties.getProperty("bintray.user")
name maintainer
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl

}
}
}
}

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
name = projectName
desc = library_description
websiteUrl = siteUrl
vcsUrl = gitUrl
issueTrackerUrl = bugTrackerUrl
licenses = library_licenses
labels = library_keywords
publicDownloadNumbers = true
publish = true
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
excludes = ['**/*.kt'] // < ---- Exclude all kotlin files from javadoc file.

title = "$projectName $project.version API"
description "Generates Javadoc"
source = android.sourceSets.main.java.srcDirs
classpath += files(android.bootClasspath)
exclude '**/BuildConfig.java', '**/R.java'
options {
windowTitle("$projectName $project.version Reference")
locale = 'en_US'
encoding = 'UTF-8'
charSet = 'UTF-8'
links("http://docs.oracle.com/javase/7/docs/api/");
linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
setMemberLevel(JavadocMemberLevel.PUBLIC)
addStringOption('Xdoclint:none', '-quiet')
}
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}
apply from: 'https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/master/gradle-mavenizer.gradle'
8 changes: 4 additions & 4 deletions speech/src/main/java/net/gotev/speech/Speech.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ public void onReceive(Context context, Intent intent) {

/**
* Gets the list of the supported Text to Speech languages on this device
* @return list of locales on android API >= 23 and empty list on lower Android, because native
* TTS engine does not support querying voices on API < 23. Officially it's declared that
* @return list of locales on android API 23 and newer and empty list on lower Android, because native
* TTS engine does not support querying voices on API lower than 23. Officially it's declared that
* query voices support started on API 21, but in reality it started from 23.
* If still skeptic about this, search the web and try on your own.
*/
Expand All @@ -397,8 +397,8 @@ public Locale getSpeechToTextLanguage() {

/**
* Gets the current voice used for text to speech.
* @return current voice on android API >= 23 and null on lower Android, because native
* TTS engine does not support querying voices on API < 23. Officially it's declared that
* @return current voice on android API 23 or newer and null on lower Android, because native
* TTS engine does not support querying voices on API lower than 23. Officially it's declared that
* query voices support started on API 21, but in reality it started from 23.
* If still skeptic about this, search the web and try on your own.
*/
Expand Down

0 comments on commit 5f0fd11

Please sign in to comment.