diff --git a/.github/workflows/Android-CI-Espresso.yml b/.github/workflows/Android-CI-Espresso.yml new file mode 100644 index 0000000..d3cc770 --- /dev/null +++ b/.github/workflows/Android-CI-Espresso.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + name: Build JDK ${{ matrix.java_version }} + runs-on: macOS-latest + strategy: + matrix: + java_version: [ 11 ] + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + - name: Install JDK ${{ matrix.java_version }} + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: ${{ matrix.java_version }} + - name: Install Android SDK + uses: malinskiy/action-android/install-sdk@release/0.1.2 + - name: Build project + run: ./gradlew assemble + - name: Run tests + run: ./gradlew test + - name: Checks + run: ./gradlew check + - name: Archive Lint report + uses: actions/upload-artifact@v2.2.4 + with: + name: Lint-report + path: app/build/reports/lint-results.html +# Espresso: +# name: Espresso ${{ matrix.java_version }} +# runs-on: macOS-latest +# strategy: +# matrix: +# java_version: [ 11 ] +# steps: +# - name: Checkout +# uses: actions/checkout@v2.3.4 +# - name: Install JDK ${{ matrix.java_version }} +# uses: actions/setup-java@v2 +# with: +# distribution: 'adopt' +# java-version: ${{ matrix.java_version }} +# - name: Install Android SDK +# uses: malinskiy/action-android/install-sdk@release/0.1.2 +# - name: Run instrumentation tests +# uses: malinskiy/action-android/emulator-run-cmd@release/0.1.2 +# with: +# cmd: ./gradlew cAT --continue +# api: 28 +# tag: default +# abi: x86 +# - name: Archive Espresso results +# uses: actions/upload-artifact@v2.2.4 +# with: +# name: Espresso-report +# path: app/build/reports/androidTests/connected + diff --git a/.github/workflows/Android-CI-release.yml b/.github/workflows/Android-CI-release.yml new file mode 100644 index 0000000..6784fe5 --- /dev/null +++ b/.github/workflows/Android-CI-release.yml @@ -0,0 +1,56 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + build: + name: Publish aar + runs-on: macOS-latest + strategy: + matrix: + java_version: [ 11 ] + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + - name: Show tags + run: git tag -n + - name: Install JDK ${{ matrix.java_version }} + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: ${{ matrix.java_version }} + - name: Install Android SDK + uses: malinskiy/action-android/install-sdk@release/0.1.2 + - name: Build project + run: ./gradlew clean assembleRelease + env: + TAG_VERSION: ${{ github.ref }} + - name: Search for aar file + run: echo "AAR_RELASE_FILE=$(find . -name *release.aar | head -n 1)" >> $GITHUB_ENV + - name: Search for AAR release name + run: echo "AAR_RELASE_NAME=$(find . -name *release.aar | head -n 1 | xargs basename)" >> $GITHUB_ENV + - name: Create Release + id: create_release + uses: actions/create-release@v1.1.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ${{ env.AAR_RELASE_FILE }} + asset_name: ${{ env.AAR_RELASE_NAME }} + asset_content_type: application/zip diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml new file mode 100644 index 0000000..4da7a7c --- /dev/null +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -0,0 +1,10 @@ +name: "Validate Gradle Wrapper" +on: [push] + +jobs: + validation: + name: "Validation" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - uses: gradle/wrapper-validation-action@v1.0.4 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 963e97c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: android -android: - update_sdk: true - components: - - platform-tools - - tools - - # The BuildTools version used by your project - - build-tools-20.0.0 - - # The SDK version used to compile your project - - android-16 - - android-L - - - sys-img-x86-android-16 - - sys-img-armeabi-v7a-android-16 - -script: - - ./runTests.sh || exit 1 diff --git a/FFmpegAndroid/build.gradle b/FFmpegAndroid/build.gradle index c6178c7..e7d1d1b 100644 --- a/FFmpegAndroid/build.gradle +++ b/FFmpegAndroid/build.gradle @@ -1,13 +1,7 @@ apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' -apply plugin: "com.jfrog.bintray" - -// This is the library version used when deploying the artifact -version = VERSION_NAME android { compileSdkVersion rootProject.ext.compileSdkVersion as Integer - buildToolsVersion rootProject.ext.buildToolsVersion as String defaultConfig { minSdkVersion rootProject.ext.minSdkVersion as Integer @@ -31,97 +25,7 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - - androidTestCompile 'com.squareup.assertj:assertj-android:1.0.0' -} - -group = GROUP - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging POM_PACKAGING - - // Add your description here - name 'FFmpeg Android' - description = POM_DESCRIPTION - url POM_URL - - // Set your license - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - } - } - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - email 'hitesh@writingminds.com' - } - } - scm { - connection POM_SCM_URL - developerConnection POM_SCM_URL - url POM_URL - - } - } - } - } -} + implementation fileTree(dir: 'libs', include: ['*.jar']) -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} -artifacts { - archives javadocJar - archives sourcesJar -} - -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -// https://github.com/bintray/gradle-bintray-plugin -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - - configurations = ['archives'] - pkg { - repo = "maven" - // it is the name that appears in bintray when logged - name = "ffmpeg-android" - websiteUrl = POM_URL - vcsUrl = POM_SCM_URL - licenses = ["GPL-3.0"] - publish = true - version { - gpg { - sign = true - passphrase = properties.getProperty("bintray.gpg.password") - } - mavenCentralSync { - sync = true - user = properties.getProperty("bintray.oss.user") //OSS user token - password = properties.getProperty("bintray.oss.password") //OSS user password - close = '1' - } - } - } + androidTestImplementation 'com.squareup.assertj:assertj-android:1.0.0' } diff --git a/app/build.gradle b/app/build.gradle index f6d48ab..2500aaf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,8 +1,9 @@ -apply plugin: 'com.android.application' +plugins { + id 'com.android.application' +} android { compileSdkVersion rootProject.ext.compileSdkVersion as Integer - buildToolsVersion rootProject.ext.buildToolsVersion as String defaultConfig { applicationId "com.github.hiteshsondhi88.sampleffmpeg" @@ -31,10 +32,8 @@ android { } dependencies { - compile 'com.squareup.dagger:dagger-compiler:1.2.2' - compile 'com.squareup.dagger:dagger:1.2.2' - compile 'com.jakewharton:butterknife:5.1.2' - compile fileTree(dir: 'libs', include: ['*.jar']) - androidTestCompile 'com.squareup.assertj:assertj-android:1.0.0' - compile project(':FFmpegAndroid') + implementation 'com.jakewharton:butterknife:5.1.2' + implementation fileTree(dir: 'libs', include: ['*.jar']) + androidTestImplementation 'com.squareup.assertj:assertj-android:1.0.0' + implementation project(':FFmpegAndroid') } diff --git a/app/src/androidTest/java/com/github/hiteshsondhi88/sampleffmpeg/FFmpegInstrumentationTest.java b/app/src/androidTest/java/com/github/hiteshsondhi88/sampleffmpeg/FFmpegInstrumentationTest.java index 7b9f160..b5ed40b 100644 --- a/app/src/androidTest/java/com/github/hiteshsondhi88/sampleffmpeg/FFmpegInstrumentationTest.java +++ b/app/src/androidTest/java/com/github/hiteshsondhi88/sampleffmpeg/FFmpegInstrumentationTest.java @@ -1,13 +1,12 @@ package com.github.hiteshsondhi88.sampleffmpeg; +import android.app.Instrumentation; import android.os.Environment; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; import java.io.File; -import javax.inject.Inject; - import com.github.hiteshsondhi88.libffmpeg.FFmpeg; import com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler; import com.github.hiteshsondhi88.libffmpeg.FFmpegLoadBinaryResponseHandler; @@ -19,7 +18,6 @@ public class FFmpegInstrumentationTest extends ActivityInstrumentationTestCase2< private static final String TAG = FFmpegInstrumentationTest.class.getSimpleName(); - @Inject FFmpeg ffmpeg; public FFmpegInstrumentationTest() { @@ -30,6 +28,7 @@ public FFmpegInstrumentationTest() { protected void setUp() throws Exception { super.setUp(); assertNotNull(getActivity()); + ffmpeg = FFmpeg.getInstance(new Instrumentation().getContext()); ffmpeg = getActivity().ffmpeg; assertNotNull(ffmpeg); ffmpeg.loadBinary(new FFmpegLoadBinaryResponseHandler() { @@ -123,21 +122,23 @@ public void testFFmpegAVItoMP4Usingx264() { public void testLibass() { File outass = new File(getFFmpegFilesDir(), "output.ass"); - checkFFmpegCommon("-y -i "+getSrtSampleFile()+" "+outass.getAbsolutePath(), outass); + checkFFmpegCommon("-y -i " + getSrtSampleFile() + " " + outass.getAbsolutePath(), outass); } private void checkFFmpegConvertUsingx264(File inputFile, File outputFile) { - checkFFmpegCommon("-y -i "+inputFile.getAbsolutePath()+" -c:v libx264 -preset ultrafast "+outputFile.getAbsolutePath(), outputFile); + checkFFmpegCommon("-y -i " + inputFile.getAbsolutePath() + " -c:v libx264 -preset ultrafast " + outputFile.getAbsolutePath(), outputFile); } private void checkFFmpegConvertCommon(File inputFile, File outputFile) { - checkFFmpegCommon("-y -i "+inputFile.getAbsolutePath()+" "+outputFile.getAbsolutePath(), outputFile); + checkFFmpegCommon("-y -i " + inputFile.getAbsolutePath() + " " + outputFile.getAbsolutePath(), outputFile); } private void checkFFmpegCommon(final String cmd, final File outputFile) { - Log.d(TAG, "start : "+outputFile.getAbsolutePath()); + Log.d(TAG, "start : " + outputFile.getAbsolutePath()); try { - ffmpeg.execute(cmd, new FFmpegExecuteResponseHandler() { + String[] array = new String[1]; + array[0] = cmd; + ffmpeg.execute(array, new FFmpegExecuteResponseHandler() { @Override public void onStart() { @@ -146,7 +147,7 @@ public void onStart() { @Override public void onProgress(String message) { - Log.d(TAG, "progress : "+message); + Log.d(TAG, "progress : " + message); } @Override @@ -161,7 +162,7 @@ public void onSuccess(String message) { @Override public void onFinish() { - Log.d(TAG, "done : "+outputFile.getAbsolutePath()); + Log.d(TAG, "done : " + outputFile.getAbsolutePath()); synchronized (FFmpegInstrumentationTest.this) { FFmpegInstrumentationTest.this.notify(); } diff --git a/app/src/main/java/com/github/hiteshsondhi88/sampleffmpeg/DaggerDependencyModule.java b/app/src/main/java/com/github/hiteshsondhi88/sampleffmpeg/DaggerDependencyModule.java deleted file mode 100644 index 1807ede..0000000 --- a/app/src/main/java/com/github/hiteshsondhi88/sampleffmpeg/DaggerDependencyModule.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.github.hiteshsondhi88.sampleffmpeg; - -import android.content.Context; - -import javax.inject.Singleton; - -import dagger.Module; -import dagger.Provides; -import com.github.hiteshsondhi88.libffmpeg.FFmpeg; - -@Module( - injects = Home.class -) -@SuppressWarnings("unused") -public class DaggerDependencyModule { - - private final Context context; - - DaggerDependencyModule(Context context) { - this.context = context; - } - - @Provides @Singleton - FFmpeg provideFFmpeg() { - return FFmpeg.getInstance(context.getApplicationContext()); - } - -} diff --git a/app/src/main/java/com/github/hiteshsondhi88/sampleffmpeg/Home.java b/app/src/main/java/com/github/hiteshsondhi88/sampleffmpeg/Home.java index 4568f6f..210f20f 100644 --- a/app/src/main/java/com/github/hiteshsondhi88/sampleffmpeg/Home.java +++ b/app/src/main/java/com/github/hiteshsondhi88/sampleffmpeg/Home.java @@ -14,11 +14,8 @@ import android.widget.TextView; import android.widget.Toast; -import javax.inject.Inject; - import butterknife.ButterKnife; import butterknife.InjectView; -import dagger.ObjectGraph; import com.github.hiteshsondhi88.libffmpeg.ExecuteBinaryResponseHandler; import com.github.hiteshsondhi88.libffmpeg.FFmpeg; @@ -30,8 +27,7 @@ public class Home extends Activity implements View.OnClickListener { private static final String TAG = Home.class.getSimpleName(); - @Inject - FFmpeg ffmpeg; + public FFmpeg ffmpeg; @InjectView(R.id.command) EditText commandEditText; @@ -49,7 +45,6 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); ButterKnife.inject(this); - ObjectGraph.create(new DaggerDependencyModule(this)).inject(this); loadFFMpegBinary(); initUI(); @@ -64,6 +59,7 @@ private void initUI() { private void loadFFMpegBinary() { try { + FFmpeg ffmpeg = FFmpeg.getInstance(getApplicationContext()); ffmpeg.loadBinary(new LoadBinaryResponseHandler() { @Override public void onFailure() { @@ -80,19 +76,19 @@ private void execFFmpegBinary(final String[] command) { ffmpeg.execute(command, new ExecuteBinaryResponseHandler() { @Override public void onFailure(String s) { - addTextViewToLayout("FAILED with output : "+s); + addTextViewToLayout("FAILED with output : " + s); } @Override public void onSuccess(String s) { - addTextViewToLayout("SUCCESS with output : "+s); + addTextViewToLayout("SUCCESS with output : " + s); } @Override public void onProgress(String s) { - Log.d(TAG, "Started command : ffmpeg "+command); - addTextViewToLayout("progress : "+s); - progressDialog.setMessage("Processing\n"+s); + Log.d(TAG, "Started command : ffmpeg " + command); + addTextViewToLayout("progress : " + s); + progressDialog.setMessage("Processing\n" + s); } @Override @@ -106,7 +102,7 @@ public void onStart() { @Override public void onFinish() { - Log.d(TAG, "Finished command : ffmpeg "+command); + Log.d(TAG, "Finished command : ffmpeg " + command); progressDialog.dismiss(); } }); diff --git a/build.gradle b/build.gradle index 939b683..a4326a9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,28 +1,26 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { repositories { jcenter() + google() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.0-beta3' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' - classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath 'com.android.tools.build:gradle:7.0.0' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' } } allprojects { repositories { jcenter() + google() + mavenCentral() + maven { url 'https://jitpack.io' } } } ext { compileSdkVersion = 22 - buildToolsVersion = '22.0.1' targetSdkVersion = 22 minSdkVersion = 16 versionCode = 28 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 8c0fb64..7454180 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5acddb1..05679dc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Apr 20 11:52:28 GMT+05:30 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/gradlew b/gradlew index 91a7e26..744e882 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -37,36 +72,17 @@ case "`uname`" in Darwin* ) darwin=true ;; - MINGW* ) + MSYS* | MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -90,7 +106,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -110,11 +126,13 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` SEP="" @@ -138,27 +156,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec9973..ac1b06f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,20 +24,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/runTests.sh b/runTests.sh deleted file mode 100755 index 31cacbe..0000000 --- a/runTests.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -function run_test() { - abi=$1 - api_level=$2 - emulator_name="test_${abi}_${api_level}" - echo "===============================================" - echo " Starting Tests for ${emulator_name} " - echo "===============================================" - echo no | android create avd -c 50M --force -n ${emulator_name} -t ${api_level} --abi ${abi} - emulator -partition-size 256 -avd ${emulator_name} -no-skin -no-boot-anim -no-audio -no-window -gpu on & - EMU_PID=$! - ./wait_for_emulator || exit 1 - adb logcat -v time -s FFmpegInstrumentationTest & - LOGCAT_PID=$! - # Running Tests - ./gradlew --info build connectedCheck || exit 1 - - # Killing emulator - kill -9 $EMU_PID $LOGCAT_PID - - # delete emulator - sleep 5 # wait for emulator to get killed - android delete avd -n ${emulator_name} # delete emulator - echo "===============================================" - echo " Finished Tests for ${emulator_name} " - echo "===============================================" -} - -# x86 android-16 -run_test x86 android-16 - -# armeabi-v7a android-16 -run_test armeabi-v7a android-16 diff --git a/settings.gradle b/settings.gradle index 5e63c01..6afd14a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,2 @@ -include ':app', ':FFmpegAndroid' +include ':app' +include ':FFmpegAndroid' diff --git a/wait_for_emulator b/wait_for_emulator deleted file mode 100755 index b5bc384..0000000 --- a/wait_for_emulator +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Originally written by Ralf Kistner , but placed in the public domain -EMU_SERIAL=$1 -ADB_CMD='adb' -if [ -n "$EMU_SERIAL" ]; then - ADB_CMD="adb -s $EMU_SERIAL" -fi -set +e - -bootanim="" -failcounter=0 -until [[ "$bootanim" =~ "stopped" ]]; do - bootanim=`$ADB_CMD -e shell getprop init.svc.bootanim 2>&1` - echo "$bootanim" - if [[ "$bootanim" =~ "not found" ]]; then - let "failcounter += 1" - sleep 5 - if [[ $failcounter -gt 15 ]]; then - echo "Failed to start emulator" - exit 1 - fi - fi - sleep 1 -done -echo "Done"