Skip to content

Commit

Permalink
Merge pull request #266 from bugsnag/v5-config-avoidance
Browse files Browse the repository at this point in the history
Avoid eager initialization of bugsnag tasks
  • Loading branch information
fractalwrench committed Aug 17, 2020
2 parents b66e30d + ba980b1 commit dcc78e9
Show file tree
Hide file tree
Showing 24 changed files with 732 additions and 646 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath "com.android.tools.build:gradle:4.1.0-beta04" // compile against 4.1.0-beta04, but maintain compat to 3.4.0
classpath "com.android.tools.build:gradle:4.1.0-rc01" // compile against 4.1.0-rc01, but maintain compat to 3.4.0
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.9.1"
}
Expand Down Expand Up @@ -58,7 +58,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
// Build dependencies
dependencies {
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.3"
compileOnly "com.android.tools.build:gradle:4.1.0-beta04"
compileOnly "com.android.tools.build:gradle:4.1.0-rc01"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72"

// For uploading proguard/ndk files
Expand All @@ -73,7 +73,7 @@ dependencies {
// For multiple I/O use cases
implementation "com.squareup.okio:okio:2.7.0"

testImplementation "com.android.tools.build:gradle:4.0.0"
testImplementation "com.android.tools.build:gradle:4.1.0-rc01"
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:2.28.2"
testImplementation "com.squareup.okhttp3:mockwebserver:4.8.0"
Expand Down
75 changes: 38 additions & 37 deletions features/abi_apk_splits.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,66 @@ Scenario: ABI Splits project builds successfully
When I build "abi_splits" using the "standard" bugsnag config
Then I should receive 16 requests

And the request 15 is valid for the Build API
And the payload field "appVersionCode" equals "2" for request 15
And the request 0 is valid for the Build API
And the payload field "appVersionCode" equals "2" for request 0

And the request 14 is valid for the Build API
And the payload field "appVersionCode" equals "3" for request 14
And the request 1 is valid for the Build API
And the payload field "appVersionCode" equals "3" for request 1

And the request 13 is valid for the Build API
And the payload field "appVersionCode" equals "4" for request 13
And the request 2 is valid for the Build API
And the payload field "appVersionCode" equals "4" for request 2

And the request 12 is valid for the Build API
And the payload field "appVersionCode" equals "5" for request 12
And the request 3 is valid for the Build API
And the payload field "appVersionCode" equals "5" for request 3

And the request 11 is valid for the Build API
And the payload field "appVersionCode" equals "6" for request 11
And the request 4 is valid for the Build API
And the payload field "appVersionCode" equals "6" for request 4

And the request 10 is valid for the Build API
And the payload field "appVersionCode" equals "1" for request 10
And the request 5 is valid for the Build API
And the payload field "appVersionCode" equals "1" for request 5

And the request 9 is valid for the Build API
And the payload field "appVersionCode" equals "7" for request 9
And the request 6 is valid for the Build API
And the payload field "appVersionCode" equals "7" for request 6

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

And the request 7 is valid for the Android Mapping API
And the field "versionCode" for multipart request 7 equals "2"
And the request 8 is valid for the Android Mapping API
And the field "versionCode" for multipart request 8 equals "2"

And the request 6 is valid for the Android Mapping API
And the field "versionCode" for multipart request 6 equals "3"
And the request 9 is valid for the Android Mapping API
And the field "versionCode" for multipart request 9 equals "3"

And the request 5 is valid for the Android Mapping API
And the field "versionCode" for multipart request 5 equals "4"
And the request 10 is valid for the Android Mapping API
And the field "versionCode" for multipart request 10 equals "4"

And the request 4 is valid for the Android Mapping API
And the field "versionCode" for multipart request 4 equals "5"
And the request 11 is valid for the Android Mapping API
And the field "versionCode" for multipart request 11 equals "5"

And the request 3 is valid for the Android Mapping API
And the field "versionCode" for multipart request 3 equals "6"
And the request 12 is valid for the Android Mapping API
And the field "versionCode" for multipart request 12 equals "6"

And the request 2 is valid for the Android Mapping API
And the field "versionCode" for multipart request 2 equals "1"
And the request 13 is valid for the Android Mapping API
And the field "versionCode" for multipart request 13 equals "1"

And the request 1 is valid for the Android Mapping API
And the field "versionCode" for multipart request 1 equals "7"
And the request 14 is valid for the Android Mapping API
And the field "versionCode" for multipart request 14 equals "7"

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

@skip_agp4_1_or_higher
Scenario: ABI Splits automatic upload disabled
When I build "abi_splits" using the "all_disabled" bugsnag config
Then I should receive no requests

@skip_agp4_1_or_higher
@skip_agp3_5
Scenario: ABI Splits manual upload of build API
When I build the "Armeabi-release" variantOutput for "abi_splits" using the "all_disabled" bugsnag config
Then I should receive 1 request
Expand Down
6 changes: 3 additions & 3 deletions features/apk_splits_same_version.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Feature: Plugin integrated in project with APK splits
Scenario: APK splits avoid uploading duplicate requests for same version information
When I build "apk_splits" using the "standard" bugsnag config
Then I should receive 2 requests
And the request 0 is valid for the Android Mapping API
And the payload field "buildUUID" equals "same-build-uuid" for request 0
And the request 1 is valid for the Build API
And the request 1 is valid for the Android Mapping API
And the payload field "buildUUID" equals "same-build-uuid" for request 1
And the request 0 is valid for the Build API
74 changes: 38 additions & 36 deletions features/app_bundle.feature
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
Feature: Generating Android app bundles

@skip_agp3_5
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 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 "builderName" is not null for request 1
And the payload field "buildTool" equals "gradle-android" for request 1
And the payload field "appVersionCode" equals "1" for request 1
And the payload field "sourceControl.provider" equals "github" for request 1
And the payload field "sourceControl.repository" equals "https://github.com/bugsnag/bugsnag-android-gradle-plugin.git" for request 1
And the payload field "sourceControl.revision" is not null for request 1
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 1
And the payload field "metadata.os_name" is not null for request 1
And the payload field "metadata.os_version" is not null for request 1
And the payload field "metadata.java_version" is not null for request 1
And the payload field "metadata.gradle_version" is not null for request 1
And the payload field "metadata.git_version" is not null for request 1
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 0 is valid for the Android Mapping API
And the field "apiKey" for multipart request 0 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 0 equals "1"
And the field "versionName" for multipart request 0 equals "1.0"
And the field "appId" for multipart request 0 equals "com.bugsnag.android.example"
And the field "overwrite" for multipart request 0 is null
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

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

And the request 3 is valid for the Build API
And the payload field "appVersion" equals "1.0" for request 3
And the payload field "apiKey" equals "TEST_API_KEY" for request 3
And the payload field "appVersionCode" equals "1" for request 3
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 2 is valid for the Build API
And the payload field "appVersion" equals "1.0" for request 2
Expand All @@ -48,23 +50,23 @@ Scenario: Bundling multiple flavors automatically
And the field "versionName" for multipart request 1 equals "1.0"
And the field "appId" for multipart request 1 equals "com.bugsnag.android.example.bar"

And the request 0 is valid for the Android Mapping API
And the field "apiKey" for multipart request 0 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 0 equals "1"
And the field "versionName" for multipart request 0 equals "1.0"
And the field "appId" for multipart request 0 equals "com.bugsnag.android.example.foo"
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 1 is valid for the Build API
And the request 0 is valid for the Build API

And the request 0 is valid for the Android Mapping API
And the field "apiKey" for multipart request 0 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 0 equals "1"
And the field "versionName" for multipart request 0 equals "1.0"
And the field "appId" for multipart request 0 equals "com.bugsnag.android.example.foo"
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
Expand Down
42 changes: 21 additions & 21 deletions features/default_app.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ Scenario: Single-module default app builds successfully
When I build "default_app" using the "standard" bugsnag config
Then I should receive 2 requests

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 "builderName" is not null for request 1
And the payload field "buildTool" equals "gradle-android" for request 1
And the payload field "appVersionCode" equals "1" for request 1
And the payload field "sourceControl.provider" equals "github" for request 1
And the payload field "sourceControl.repository" equals "https://github.com/bugsnag/bugsnag-android-gradle-plugin.git" for request 1
And the payload field "sourceControl.revision" is not null for request 1
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 1
And the payload field "metadata.os_name" is not null for request 1
And the payload field "metadata.os_version" is not null for request 1
And the payload field "metadata.java_version" is not null for request 1
And the payload field "metadata.gradle_version" is not null for request 1
And the payload field "metadata.git_version" is not null for request 1
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 0 is valid for the Android Mapping API
And the field "apiKey" for multipart request 0 equals "TEST_API_KEY"
And the field "versionCode" for multipart request 0 equals "1"
And the field "versionName" for multipart request 0 equals "1.0"
And the field "appId" for multipart request 0 equals "com.bugsnag.android.example"
And the field "overwrite" for multipart request 0 is null
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
Loading

0 comments on commit dcc78e9

Please sign in to comment.