Skip to content

Commit

Permalink
Merge cb9c851 into 67ed8eb
Browse files Browse the repository at this point in the history
  • Loading branch information
kattrali committed Sep 19, 2018
2 parents 67ed8eb + cb9c851 commit da20d76
Show file tree
Hide file tree
Showing 190 changed files with 10,867 additions and 585 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ proguard/
# Javadoc
docs/
infer-out/

# Native build files
.externalNativeBuild
CMakeFiles
CMakeCache.txt
Testing
bugsnag_test
*.crash
165 changes: 117 additions & 48 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,131 @@
sudo: false
language: android

android:
components:
- tools
- platform-tools
- build-tools-27.0.0
- android-16
- android-19
- android-21
- android-27
- extra-android-m2repository
- sys-img-armeabi-v7a-android-16
- sys-img-armeabi-v7a-android-19
- sys-img-armeabi-v7a-android-21

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
jdk:
- oraclejdk8

env:
matrix:
- ANDROID_TARGET=android-16 ANDROID_ABI=armeabi-v7a
- ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
- ANDROID_TARGET=android-21 ANDROID_ABI=armeabi-v7a
global:
- ADB_INSTALL_TIMEOUT=5 # increase from default of 2 mins
- ADB_INSTALL_TIMEOUT=4
- ANDROID_EMULATOR=test # default emulator name (used in tests)
- ANDROID_ABI=armeabi-v7a
- ANDROID_TARGET=android-21
- NDK_VERSION=r16b
- EMULATOR_FLAVOR=default
- ANDROID_HOME=/usr/local/android-sdk
- TOOLS=${ANDROID_HOME}/tools
# Set the path to ensure that the right version of `emulator` (among
# other things) is called!
- PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
- QEMU_AUDIO_DRV=none # Prevents some fatal audio issues on API 24+
- MAZE_WAIT_TIME=18
- MAZE_TAGS="not @skip"

android:
components:
- tools
# See https://github.com/travis-ci/travis-ci/issues/8874
- android-27
- extra-google-m2repository

# see https://github.com/travis-ci/travis-ci/issues/8874
before_install:
- yes | sdkmanager "platforms;android-27"
- bundle install >/dev/null
- ./scripts/install-ndk.sh
- env

install:
# Installs tools a second time to get newer versions. Without this,
# you get old packages and there's no avdmanager. It doesn't work to
# put it in the components list a second time, though it used to work
# and its documented on Travis as how you get newer packages.
- echo y | sdkmanager "platform-tools" >/dev/null
- echo y | sdkmanager "tools" >/dev/null
- echo y | sdkmanager "build-tools;27.0.0" >/dev/null
- echo y | sdkmanager "platforms;$ANDROID_TARGET" >/dev/null
- echo y | sdkmanager "system-images;$ANDROID_TARGET;$EMULATOR_FLAVOR;$ANDROID_ABI" >/dev/null
- echo no | avdmanager create avd --force -n test -k "system-images;$ANDROID_TARGET;$EMULATOR_FLAVOR;$ANDROID_ABI" -c 10M

before_script:
# Create and start emulator
- android list targets
- jdk_switcher use oraclejdk8
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &
- adb wait-for-device
- while [[ `adb shell pm path android` == 'Error'* ]]; do sleep 2; done
- adb shell input keyevent 82 &
- emulator -avd test $EMULATOR_FLAGS -engine classic -no-window -camera-back none -camera-front none -selinux permissive &
- android-wait-for-emulator
- adb shell input keyevent 82 &

script:
- ./gradlew lint checkstyle createDebugCoverageReport coveralls
- cd examples/sdk-app-example && ../../gradlew lint checkstyle connectedCheck
- bundle exec bugsnag-maze-runner --format progress --color --tags "$MAZE_TAGS" $MAZE_ARGS features/native*.feature

sudo: false
jobs:
include:
- stage: lint
script: ./gradlew lint checkstyle
# Run SDK unit tests against API 16:
- stage: unit tests
script: ./gradlew sdk:createDebugCoverageReport coveralls
env:
- ANDROID_TARGET=android-16
# Run NDK and SDK unit tests against different NDK revisions:
- stage: unit tests
script: ./gradlew createDebugCoverageReport coveralls || (adb logcat -v brief -d '*:S BugsnagNDKTest' && false)
env: NDK_VERSION=r12b
- stage: unit tests
script: ./gradlew createDebugCoverageReport coveralls || (adb logcat -v brief -d '*:S BugsnagNDKTest' && false)
env: NDK_VERSION=r14b
- stage: unit tests
script: ./gradlew createDebugCoverageReport coveralls || (adb logcat -v brief -d '*:S BugsnagNDKTest' && false)
env: NDK_VERSION=r16b
# Emulators for API 22,23,25 just don't boot ¯\_(ツ)_/¯
# Emulators for API 14,15,26 hang regularly
# There are no images for API 20
# There's no emulators for x86 because we can't run x86 on Travis
- stage: end-to-end tests
env:
- ANDROID_TARGET=android-24
- stage: end-to-end tests
env:
- ANDROID_TARGET=android-21
- stage: end-to-end tests
env:
- ANDROID_TARGET=android-19
- stage: end-to-end tests
env:
- ANDROID_TARGET=android-18
- EMULATOR_FLAGS=-no-audio
- MAZE_ARGS=--verbose
- MAZE_WAIT_TIME=20
- stage: end-to-end tests
env:
- ANDROID_TARGET=android-17
- EMULATOR_FLAGS=-no-audio
- MAZE_TAGS="not @skip_below_api18"
- MAZE_WAIT_TIME=30
- MAZE_ARGS=--verbose
- stage: end-to-end tests
env:
- ANDROID_TARGET=android-16
- EMULATOR_FLAGS=-no-audio
- MAZE_TAGS="not @skip_below_api18"
- MAZE_ARGS=--verbose
- stage: deploy
script: skip
before_deploy: ./gradlew javadoc
deploy:
provider: pages
local_dir: sdk/docs # only include the contents of the docs dir
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.com dashboard

before_deploy: ./gradlew javadoc
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache

deploy:
provider: pages
local_dir: sdk/docs # only include the contents of the docs dir
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
on:
tags: true # only deploy when tag is applied to commit
stages:
- lint
- unit tests
- end-to-end tests
- name: deploy
if: tag IS present
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## TBD

This release includes new versions of both bugsnag-android and
bugsnag-android-ndk, which will be released together going forward.

The NDK library has been rebuilt from the ground up and will use the same
version number as bugsnag-android.

### Enhancements

* [NDK] Improve stack trace quality for all native crashes. There should be
significantly more crash-time information, across the board but especially on
newer API levels.
* [NDK] Reduce memory usage
* [NDK] Add support for session information and unhandled report tracking

### Bug Fixes

* [NDK] Fix possible crash when leaving breadcrumbs from multiple threads
[#6](https://github.com/bugsnag/bugsnag-android-ndk/issues/6)
[#10](https://github.com/bugsnag/bugsnag-android-ndk/issues/10)

## 4.6.0 (2018-08-02)

* Android P compatibility fixes - ensure available information on StrictMode violations is collected [#350](https://github.com/bugsnag/bugsnag-android/pull/350)
Expand Down
107 changes: 92 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,20 @@ Here’s a bit about our process designing and building the Bugsnag libraries:
* Our open source libraries span many languages and frameworks so we strive to ensure they are idiomatic on the given platform, but also consistent in terminology between platforms. That way the core concepts are familiar whether you adopt Bugsnag for one platform or many.
* Finally, one of our goals is to ensure our libraries work reliably, even in crashy, multi-threaded environments. Oftentimes, this requires an intensive engineering design and code review process that adheres to our style and linting guidelines.

Installing the Android SDK
--------------------------
### Updating dependencies

Most dependencies are controlled by the module-level gradle files, however
running the NDK C/C++ components also depends on
[`greatest`](https://github.com/silentbicycle/greatest) and [`parson`](https://github.com/kgabis/parson), managed by [clib](https://github.com/clibs/clib).
Both libraries are vendored into the repository and clib is not required unless
updating the dependencies.

To update a clib dependency, reinstall it. For example, using parson:

clib install kgabis/parson -o src/test/cpp/deps --save


## Installing the Android SDK

Running `./gradlew` can automatically install both the Gradle build system
and the Android SDK.
Expand All @@ -61,8 +73,7 @@ installed to `~/.android-sdk`.
> building.

Building the Library
---------------------
## Building the Library

You can build new `.aar` files as follows:

Expand All @@ -73,40 +84,99 @@ You can build new `.aar` files as follows:
Files are generated into`build/outputs/aar`.


Running Tests
-------------
## Running Tests

Running the test suite requires a connected android device or emulator.

### Unit tests

You can run the test suite on a device/emulator as follows from within the sdk directory:

```shell
./gradlew connectedCheck
```

Running Lint
------------
### End-to-end tests

To run the end-to-end tests, first set up the environment by running
[Bundler](https://bundler.io):

```shell
bundle install
```

The tests require two environment variables to be set:

* `ANDROID_HOME`, set the the location of the Android SDK
* `ANDROID_EMULATOR`, set to the name of an installed emulator

Then run the tests using:

```shell
bundle exec maze-runner
```

### Running Lint

You can run lint on the project using the following command:

```shell
./gradlew lint
./gradlew lint checkstyle
```

Building the Example App
------------------------
## Building the Example App

You can build and install the example app to as follows:

```shell
cd examples/sdk-app-example && ../../gradlew clean installJavaExampleDebug
# First build the NDK:
./gradlew ndk:assembleRelease

# Then install the example app:
./gradlew installJavaExampleDebug
```

This builds the latest version of the library and installs an app onto your
device/emulator.


Releasing a New Version
-----------------------
## Installing/testing against a local maven repository

Sometimes its helpful to build and install the bugsnag-android libraries into a
local repository and test the entire dependency flow inside of a sample
application.

To get started:

1. In the `bugsnag-android` directory, run `./gradlew publishProductionPublicationToMavenLocal`.
This installs `bugsnag-android` and `bugsnag-android-ndk` into your local
maven repository.
2. In your sample application `build.gradle`, add `mavenLocal()` to the *top* of
your `allprojects` repositories section:

```groovy
allprojects {
repositories {
mavenLocal()
// other repos as needed
}
}
```
3. In your sample application `app/build.gradle`, add the following to the
dependencies section, inserting the exact version number required:

```groovy
dependencies {
implementation 'com.bugsnag:bugsnag-android-ndk:[VERSION NUMBER]'
}
```
4. Clean your sample application and reload dependencies *every time* you
rebuild/republish the local dependencies:

```
./gradlew clean --refresh-dependencies
```

# Releasing a New Version

If you are a project maintainer, you can build and release a new version of
`bugsnag-android` as follows:
Expand Down Expand Up @@ -145,6 +215,13 @@ If you are a project maintainer, you can build and release a new version of
- [ ] If no network connection is available, is the report queued for later?
- [ ] On a throttled network, is the request timeout reasonable, and the main thread not blocked?
- [ ] Are queued reports sent asynchronously?
- Native functionality checks:
- [ ] Rotate the device before notifying. Is the orientation at the time
persisted in the report on the dashboard?
- [ ] Rotate the device before causing a native crash. Is the orientation at
the time of the crash persisted in the report on the dashboard?
- [ ] Wait a few seconds before a native crash. Does the reported duration in
foreground match your expectation?
- [ ] Have the installation instructions been updated on the [dashboard](https://github.com/bugsnag/bugsnag-website/tree/master/app/views/dashboard/projects/install) as well as the [docs site](https://github.com/bugsnag/docs.bugsnag.com)?

### Making the release
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"

gem 'bugsnag-maze-runner', git: 'git@github.com:bugsnag/maze-runner'
gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner'
gem 'pry'

0 comments on commit da20d76

Please sign in to comment.