Skip to content

Commit

Permalink
v3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench authored Dec 12, 2018
2 parents d24fde9 + dd40c04 commit 7e985dd
Show file tree
Hide file tree
Showing 13 changed files with 218 additions and 77 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
## 3.X.X (TBD)
## 3.6.0 (2018-12-12)

### Bug fixes
* Support automatic upload when building App Bundles
[#137](https://github.com/bugsnag/bugsnag-android-gradle-plugin/pull/137)

* Manually calculate location of objdump in gradle plugin
[#136](https://github.com/bugsnag/bugsnag-android-gradle-plugin/pull/136)

### Bug fixes

* Create tasks for debug variant which are not run by default
[#139](https://github.com/bugsnag/bugsnag-android-gradle-plugin/pull/139)

## 3.5.0 (2018-10-18)

### Bug fixes
Expand Down
71 changes: 71 additions & 0 deletions features/app_bundle.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Feature: Generating Android app bundles

Scenario: Single-module default app bundles successfully
When I bundle "default_app" using the "standard" bugsnag config
Then I should receive 2 requests

And the request 0 is valid for the Build API
And the payload field "appVersion" equals "1.0" for request 0
And the payload field "apiKey" equals "TEST_API_KEY" for request 0
And the payload field "builderName" is not null for request 0
And the payload field "buildTool" equals "gradle-android" for request 0
And the payload field "appVersionCode" equals "1" for request 0
And the payload field "sourceControl.provider" equals "github" for request 0
And the payload field "sourceControl.repository" equals "https://github.com/bugsnag/bugsnag-android-gradle-plugin.git" for request 0
And the payload field "sourceControl.revision" is not null for request 0

And the payload field "metadata.os_arch" is not null for request 0
And the payload field "metadata.os_name" is not null for request 0
And the payload field "metadata.os_version" is not null for request 0
And the payload field "metadata.java_version" is not null for request 0
And the payload field "metadata.gradle_version" is not null for request 0
And the payload field "metadata.git_version" is not null for request 0

And the request 1 is valid for the Android Mapping API
And the field "apiKey" for multipart request 1 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 1 equals "1"
And the field "versionName" for multipart request 1 equals "1.0"
And the field "appId" for multipart request 1 equals "com.bugsnag.android.example"
And the field "overwrite" for multipart request 1 is null

Scenario: Bundling multiple flavors automatically
When I bundle "flavors" using the "standard" bugsnag config
Then I should receive 4 requests

And the request 0 is valid for the Build API
And the payload field "appVersion" equals "1.0" for request 0
And the payload field "apiKey" equals "TEST_API_KEY" for request 0
And the payload field "appVersionCode" equals "1" for request 0

And the request 1 is valid for the Build API
And the payload field "appVersion" equals "1.0" for request 1
And the payload field "apiKey" equals "TEST_API_KEY" for request 1
And the payload field "appVersionCode" equals "1" for request 1

And the request 2 is valid for the Android Mapping API
And the field "apiKey" for multipart request 2 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 2 equals "1"
And the field "versionName" for multipart request 2 equals "1.0"
And the field "appId" for multipart request 2 equals "com.bugsnag.android.example.bar"

And the request 3 is valid for the Android Mapping API
And the field "apiKey" for multipart request 3 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 3 equals "1"
And the field "versionName" for multipart request 3 equals "1.0"
And the field "appId" for multipart request 3 equals "com.bugsnag.android.example.foo"

Scenario: Bundling single flavor
When I bundle the "Foo" variantOutput for "flavors" using the "standard" bugsnag config
Then I should receive 2 requests

And the request 0 is valid for the Build API

And the request 1 is valid for the Android Mapping API
And the field "apiKey" for multipart request 1 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 1 equals "1"
And the field "versionName" for multipart request 1 equals "1.0"
And the field "appId" for multipart request 1 equals "com.bugsnag.android.example.foo"

Scenario: Auto upload disabled
When I bundle "default_app" using the "all_disabled" bugsnag config
Then I should receive no requests
2 changes: 1 addition & 1 deletion features/fixtures/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

Expand Down
Binary file modified features/fixtures/app/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Wed Mar 14 16:38:05 GMT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
72 changes: 42 additions & 30 deletions features/fixtures/app/gradlew
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# 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=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# 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

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -85,7 +89,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
Expand Down Expand Up @@ -150,11 +154,19 @@ if $cygwin ; then
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"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
14 changes: 4 additions & 10 deletions features/fixtures/app/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@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 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=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows 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.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'com.android.application'
apply from: 'config/android/common.gradle'

ext.abiCodes = ['arm64-v8a':2, armeabi:3, 'armeabi-v7a':4, mips:5, mips64:6, x86:7, 'x86_64':8]
ext.abiCodes = ['arm64-v8a':2, 'armeabi':3, 'armeabi-v7a':4, 'mips':5, 'mips64':6, 'x86':7, 'x86_64':8]

android {
splits {
abi {
reset()
enable true
universalApk true
include 'arm64-v8a', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'x86', 'x86_64'
}
}

Expand Down
4 changes: 4 additions & 0 deletions features/scripts/bundle_one_flavor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

cd features/fixtures/app
./gradlew :module:clean :module:bundleFoo --stacktrace
14 changes: 14 additions & 0 deletions features/scripts/bundle_project_module.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# Alter git remote origin url in case protocol differs
PREV_REMOTE=`git config --get remote.origin.url`
git config --replace-all remote.origin.url "https://github.com/bugsnag/bugsnag-android-gradle-plugin.git"

function resetGitConfig {
git config --replace-all remote.origin.url $PREV_REMOTE
}

trap resetGitConfig EXIT

cd features/fixtures/app
./gradlew :module:clean :module:bundle --stacktrace
19 changes: 19 additions & 0 deletions features/steps/gradle_plugin_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@
}
end

When("I bundle {string} using the {string} bugsnag config") do |module_config, bugsnag_config|
steps %Q{
When I set environment variable "MODULE_CONFIG" to "#{module_config}"
When I set environment variable "BUGSNAG_CONFIG" to "#{bugsnag_config}"
And I run the script "features/scripts/bundle_project_module.sh" synchronously
And I wait for 1 second
}
end

When("I bundle the {string} variantOutput for {string} using the {string} bugsnag config") do |variant, module_config, bugsnag_config|
steps %Q{
When I set environment variable "VARIANT_OUTPUT_NAME" to "#{variant}"
When I set environment variable "MODULE_CONFIG" to "#{module_config}"
When I set environment variable "BUGSNAG_CONFIG" to "#{bugsnag_config}"
And I run the script "features/scripts/bundle_one_flavor.sh" synchronously
And I wait for 1 second
}
end

When("I build the React Native app") do
steps %Q{
And I run the script "features/scripts/build_react_native_app.sh" synchronously
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = com.bugsnag
version = 3.5.0
version = 3.6.0

ANDROID_MIN_SDK_VERSION=14
ANDROID_TARGET_SDK_VERSION=27
Expand Down
Loading

0 comments on commit 7e985dd

Please sign in to comment.