diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 7dc9a22c..aa1e46a7 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -11,7 +11,8 @@ steps: plugins: - docker-compose#v3.7.0: run: java-common - command: './gradlew :bugsnag:assemble :bugsnag-spring:javax:assemble :bugsnag-spring:assemble' + artifact_paths: maven-repository.zip + command: 'scripts/build-test-repository.sh' - label: ':docker: Run JVM tests' key: 'java-jvm-tests' @@ -23,34 +24,52 @@ steps: - label: ':docker: Mazerunner java8 tests batch 1' key: 'java-mazerunner-tests-1' + depends_on: 'java-jvm-build' timeout_in_minutes: 30 plugins: - docker-compose#v3.7.0: run: java8-mazerunner - command: 'bundle exec maze-runner --exclude=features/[^a-m].*.feature' + - artifacts#v1.9.0: + download: "maven-repository.zip" + command: + - 'features/scripts/assemble-fixtures.sh' + - 'bundle exec maze-runner --exclude=features/[^a-m].*.feature' - label: ':docker: Mazerunner java8 tests batch 2' key: 'java-mazerunner-tests-2' + depends_on: 'java-jvm-build' timeout_in_minutes: 30 plugins: - docker-compose#v3.7.0: - pull: java8-mazerunner run: java8-mazerunner - command: 'bundle exec maze-runner --exclude=features/[^n-z].*.feature' + - artifacts#v1.9.0: + download: "maven-repository.zip" + command: + - 'features/scripts/assemble-fixtures.sh' + - 'bundle exec maze-runner --exclude=features/[^n-z].*.feature' - label: ':docker: Mazerunner java17 tests batch 1' key: 'java-mazerunner-tests-3' + depends_on: 'java-jvm-build' timeout_in_minutes: 30 plugins: - docker-compose#v3.7.0: run: java17-mazerunner - command: 'bundle exec maze-runner --exclude=features/[^a-m].*.feature' + - artifacts#v1.9.0: + download: "maven-repository.zip" + command: + - 'features/scripts/assemble-fixtures.sh' + - 'bundle exec maze-runner --exclude=features/[^a-m].*.feature' - label: ':docker: Mazerunner java17 tests batch 2' key: 'java-mazerunner-tests-4' + depends_on: 'java-jvm-build' timeout_in_minutes: 30 plugins: - docker-compose#v3.7.0: - pull: java17-mazerunner run: java17-mazerunner - command: 'bundle exec maze-runner --exclude=features/[^n-z].*.feature' + - artifacts#v1.9.0: + download: "maven-repository.zip" + command: + - 'features/scripts/assemble-fixtures.sh' + - 'bundle exec maze-runner --exclude=features/[^n-z].*.feature' diff --git a/CHANGELOG.md b/CHANGELOG.md index d2ca48ae..9add0b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Changelog -## 3.7.0 (2023-06-07) +## 3.7.1 (2023-10-25) + +* Restore `BugsnagServletContainerInitializer` and `BugsnagServletRequestListener` to the `com.bugsnag.servlet` package. + These classes are deprecated in favour of the new `com.bugsnag.servlet.javax.` package, but are also compatible (`c.b.s.BugsnagServletRequestListener extends c.b.s.javax.BugsnagServletRequestListener`). This + fixes [issue #195](https://github.com/bugsnag/bugsnag-java/issues/195). + [#199](https://github.com/bugsnag/bugsnag-java/pull/199) + +* Corrected JVM version requirements for Gradle projects (fixing [issue 196](https://github.com/bugsnag/bugsnag-java/issues/196)) + [#197](https://github.com/bugsnag/bugsnag-java/pull/197) + +## 3.7.0 (2023-06-12) * Support Spring 6 / Spring Boot 3 [#191](https://github.com/bugsnag/bugsnag-java/pull/191) @@ -8,6 +18,10 @@ * Bump Jackson from 2.13.3 for critical vulnerability fixes [#184](https://github.com/bugsnag/bugsnag-java/pull/184) +### Known Issues + +* v3.7.0 of `bugsnag-spring` declares the wrong jdk version as a dependency, meaning it is incompatible with Java < 17. If you are using earlier versions use v3.6.4. + ## 3.6.4 (2022-07-12) * Support log messages that use `{}` formatting diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 76d98e5d..a95dca3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,11 +82,6 @@ Create a Sonatype account: 1. Ask an existing contributor (likely Simon) to confirm in the ticket 1. Wait for Sonatype them to confirm the approval -Create a [Bintray](https://bintray.com) account: - -1. Create an account -1. Request access to the [Bugsnag organization](https://bintray.com/bugsnag) - ### 2. Configure the prerequisites 1. Create your [PGP Signatures](http://central.sonatype.org/pages/working-with-pgp-signatures.html) @@ -99,10 +94,6 @@ Create a [Bintray](https://bintray.com) account: nexusUsername=your-sonatype-username nexusPassword=your-sonatype-password - - # Your credentials for https://bintray.com - bintray_user=your-bintray-username - bintray_api_key=your-bintray-api-key ``` ### 3. Making a release @@ -111,30 +102,45 @@ Create a [Bintray](https://bintray.com) account: - [ ] Does the build pass on the CI server? - [ ] Are all Docs PRs ready to go? - [ ] Has all new functionality been manually tested on a release build? - - [ ] Ensure the example app sends an unhandled error - - [ ] Ensure the example app sends a handled error + - [ ] Ensure the example app sends an unhandled error + - [ ] Ensure the example app sends a handled error - [ ] 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)? - [ ] Do the installation instructions work for a manual integration? #### Making the release -1. Merge any remaining PRs to master, ensuring the commit message matches the release tag (e.g. v4.0.0) -1. Update the CHANGELOG.md file with any changes -1. Update the version number by running `make VERSION=[number] bump` -1. Commit the changes -1. Create a release build: - * `./gradlew -Preleasing=true clean release` - - enter the release version (e.g. `1.2.0`) - - accept the default development version -1. Create a release in GitHub, attaching the changelog entry and build artifacts -1. Upload the archives to Sonatype Nexus and Bintray: - * `./gradlew -Preleasing=true uploadArchives bintrayUpload` -1. "Promote" the build on Maven Central: - * `./gradlew -Preleasing=true closeAndReleaseRepository` -1. Update the documentation (integration guide, quick start): - * Update the version numbers of the dependencies listed in the manual - integration guide. - * For a major version change, update the version numbers in the integration - instructions on docs.bugsnag.com and the quick start guides on the website. +To start a release: + +- decide on a version number +- create a new release branch from `next` with the version number in the branch name + `git checkout -b release/vX.Y.Z` +- Pull the release branch and update it locally: + - [ ] Update the version number with `make VERSION=[number] bump` + - [ ] Update the version number and date in the changelog + - [ ] Inspect the updated CHANGELOG, and version files to ensure they are correct +- Commit the changes with the release tag as the commit message (e.g. v4.0.0) +- Create a release build and upload to the sonatype staging repository: + - `./gradlew -Preleasing=true clean publishAllPublicationsToSonatypeRepository` + - Verify that the artefacts are uploaded to sonatype - ensure that JARs, POMs and JAVADOCs are present for each module. + - Test the Sonatype artefacts in the example app by adding the newly created 'combugsnag-XXXX' repository to the build.gradle: maven {url "https://oss.sonatype.org/service/local/repositories/combugsnag-XXXX/content/"} +- Once you are happy, make a PR from your release branch to `master` entitled `Release vX.Y.Z` +- Get the release PR reviewed – all code changes should have been reviewed already, this should be a review of the integration of all changes to be shipped and the changelog +- Once merged: + - Pull the latest changes (checking out `master` if necessary) + - Create a release build and upload to sonatype: + - `./gradlew -Preleasing=true clean publishAllPublicationsToSonatypeRepository` + - Release to GitHub: + - [ ] Create *and tag* the release from `master` on [GitHub Releases](https://github.com/bugsnag/bugsnag-android/releases), attaching the changelog entry and build artifacts + - Checkout `master` and pull the latest changes + - "Promote" the release build on Maven Central: + - Go to the [sonatype open source dashboard](https://oss.sonatype.org/index.html#stagingRepositories) + - Click the search box at the top right, and type “com.bugsnag” + - Select the com.bugsnag staging repository + - Ensure that JARs, POMs and JAVADOCs are present for each module + - Click the “close” button in the toolbar, no message + - Click the “refresh” button + - Select the com.bugsnag closed repository + - Click the “release” button in the toolbar + - Merge outstanding docs PRs related to this release #### Post-release Checklist - [ ] Have all Docs PRs been merged? diff --git a/Gemfile.lock b/Gemfile.lock index ed77d7fa..2aa299b3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,18 +1,20 @@ GIT remote: https://github.com/bugsnag/maze-runner - revision: 734405a801012be706f5e190e472fb02dd83b264 - tag: v7.10.2 + revision: 4456b8ddf7053e8dfdec39f14fed444ec93c0578 + tag: v7.24.0 specs: - bugsnag-maze-runner (7.10.2) + bugsnag-maze-runner (7.24.0) appium_lib (~> 12.0.0) appium_lib_core (~> 5.4.0) bugsnag (~> 6.24) cucumber (~> 7.1) cucumber-expressions (~> 6.0.0) curb (~> 0.9.6) + dogstatsd-ruby (~> 5.5.0) json_schemer (~> 0.2.24) optimist (~> 3.0.1) os (~> 1.0.0) + rack (~> 2.2) rake (~> 12.3.3) rubyzip (~> 2.3.2) selenium-webdriver (~> 4.0) @@ -29,11 +31,11 @@ GEM appium_lib_core (5.4.0) faye-websocket (~> 0.11.0) selenium-webdriver (~> 4.2, < 4.6) - bugsnag (6.25.1) + bugsnag (6.26.0) concurrent-ruby (~> 1.0) builder (3.2.4) childprocess (4.1.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) cucumber (7.1.0) builder (~> 3.2, >= 3.2.4) cucumber-core (~> 10.1, >= 10.1.0) @@ -67,49 +69,57 @@ GEM cucumber-cucumber-expressions (~> 14.0, >= 14.0.0) curb (0.9.11) diff-lcs (1.5.0) + dogstatsd-ruby (5.5.0) ecma-re-validator (0.4.0) regexp_parser (~> 2.2) eventmachine (1.2.7) - faye-websocket (0.11.1) + faye-websocket (0.11.3) eventmachine (>= 0.12.0) websocket-driver (>= 0.5.1) ffi (1.15.5) hana (1.3.7) - json_schemer (0.2.24) + json_schemer (0.2.25) ecma-re-validator (~> 0.3) hana (~> 1.3) regexp_parser (~> 2.0) + simpleidn (~> 0.2) uri_template (~> 0.7) - mime-types (3.4.1) + mime-types (3.5.1) mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mini_portile2 (2.8.1) + mime-types-data (3.2023.0808) + mini_portile2 (2.8.4) multi_test (0.1.2) - nokogiri (1.13.10) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.4) + mini_portile2 (~> 2.8.2) racc (~> 1.4) optimist (3.0.1) os (1.0.1) power_assert (2.0.3) - racc (1.6.2) + racc (1.7.1) + rack (2.2.8) rake (12.3.3) - regexp_parser (2.6.1) - rexml (3.2.5) + regexp_parser (2.8.1) + rexml (3.2.6) rubyzip (2.3.2) selenium-webdriver (4.5.0) childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sys-uname (1.2.2) + simpleidn (0.2.1) + unf (~> 0.1.4) + sys-uname (1.2.3) ffi (~> 1.1) - test-unit (3.5.7) + test-unit (3.5.9) power_assert tomlrb (2.0.3) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) uri_template (0.7.0) webrick (1.7.0) websocket (1.2.9) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) diff --git a/bugsnag-spring/build.gradle b/bugsnag-spring/build.gradle index 56374aa2..b8a9fb62 100644 --- a/bugsnag-spring/build.gradle +++ b/bugsnag-spring/build.gradle @@ -1,43 +1,199 @@ ext { - springVersion = '6.0.0' - springBootVersion = '3.0.0' + jakartaSpringVersion = '6.0.0' + jakartaSpringBootVersion = '3.0.0' + + javaxSpringVersion = '5.3.20' + javaxSpringBootVersion = '2.5.14' } apply plugin: 'java-library' -apply from: '../common.gradle' - repositories { mavenCentral() } +java { + withJavadocJar() + toolchain { + languageVersion.set(JavaLanguageVersion.of(8)) + } +} + +// We use 3 custom configurations and matching sourceSets to avoid the standard behaviours which interfere with +// our compilation structure +configurations { + compileCommon + compileJavax + compileJakarta +} + +sourceSets { + common { + java + // common.compileClasspath includes the compileJavax classpath in order to give the common classes access + // to Spring without confusing the dependencies, including it here ensures that any use of javax.* packages + // in src/common will result in test failures (although not compile failures) + // we need the javax.* packages included here so that the compiler can type-check all the way up the hierarchy + // for things like "ServletRequestBindingException extends ServletException" + compileClasspath += configurations.compileCommon + configurations.compileJavax + } + javax { + java + compileClasspath += configurations.compileJavax + common.output + configurations.compileCommon + } + jakarta { + java + compileClasspath += configurations.compileJakarta + common.output + configurations.compileCommon + } +} + +// test sourceSets +sourceSets { + commonTest { + java + } + javaxTest { + java + compileClasspath += javax.output + javax.compileClasspath + commonTest.output + commonTest.runtimeClasspath + common.output + runtimeClasspath = compileClasspath + } + jakartaTest { + java + compileClasspath += jakarta.output + jakarta.compileClasspath + commonTest.output + commonTest.runtimeClasspath + common.output + runtimeClasspath = compileClasspath + } +} + +tasks.register('sourceJar', Jar).configure { + from( + sourceSets.common.allJava, + sourceSets.javax.allJava, + sourceSets.jakarta.allJava + ) +} + +// do not move this higher - sourceJar must be registered before we apply common.gradle +apply from: '../common.gradle' + +compileJava.dependsOn(compileCommonJava, compileJavaxJava, compileJakartaJava) + +// Separated Javax / Jakarta tests ------------------------------------------------------------------------------------- + +compileJakartaJava { + // set the compiler for the `jakarta` sourceSet to Java17 + javaCompiler.set( + javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(17) + } + ) +} + +compileJakartaTestJava { + // set the compiler for the `jakartaTest` sourceSet to Java17 + javaCompiler.set( + javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(17) + } + ) +} + +testClasses.dependsOn(javaxTestClasses, jakartaTestClasses) + +tasks.register('testJakarta', Test) { + testClassesDirs = sourceSets.jakartaTest.output.classesDirs + classpath = sourceSets.jakartaTest.output.classesDirs + sourceSets.jakartaTest.runtimeClasspath + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(17) + } + ) + + dependsOn(jakartaTestClasses) +} + +tasks.register('testJavax', Test) { + testClassesDirs = sourceSets.javaxTest.output.classesDirs + classpath = sourceSets.javaxTest.output.classesDirs + sourceSets.javaxTest.runtimeClasspath + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(8) + } + ) + + dependsOn(javaxTestClasses) +} + +test.dependsOn(testJakarta, testJavax) + dependencies { - compileOnly project(':bugsnag-spring:javax') - api project(':bugsnag') + compileCommon project(':bugsnag') - compileOnly "jakarta.servlet:jakarta.servlet-api:${jakartaServletApiVersion}" - compileOnly "org.springframework:spring-webmvc:${springVersion}" - compileOnly "org.springframework.boot:spring-boot:${springBootVersion}" - compileOnly "ch.qos.logback:logback-core:${logbackVersion}" - compileOnly "org.slf4j:slf4j-api:${slf4jApiVersion}" + compileCommon "ch.qos.logback:logback-core:${logbackVersion}" + compileCommon "org.slf4j:slf4j-api:${slf4jApiVersion}" - testImplementation project(':bugsnag').sourceSets.test.output - testImplementation project(':bugsnag-spring:javax') - testImplementation project(':bugsnag') - testImplementation "junit:junit:${junitVersion}" - testImplementation "jakarta.servlet:jakarta.servlet-api:${jakartaServletApiVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-web:${springBootVersion}" - testImplementation "org.mockito:mockito-core:${mockitoVersion}" + compileJavax "javax.servlet:javax.servlet-api:${javaxServletApiVersion}" + compileJavax "org.springframework:spring-webmvc:${javaxSpringVersion}" + compileJavax "org.springframework.boot:spring-boot:${javaxSpringBootVersion}" + + compileJakarta "jakarta.servlet:jakarta.servlet-api:${jakartaServletApiVersion}" + compileJakarta "org.springframework:spring-webmvc:${jakartaSpringVersion}" + compileJakarta "org.springframework.boot:spring-boot:${jakartaSpringBootVersion}" + + commonTestImplementation project(':bugsnag').sourceSets.test.output + commonTestImplementation project(':bugsnag') + + commonTestImplementation "junit:junit:${junitVersion}" + + commonTestCompileOnly "org.mockito:mockito-core:2.10.0" + + jakartaTestImplementation "org.mockito:mockito-core:${mockitoVersion}" + jakartaTestImplementation "jakarta.servlet:jakarta.servlet-api:${jakartaServletApiVersion}" + jakartaTestImplementation "org.springframework.boot:spring-boot-starter-test:${jakartaSpringBootVersion}" + jakartaTestImplementation "org.springframework.boot:spring-boot-starter-web:${jakartaSpringBootVersion}" + + javaxTestImplementation "org.mockito:mockito-core:2.10.0" + javaxTestImplementation "javax.servlet:javax.servlet-api:${javaxServletApiVersion}" + javaxTestImplementation "org.springframework.boot:spring-boot-starter-test:${javaxSpringBootVersion}" + javaxTestImplementation "org.springframework.boot:spring-boot-starter-web:${javaxSpringBootVersion}" } -evaluationDependsOnChildren() +dependencies { + // ensure that the published .pom file includes a dependency on com.bugsnag:bugsnag + // this 'api' dependency has no impact on the compilation of this projects source, + // so we keep it in it's own dependencies block + api project(':bugsnag') +} + +// here is where we merge all of the class outputs into the default classes directory doing this as its own step avoids +// circular dependencies between the sourceSets and their output directories (if they all use 'main.output.classesDirs' +// then jakarta+javax both depend on it as well) +tasks.register('mergeClasses', Copy) { + from sourceSets.common.output.classesDirs + from sourceSets.jakarta.output.classesDirs + from sourceSets.javax.output.classesDirs + + into sourceSets.main.output.classesDirs.asPath +} -tasks['jar'].dependsOn(project(':bugsnag-spring:javax').tasks['jar']) +classes.dependsOn('mergeClasses') -jar { - from project.sourceSets.main.allSource - from project(':bugsnag-spring:javax').configurations.archives.artifacts.files.collect { file -> - zipTree(file) +if (project.hasProperty('releasing')) { + publishing { + publications { + Publication(MavenPublication) { + // this is vital: we use the version details from the "javax" side of the project + // this ensures that Gradle considers that as the baseline set of required versions + // allowing old projects that still use Java8 and the javax.servlet packages to use + // bugsnag-java without any secondary artifacts + versionMapping { + usage('java-api') { + fromResolutionOf('compileCommon') + } + usage('java-runtime') { + fromResolutionOf('compileCommon') + } + } + } + } } } diff --git a/bugsnag-spring/javax/build.gradle b/bugsnag-spring/javax/build.gradle index 3beef567..edb7f763 100644 --- a/bugsnag-spring/javax/build.gradle +++ b/bugsnag-spring/javax/build.gradle @@ -8,6 +8,12 @@ apply plugin: 'java-library' apply from: '../../common.gradle' +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } +} + compileJava { sourceCompatibility = '1.8' targetCompatibility = '1.8' diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagAsyncExceptionHandler.java b/bugsnag-spring/src/common/java/com/bugsnag/BugsnagAsyncExceptionHandler.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagAsyncExceptionHandler.java rename to bugsnag-spring/src/common/java/com/bugsnag/BugsnagAsyncExceptionHandler.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagImportSelector.java b/bugsnag-spring/src/common/java/com/bugsnag/BugsnagImportSelector.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagImportSelector.java rename to bugsnag-spring/src/common/java/com/bugsnag/BugsnagImportSelector.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagScheduledTaskExceptionHandler.java b/bugsnag-spring/src/common/java/com/bugsnag/BugsnagScheduledTaskExceptionHandler.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagScheduledTaskExceptionHandler.java rename to bugsnag-spring/src/common/java/com/bugsnag/BugsnagScheduledTaskExceptionHandler.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagSpringConfiguration.java b/bugsnag-spring/src/common/java/com/bugsnag/BugsnagSpringConfiguration.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagSpringConfiguration.java rename to bugsnag-spring/src/common/java/com/bugsnag/BugsnagSpringConfiguration.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/ExceptionClassCallback.java b/bugsnag-spring/src/common/java/com/bugsnag/ExceptionClassCallback.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/ExceptionClassCallback.java rename to bugsnag-spring/src/common/java/com/bugsnag/ExceptionClassCallback.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/ScheduledTaskBeanLocator.java b/bugsnag-spring/src/common/java/com/bugsnag/ScheduledTaskBeanLocator.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/ScheduledTaskBeanLocator.java rename to bugsnag-spring/src/common/java/com/bugsnag/ScheduledTaskBeanLocator.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/ScheduledTaskConfiguration.java b/bugsnag-spring/src/common/java/com/bugsnag/ScheduledTaskConfiguration.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/ScheduledTaskConfiguration.java rename to bugsnag-spring/src/common/java/com/bugsnag/ScheduledTaskConfiguration.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/SpringBootConfiguration.java b/bugsnag-spring/src/common/java/com/bugsnag/SpringBootConfiguration.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/SpringBootConfiguration.java rename to bugsnag-spring/src/common/java/com/bugsnag/SpringBootConfiguration.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/SpringBootLoadedCondition.java b/bugsnag-spring/src/common/java/com/bugsnag/SpringBootLoadedCondition.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/SpringBootLoadedCondition.java rename to bugsnag-spring/src/common/java/com/bugsnag/SpringBootLoadedCondition.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/SpringWebMvcLoadedCondition.java b/bugsnag-spring/src/common/java/com/bugsnag/SpringWebMvcLoadedCondition.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/SpringWebMvcLoadedCondition.java rename to bugsnag-spring/src/common/java/com/bugsnag/SpringWebMvcLoadedCondition.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/TestUtils.java b/bugsnag-spring/src/commonTest/java/com/bugsnag/TestUtils.java similarity index 91% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/TestUtils.java rename to bugsnag-spring/src/commonTest/java/com/bugsnag/TestUtils.java index 4bc70115..bfb6775c 100644 --- a/bugsnag-spring/javax/src/test/java/com/bugsnag/TestUtils.java +++ b/bugsnag-spring/src/commonTest/java/com/bugsnag/TestUtils.java @@ -1,6 +1,5 @@ package com.bugsnag; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; @@ -21,7 +20,7 @@ static Report verifyAndGetReport(Delivery delivery) { ArgumentCaptor notificationCaptor = ArgumentCaptor.forClass(Notification.class); verify(delivery, timeout(100).times(1)).deliver( - any(Serializer.class), + ArgumentMatchers.any(Serializer.class), notificationCaptor.capture(), anyMapOf(String.class, String.class)); return notificationCaptor.getValue().getEvents().get(0); diff --git a/bugsnag-spring/src/main/java/com/bugsnag/BugsnagJakartaMvcExceptionHandler.java b/bugsnag-spring/src/jakarta/java/com/bugsnag/BugsnagJakartaMvcExceptionHandler.java similarity index 100% rename from bugsnag-spring/src/main/java/com/bugsnag/BugsnagJakartaMvcExceptionHandler.java rename to bugsnag-spring/src/jakarta/java/com/bugsnag/BugsnagJakartaMvcExceptionHandler.java diff --git a/bugsnag-spring/src/main/java/com/bugsnag/JakartaMvcConfiguration.java b/bugsnag-spring/src/jakarta/java/com/bugsnag/JakartaMvcConfiguration.java similarity index 100% rename from bugsnag-spring/src/main/java/com/bugsnag/JakartaMvcConfiguration.java rename to bugsnag-spring/src/jakarta/java/com/bugsnag/JakartaMvcConfiguration.java diff --git a/bugsnag-spring/src/main/java/com/bugsnag/SpringBootJakartaConfiguration.java b/bugsnag-spring/src/jakarta/java/com/bugsnag/SpringBootJakartaConfiguration.java similarity index 100% rename from bugsnag-spring/src/main/java/com/bugsnag/SpringBootJakartaConfiguration.java rename to bugsnag-spring/src/jakarta/java/com/bugsnag/SpringBootJakartaConfiguration.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/NotifierTest.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/NotifierTest.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/NotifierTest.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/NotifierTest.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/ScheduledTaskConfigurationTest.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/ScheduledTaskConfigurationTest.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/ScheduledTaskConfigurationTest.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/ScheduledTaskConfigurationTest.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/SpringAsyncTest.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/SpringAsyncTest.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/SpringAsyncTest.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/SpringAsyncTest.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/SpringMvcTest.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/SpringMvcTest.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/SpringMvcTest.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/SpringMvcTest.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/SpringScheduledTaskTest.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/SpringScheduledTaskTest.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/SpringScheduledTaskTest.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/SpringScheduledTaskTest.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/AsyncService.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/AsyncService.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/AsyncService.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/AsyncService.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/TestConfiguration.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/TestConfiguration.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/TestConfiguration.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/TestConfiguration.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/TestController.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/TestController.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/TestController.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/TestController.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java b/bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java rename to bugsnag-spring/src/jakartaTest/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java diff --git a/bugsnag-spring/src/test/resources/logback.xml b/bugsnag-spring/src/jakartaTest/resources/logback.xml similarity index 100% rename from bugsnag-spring/src/test/resources/logback.xml rename to bugsnag-spring/src/jakartaTest/resources/logback.xml diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagJavaxMvcExceptionHandler.java b/bugsnag-spring/src/javax/java/com/bugsnag/BugsnagJavaxMvcExceptionHandler.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/BugsnagJavaxMvcExceptionHandler.java rename to bugsnag-spring/src/javax/java/com/bugsnag/BugsnagJavaxMvcExceptionHandler.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/JavaxMvcConfiguration.java b/bugsnag-spring/src/javax/java/com/bugsnag/JavaxMvcConfiguration.java similarity index 100% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/JavaxMvcConfiguration.java rename to bugsnag-spring/src/javax/java/com/bugsnag/JavaxMvcConfiguration.java diff --git a/bugsnag-spring/javax/src/main/java/com/bugsnag/SpringBootJavaxConfiguration.java b/bugsnag-spring/src/javax/java/com/bugsnag/SpringBootJavaxConfiguration.java similarity index 74% rename from bugsnag-spring/javax/src/main/java/com/bugsnag/SpringBootJavaxConfiguration.java rename to bugsnag-spring/src/javax/java/com/bugsnag/SpringBootJavaxConfiguration.java index b7ae8183..1f63c81d 100644 --- a/bugsnag-spring/javax/src/main/java/com/bugsnag/SpringBootJavaxConfiguration.java +++ b/bugsnag-spring/src/javax/java/com/bugsnag/SpringBootJavaxConfiguration.java @@ -17,11 +17,11 @@ class SpringBootJavaxConfiguration extends SpringBootConfiguration { /** - * The {@link com.bugsnag.servlet.javax.BugsnagServletContainerInitializer} does not work for Spring Boot, need to - * register the {@link BugsnagServletRequestListener} using a Spring Boot - * {@link ServletListenerRegistrationBean} instead. This adds session tracking and - * automatic servlet request metadata collection. - */ + * The {@link com.bugsnag.servlet.javax.BugsnagServletContainerInitializer} does not work for Spring Boot, need to + * register the {@link BugsnagServletRequestListener} using a Spring Boot + * {@link ServletListenerRegistrationBean} instead. This adds session tracking and + * automatic servlet request metadata collection. + */ @Bean @Conditional(SpringWebMvcLoadedCondition.class) ServletListenerRegistrationBean listenerRegistrationBean() { diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/ScheduledTaskBeanLocatorTest.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/ScheduledTaskConfigurationTest.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/ScheduledTaskConfigurationTest.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/ScheduledTaskConfigurationTest.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/ScheduledTaskConfigurationTest.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/SpringAsyncTest.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringAsyncTest.java similarity index 92% rename from bugsnag-spring/src/test/java/com/bugsnag/SpringAsyncTest.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringAsyncTest.java index 42a91df2..1bdfa04b 100644 --- a/bugsnag-spring/src/test/java/com/bugsnag/SpringAsyncTest.java +++ b/bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringAsyncTest.java @@ -1,6 +1,5 @@ package com.bugsnag; -import static com.bugsnag.TestUtils.verifyAndGetReport; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; @@ -12,6 +11,7 @@ import com.bugsnag.testapp.springboot.AsyncService; import com.bugsnag.testapp.springboot.TestSpringBootApplication; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -50,14 +50,14 @@ public void setUp() { public void bugsnagNotifyWhenAsyncVoidReturnTypeException() { asyncService.throwExceptionVoid(); - Report report = verifyAndGetReport(delivery); + Report report = TestUtils.verifyAndGetReport(delivery); // Assert that the exception was detected correctly assertEquals("Async void test", report.getExceptionMessage()); assertEquals("java.lang.RuntimeException", report.getExceptionName()); // Assert that the severity, severity reason and unhandled values are correct - assertEquals(Severity.ERROR.getValue(), report.getSeverity()); + Assert.assertEquals(Severity.ERROR.getValue(), report.getSeverity()); assertEquals( SeverityReasonType.REASON_UNHANDLED_EXCEPTION_MIDDLEWARE.toString(), report.getSeverityReason().getType()); @@ -71,7 +71,7 @@ public void bugsnagNotifyWhenAsyncVoidReturnTypeException() { public void bugsnagNotifyWhenAsyncFutureReturnTypeException() { asyncService.throwExceptionFuture(); - Report report = verifyAndGetReport(delivery); + Report report = TestUtils.verifyAndGetReport(delivery); // Assert that the exception was detected correctly assertEquals("Async future test", report.getExceptionMessage()); diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/SpringMvcTest.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringMvcTest.java similarity index 99% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/SpringMvcTest.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringMvcTest.java index 3b7e6361..d426ba01 100644 --- a/bugsnag-spring/javax/src/test/java/com/bugsnag/SpringMvcTest.java +++ b/bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringMvcTest.java @@ -18,6 +18,7 @@ import com.bugsnag.serialization.Serializer; import com.bugsnag.testapp.springboot.TestSpringBootApplication; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -88,7 +89,7 @@ public void bugsnagNotifyWhenUncaughtControllerException() { assertEquals("java.lang.RuntimeException", report.getExceptionName()); // Assert that the severity, severity reason and unhandled values are correct - assertEquals(Severity.ERROR.getValue(), report.getSeverity()); + Assert.assertEquals(Severity.ERROR.getValue(), report.getSeverity()); assertEquals( SeverityReasonType.REASON_UNHANDLED_EXCEPTION_MIDDLEWARE.toString(), report.getSeverityReason().getType()); diff --git a/bugsnag-spring/src/test/java/com/bugsnag/SpringScheduledTaskTest.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringScheduledTaskTest.java similarity index 94% rename from bugsnag-spring/src/test/java/com/bugsnag/SpringScheduledTaskTest.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringScheduledTaskTest.java index 944b95e9..7a86ff61 100644 --- a/bugsnag-spring/src/test/java/com/bugsnag/SpringScheduledTaskTest.java +++ b/bugsnag-spring/src/javaxTest/java/com/bugsnag/SpringScheduledTaskTest.java @@ -1,6 +1,5 @@ package com.bugsnag; -import static com.bugsnag.TestUtils.verifyAndGetReport; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; @@ -13,6 +12,7 @@ import com.bugsnag.delivery.Delivery; import com.bugsnag.testapp.springboot.TestSpringBootApplication; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -70,14 +70,14 @@ public void run() { // Run the task now and wait for it to finish scheduler.submit(exampleRunnable).get(); - Report report = verifyAndGetReport(delivery); + Report report = TestUtils.verifyAndGetReport(delivery); // Assert that the exception was detected correctly assertEquals("Scheduled test", report.getExceptionMessage()); assertEquals("java.lang.RuntimeException", report.getExceptionName()); // Assert that the severity, severity reason and unhandled values are correct - assertEquals(Severity.ERROR.getValue(), report.getSeverity()); + Assert.assertEquals(Severity.ERROR.getValue(), report.getSeverity()); assertEquals( SeverityReasonType.REASON_UNHANDLED_EXCEPTION_MIDDLEWARE.toString(), report.getSeverityReason().getType()); diff --git a/bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/AsyncService.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/AsyncService.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/AsyncService.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/AsyncService.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/TestConfiguration.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/TestConfiguration.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/TestConfiguration.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/TestConfiguration.java diff --git a/bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/TestController.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/TestController.java similarity index 100% rename from bugsnag-spring/javax/src/test/java/com/bugsnag/testapp/springboot/TestController.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/TestController.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java b/bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java similarity index 100% rename from bugsnag-spring/src/test/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java rename to bugsnag-spring/src/javaxTest/java/com/bugsnag/testapp/springboot/TestSpringBootApplication.java diff --git a/bugsnag-spring/src/test/java/com/bugsnag/TestUtils.java b/bugsnag-spring/src/test/java/com/bugsnag/TestUtils.java deleted file mode 100644 index 4bc70115..00000000 --- a/bugsnag-spring/src/test/java/com/bugsnag/TestUtils.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.bugsnag; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.timeout; -import static org.mockito.Mockito.verify; - -import com.bugsnag.delivery.Delivery; -import com.bugsnag.serialization.Serializer; - -import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatchers; - -import java.util.Map; - -class TestUtils { - - /** - * Verify that a report was received, then capture and return that report - */ - static Report verifyAndGetReport(Delivery delivery) { - ArgumentCaptor notificationCaptor = - ArgumentCaptor.forClass(Notification.class); - verify(delivery, timeout(100).times(1)).deliver( - any(Serializer.class), - notificationCaptor.capture(), - anyMapOf(String.class, String.class)); - return notificationCaptor.getValue().getEvents().get(0); - } - - static Map anyMapOf(Class keyClazz, Class valueClazz) { - return ArgumentMatchers.anyMap(); - } -} diff --git a/bugsnag/build.gradle b/bugsnag/build.gradle index 3c791160..140e8a75 100644 --- a/bugsnag/build.gradle +++ b/bugsnag/build.gradle @@ -5,8 +5,15 @@ plugins { apply plugin: 'java-library' apply from: '../common.gradle' -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +compileJava { + sourceCompatibility = '1.7' + targetCompatibility = '1.7' +} + +compileTestJava { + sourceCompatibility = '1.7' + targetCompatibility = '1.7' +} repositories { mavenCentral() @@ -36,6 +43,11 @@ license { header rootProject.file('LICENSE') ignoreFailures true } + downloadLicenses { - dependencyConfiguration "compile" + dependencyConfiguration "compile" +} + +java { + withJavadocJar() } \ No newline at end of file diff --git a/bugsnag/src/main/java/com/bugsnag/Notifier.java b/bugsnag/src/main/java/com/bugsnag/Notifier.java index 6d1c07ef..3c2d2b49 100644 --- a/bugsnag/src/main/java/com/bugsnag/Notifier.java +++ b/bugsnag/src/main/java/com/bugsnag/Notifier.java @@ -5,7 +5,7 @@ class Notifier { private static final String NOTIFIER_NAME = "Bugsnag Java"; - private static final String NOTIFIER_VERSION = "3.7.0"; + private static final String NOTIFIER_VERSION = "3.7.1"; private static final String NOTIFIER_URL = "https://github.com/bugsnag/bugsnag-java"; private String notifierName = NOTIFIER_NAME; diff --git a/bugsnag/src/main/java/com/bugsnag/callbacks/JavaxServletCallback.java b/bugsnag/src/main/java/com/bugsnag/callbacks/JavaxServletCallback.java index 84912fbb..233fc7ba 100644 --- a/bugsnag/src/main/java/com/bugsnag/callbacks/JavaxServletCallback.java +++ b/bugsnag/src/main/java/com/bugsnag/callbacks/JavaxServletCallback.java @@ -1,7 +1,7 @@ package com.bugsnag.callbacks; import com.bugsnag.Report; -import com.bugsnag.servlet.javax.BugsnagServletRequestListener; +import com.bugsnag.servlet.BugsnagServletRequestListener; import java.util.Enumeration; import java.util.HashMap; diff --git a/bugsnag/src/main/java/com/bugsnag/servlet/BugsnagServletContainerInitializer.java b/bugsnag/src/main/java/com/bugsnag/servlet/BugsnagServletContainerInitializer.java new file mode 100644 index 00000000..a6c498cf --- /dev/null +++ b/bugsnag/src/main/java/com/bugsnag/servlet/BugsnagServletContainerInitializer.java @@ -0,0 +1,9 @@ +package com.bugsnag.servlet; + +/** + * @see com.bugsnag.servlet.javax.BugsnagServletContainerInitializer + * @deprecated since 3.7.1 - to be replaced with {@code com.bugsnag.servlet.javax.BugsnagServletContainerInitializer} + */ +@Deprecated +public class BugsnagServletContainerInitializer extends com.bugsnag.servlet.javax.BugsnagServletContainerInitializer { +} diff --git a/bugsnag/src/main/java/com/bugsnag/servlet/BugsnagServletRequestListener.java b/bugsnag/src/main/java/com/bugsnag/servlet/BugsnagServletRequestListener.java new file mode 100644 index 00000000..d10155c1 --- /dev/null +++ b/bugsnag/src/main/java/com/bugsnag/servlet/BugsnagServletRequestListener.java @@ -0,0 +1,9 @@ +package com.bugsnag.servlet; + +/** + * @see com.bugsnag.servlet.javax.BugsnagServletRequestListener + * @deprecated since 3.7.1 - to be replaced with {@code com.bugsnag.servlet.javax.BugsnagServletRequestListener} + */ +@Deprecated +public class BugsnagServletRequestListener extends com.bugsnag.servlet.javax.BugsnagServletRequestListener { +} diff --git a/bugsnag/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/bugsnag/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer index a59bf666..585bea80 100644 --- a/bugsnag/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer +++ b/bugsnag/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer @@ -1 +1 @@ -com.bugsnag.servlet.javax.BugsnagServletContainerInitializer +com.bugsnag.servlet.BugsnagServletContainerInitializer diff --git a/bugsnag/src/test/java/com/bugsnag/JavaxServletCallbackTest.java b/bugsnag/src/test/java/com/bugsnag/JavaxServletCallbackTest.java index a4ffa9f7..bd51a02b 100644 --- a/bugsnag/src/test/java/com/bugsnag/JavaxServletCallbackTest.java +++ b/bugsnag/src/test/java/com/bugsnag/JavaxServletCallbackTest.java @@ -7,7 +7,7 @@ import com.bugsnag.callbacks.JavaxServletCallback; -import com.bugsnag.servlet.javax.BugsnagServletRequestListener; +import com.bugsnag.servlet.BugsnagServletRequestListener; import org.junit.After; import org.junit.Before; diff --git a/bugsnag/src/test/resources/logback.xml b/bugsnag/src/test/resources/logback.xml index f89de145..4450bab2 100644 --- a/bugsnag/src/test/resources/logback.xml +++ b/bugsnag/src/test/resources/logback.xml @@ -6,7 +6,6 @@ 1.0.1 gradleTask - false password credit_card_number diff --git a/build.gradle b/build.gradle index 3e9e1ea3..37e5c3ff 100644 --- a/build.gradle +++ b/build.gradle @@ -5,17 +5,6 @@ buildscript { url = uri("https://plugins.gradle.org/m2/") } } - dependencies { - if (project.hasProperty('releasing')) { - classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0' - classpath 'net.researchgate:gradle-release:3.0.2' - } - } -} - -// This can only be applied in root project, see https://github.com/Codearte/gradle-nexus-staging-plugin/issues/47 -if (project.hasProperty('releasing')) { - apply plugin: 'io.codearte.nexus-staging' } gradle.projectsEvaluated { diff --git a/docker-compose.yml b/docker-compose.yml index 80a6cc42..74959377 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,10 +8,14 @@ services: build: context: . dockerfile: dockerfiles/Dockerfile.java-common + volumes: + - .:/app java8-mazerunner: build: context: . dockerfile: dockerfiles/Dockerfile.java8-mazerunner + volumes: + - .:/app java17-mazerunner: build: context: . diff --git a/dockerfiles/Dockerfile.java-common b/dockerfiles/Dockerfile.java-common index 31b27d5e..2d4d1224 100644 --- a/dockerfiles/Dockerfile.java-common +++ b/dockerfiles/Dockerfile.java-common @@ -1,6 +1,9 @@ FROM openjdk:17-jdk-slim WORKDIR /app +RUN apt-get update > /dev/null +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y zip + # Force download of gradle zip early to avoid repeating # if Docker cache is invalidated by branch changes. COPY gradlew gradle.properties /app/ @@ -8,6 +11,3 @@ COPY gradle/ /app/gradle/ ENV GRADLE_OPTS="-Dorg.gradle.daemon=false" COPY settings.gradle /app/ RUN ./gradlew - -# Copy repo into docker -COPY . /app diff --git a/dockerfiles/Dockerfile.java17-mazerunner b/dockerfiles/Dockerfile.java17-mazerunner index c578ca05..f4fef7ff 100644 --- a/dockerfiles/Dockerfile.java17-mazerunner +++ b/dockerfiles/Dockerfile.java17-mazerunner @@ -2,7 +2,7 @@ FROM tomcat:10-jdk17-openjdk-slim WORKDIR /app RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ - apt-get install -y -q docker-compose bundler libcurl4-openssl-dev + apt-get install -y -q docker-compose bundler libcurl4-openssl-dev unzip # Force download of gradle zip early to avoid repeating # if Docker cache is invalidated by branch changes. diff --git a/dockerfiles/Dockerfile.java8-mazerunner b/dockerfiles/Dockerfile.java8-mazerunner index 7bee52f2..123f0e30 100644 --- a/dockerfiles/Dockerfile.java8-mazerunner +++ b/dockerfiles/Dockerfile.java8-mazerunner @@ -1,26 +1,8 @@ -FROM openjdk:17-jdk-slim as builder - -WORKDIR /app - -# Force download of gradle zip early to avoid repeating -# if Docker cache is invalidated by branch changes. -COPY gradlew gradle.properties /app/ -COPY gradle/ /app/gradle/ -ENV GRADLE_OPTS="-Dorg.gradle.daemon=false" -COPY settings.gradle /app/ -RUN ./gradlew - -# Copy repo into docker -COPY . /app - -RUN features/scripts/assemble-fixtures.sh - FROM tomcat:9.0.56-jdk8 +WORKDIR /app RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ - apt-get install -y -q docker-compose bundler libcurl4-openssl-dev - -WORKDIR /app + apt-get install -y -q docker-compose bundler libcurl4-openssl-dev unzip # Force download of gradle zip early to avoid repeating # if Docker cache is invalidated by branch changes. @@ -30,10 +12,9 @@ ENV GRADLE_OPTS="-Dorg.gradle.daemon=false" COPY settings.gradle /app/ RUN ./gradlew +# Copy repo into docker COPY . /app -COPY --from=builder /app/features/fixtures/libs/* features/fixtures/libs/ - # Setup mazerunner RUN gem install bundler:1.16.5 RUN bundle install diff --git a/examples/spring-web/build.gradle b/examples/spring-web/build.gradle index 00413b4f..bc9a62af 100644 --- a/examples/spring-web/build.gradle +++ b/examples/spring-web/build.gradle @@ -23,6 +23,5 @@ dependencies { implementation project(":bugsnag") implementation project(":bugsnag-spring") - implementation project(":bugsnag-spring:javax") } diff --git a/examples/spring/build.gradle b/examples/spring/build.gradle index 1dbacd45..d9005fb5 100644 --- a/examples/spring/build.gradle +++ b/examples/spring/build.gradle @@ -15,6 +15,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' repositories { + mavenLocal() mavenCentral() } @@ -23,5 +24,4 @@ dependencies { implementation project(":bugsnag") implementation project(":bugsnag-spring") - implementation project(":bugsnag-spring:javax") } diff --git a/features/fixtures/mazerunner/build.gradle b/features/fixtures/mazerunner/build.gradle index f922c942..2425932b 100644 --- a/features/fixtures/mazerunner/build.gradle +++ b/features/fixtures/mazerunner/build.gradle @@ -17,12 +17,12 @@ apply plugin: 'io.spring.dependency-management' group 'com.bugsnag.mazerunner' version '1.0-SNAPSHOT' -sourceCompatibility = 1.8 +sourceCompatibility = '1.8' repositories { mavenCentral() - flatDir { - dirs '../libs' + maven { + url file('../libs').toURI() } } diff --git a/features/fixtures/mazerunnerplainspring/build.gradle b/features/fixtures/mazerunnerplainspring/build.gradle index ddce65c6..beb828fd 100644 --- a/features/fixtures/mazerunnerplainspring/build.gradle +++ b/features/fixtures/mazerunnerplainspring/build.gradle @@ -4,12 +4,12 @@ plugins { group 'com.bugsnag.mazerunnerplainspring' -sourceCompatibility = 1.7 +sourceCompatibility = '1.8' repositories { mavenCentral() - flatDir { - dirs '../libs' + maven { + url file('../libs').toURI() } } diff --git a/features/fixtures/mazerunnerplainspring/gradle/wrapper/gradle-wrapper.jar b/features/fixtures/mazerunnerplainspring/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..6b6ea3ab Binary files /dev/null and b/features/fixtures/mazerunnerplainspring/gradle/wrapper/gradle-wrapper.jar differ diff --git a/features/fixtures/mazerunnerplainspring/gradle/wrapper/gradle-wrapper.properties b/features/fixtures/mazerunnerplainspring/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..66c44b07 --- /dev/null +++ b/features/fixtures/mazerunnerplainspring/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Jan 29 14:52:51 GMT 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/features/fixtures/mazerunnerplainspring/gradlew b/features/fixtures/mazerunnerplainspring/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/features/fixtures/mazerunnerplainspring/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# 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 () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +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 + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +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 + 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="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" "$@" diff --git a/features/fixtures/mazerunnerplainspring/gradlew.bat b/features/fixtures/mazerunnerplainspring/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/features/fixtures/mazerunnerplainspring/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +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 + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_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=%* + +: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% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/features/fixtures/mazerunnerplainspring6/build.gradle b/features/fixtures/mazerunnerplainspring6/build.gradle index 556be222..d53ec39a 100644 --- a/features/fixtures/mazerunnerplainspring6/build.gradle +++ b/features/fixtures/mazerunnerplainspring6/build.gradle @@ -6,8 +6,8 @@ group 'com.bugsnag.mazerunnerplainspring' repositories { mavenCentral() - flatDir { - dirs '../libs' + maven { + url file('../libs').toURI() } } diff --git a/features/fixtures/mazerunnerspringboot/build.gradle b/features/fixtures/mazerunnerspringboot/build.gradle index 2a348654..65556010 100644 --- a/features/fixtures/mazerunnerspringboot/build.gradle +++ b/features/fixtures/mazerunnerspringboot/build.gradle @@ -17,12 +17,12 @@ apply plugin: 'io.spring.dependency-management' group 'com.bugsnag.mazerunnerspringboot' version '1.0-SNAPSHOT' -sourceCompatibility = 1.7 +sourceCompatibility = '1.8' repositories { mavenCentral() - flatDir { - dirs '../libs' + maven { + url file('../libs').toURI() } } diff --git a/features/fixtures/mazerunnerspringboot/gradle/wrapper/gradle-wrapper.jar b/features/fixtures/mazerunnerspringboot/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..6b6ea3ab Binary files /dev/null and b/features/fixtures/mazerunnerspringboot/gradle/wrapper/gradle-wrapper.jar differ diff --git a/features/fixtures/mazerunnerspringboot/gradle/wrapper/gradle-wrapper.properties b/features/fixtures/mazerunnerspringboot/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..66c44b07 --- /dev/null +++ b/features/fixtures/mazerunnerspringboot/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Jan 29 14:52:51 GMT 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/features/fixtures/mazerunnerspringboot/gradlew b/features/fixtures/mazerunnerspringboot/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/features/fixtures/mazerunnerspringboot/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# 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 () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +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 + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +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 + 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="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" "$@" diff --git a/features/fixtures/mazerunnerspringboot/gradlew.bat b/features/fixtures/mazerunnerspringboot/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/features/fixtures/mazerunnerspringboot/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +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 + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_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=%* + +: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% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/features/fixtures/mazerunnerspringboot3/build.gradle b/features/fixtures/mazerunnerspringboot3/build.gradle index a5bf660c..77963142 100644 --- a/features/fixtures/mazerunnerspringboot3/build.gradle +++ b/features/fixtures/mazerunnerspringboot3/build.gradle @@ -19,8 +19,8 @@ version '1.0-SNAPSHOT' repositories { mavenCentral() - flatDir { - dirs '../libs' + maven { + url file('../libs').toURI() } } diff --git a/features/fixtures/scenarios/build.gradle b/features/fixtures/scenarios/build.gradle index aee70512..c7074b7b 100644 --- a/features/fixtures/scenarios/build.gradle +++ b/features/fixtures/scenarios/build.gradle @@ -2,12 +2,12 @@ apply plugin: 'java' group 'com.bugsnag.mazerunner' -sourceCompatibility = 1.7 +sourceCompatibility = '1.8' repositories { mavenCentral() - flatDir { - dirs '../libs' + maven { + url file('../libs').toURI() } } diff --git a/features/fixtures/settings.gradle b/features/fixtures/settings.gradle index 1771d139..3a78b3ca 100644 --- a/features/fixtures/settings.gradle +++ b/features/fixtures/settings.gradle @@ -3,7 +3,11 @@ include ':mazerunner', ':mazerunnerspringboot', ':scenarios' -if (JavaVersion.current() >= JavaVersion.VERSION_17) { - include ':mazerunnerspringboot3', - ':mazerunnerplainspring6' -} \ No newline at end of file +try { + if (JavaVersion.current() >= JavaVersion.VERSION_17) { + include ':mazerunnerspringboot3', + ':mazerunnerplainspring6' + } +} catch (ignored) { + // ignore any errors, they are almost always Gradle / JVM version issues +} diff --git a/features/scripts/assemble-fixtures.sh b/features/scripts/assemble-fixtures.sh index 47a54759..1f53250c 100755 --- a/features/scripts/assemble-fixtures.sh +++ b/features/scripts/assemble-fixtures.sh @@ -2,7 +2,5 @@ if [ ! -d "features/fixtures/libs" ]; then mkdir -p features/fixtures/libs - ./gradlew bugsnag:assemble bugsnag-spring:javax:assemble bugsnag-spring:assemble -Pversion=9.9.9-test - cp bugsnag/build/libs/bugsnag-9.9.9-test.jar features/fixtures/libs/bugsnag-9.9.9-test.jar - cp bugsnag-spring/build/libs/bugsnag-spring-9.9.9-test.jar features/fixtures/libs/bugsnag-spring-9.9.9-test.jar -fi \ No newline at end of file + unzip maven-repository.zip -d features/fixtures/libs +fi diff --git a/features/scripts/run-java-spring-boot-app.sh b/features/scripts/run-java-spring-boot-app.sh index 3014bdff..378dc467 100755 --- a/features/scripts/run-java-spring-boot-app.sh +++ b/features/scripts/run-java-spring-boot-app.sh @@ -2,7 +2,8 @@ catalina.sh stop if [[ "${JAVA_VERSION}" == "8"* ]]; then - ./gradlew -p features/fixtures/mazerunnerspringboot bootRun + cd features/fixtures/mazerunnerspringboot + ./gradlew bootRun else ./gradlew -p features/fixtures/mazerunnerspringboot3 bootRun fi \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 13b63305..875b5163 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=3.7.0 +version=3.7.1 group=com.bugsnag # Default properties diff --git a/release.gradle b/release.gradle index 3bd92f3e..5745f8c6 100644 --- a/release.gradle +++ b/release.gradle @@ -1,22 +1,34 @@ -apply plugin: 'net.researchgate.release' apply plugin: 'maven-publish' +apply plugin: 'signing' archivesBaseName = project.findProperty('artifactId') -release { - tagTemplate = 'v${version}' - versionPropertyFile = '../gradle.properties' +tasks.maybeCreate('sourceJar', Jar).configure { + from java.sourceSets.main.allJava } -nexusStaging { - packageGroup = "com.bugsnag" -} +publishing { -task sourceJar(type: Jar) { - from sourceSets.main.allJava -} + repositories { + maven { + name = "Sonatype" + if (rootProject.version.contains("SNAPSHOT")) { + url "https://oss.sonatype.org/content/repositories/snapshots/" + } else { + url "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + } + credentials { + username = project.hasProperty("NEXUS_USERNAME") ? "$NEXUS_USERNAME" : System.getenv("NEXUS_USERNAME") + password = project.hasProperty("NEXUS_PASSWORD") ? "$NEXUS_PASSWORD" : System.getenv("NEXUS_PASSWORD") + } + } -publishing { + maven { + name 'test' + url rootProject.file('build/repository').toURI().toString() + } + } + publications { Publication(MavenPublication) { from project(':' + project.name).components.java @@ -60,4 +72,8 @@ publishing { } } } + + signing { + sign publishing.publications + } } diff --git a/scripts/build-test-repository.sh b/scripts/build-test-repository.sh new file mode 100755 index 00000000..948547fe --- /dev/null +++ b/scripts/build-test-repository.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +./gradlew -xsignPublicationPublication -Preleasing=true -Pversion=9.9.9-test publishPublicationPublicationToTestRepository +cd build/repository/ || exit +zip -r ../../maven-repository.zip ./* diff --git a/settings.gradle b/settings.gradle index 332a86da..596924ce 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,5 @@ include ':bugsnag', - ':bugsnag-spring', - ':bugsnag-spring:javax' + ':bugsnag-spring' include ':examples:simple', ':examples:servlet-javax',