diff --git a/eng/pipelines/client.yml b/eng/pipelines/client.yml index 4f0b8f0df83c..7fc3fda5fb57 100644 --- a/eng/pipelines/client.yml +++ b/eng/pipelines/client.yml @@ -72,13 +72,25 @@ jobs: condition: and(succeededOrFailed(), ne(variables['Build.Reason'], 'PullRequest')) displayName: 'Component Detection' - # We `install` separately from running `site:site site:stage` so that the `install` brings in the non-shipping-modules, - # but we don't include them in the Maven site commands (so that we don't generate reports for the non-shipping modules). + # We `install` the code quality reports tooling into our local m2 cache separately from building the Maven project + # reports. This means it is available as part of that, but also so that this is not documented in the project report. - task: Maven@3 displayName: 'Install reporting tools' + inputs: + mavenPomFile: eng/code-quality-reports/pom.xml + options: '--batch-mode' + mavenOptions: '$(LoggingOptions)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' + + - task: Maven@3 + displayName: 'Install all client libraries (for SpotBugs analysis)' inputs: mavenPomFile: pom.client.xml - options: '$(DefaultOptions) -Djava-lts -Dinclude-non-shipping-modules -DskipTests -Dgpg.skip' + options: '$(DefaultOptions) -Djava-lts -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true' mavenOptions: '$(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' @@ -86,8 +98,24 @@ jobs: publishJUnitResults: false goals: 'install' + # Run SpotBugs and CheckStyle tools to ensure high code quality - these will fail the build if issues are found + - task: Maven@3 + displayName: 'Run SpotBugs and CheckStyle' + inputs: + mavenPomFile: pom.client.xml + options: '-Djava-lts -DskipTests -Dgpg.skip' + mavenOptions: '' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'spotbugs:spotbugs checkstyle:checkstyle' + + # Generate the Maven site report, including SpotBugs, JavaDoc, CheckStyle, Jacoco, etc only when we are not + # running as a PR check. - task: Maven@3 displayName: 'Generate Maven project site, including JavaDocs, SpotBugs, and CheckStyle reports' + condition: ne(variables['Build.Reason'], 'PullRequest') inputs: mavenPomFile: pom.client.xml options: '$(DefaultOptions) -Djava-lts -DskipTests -Dgpg.skip' @@ -96,7 +124,22 @@ jobs: jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false - goals: 'site:site site:stage' + goals: 'install site:site site:stage' + + # We run a separate SpotBugs aggregate report step here to roll-up all the issues identified per-module in the + # previous step. This is only generated in non-PR builds (i.e. nightly runs, etc) + - task: Maven@3 + displayName: 'Run SpotBugs' + condition: ne(variables['Build.Reason'], 'PullRequest') + inputs: + mavenPomFile: eng/spotbugs-aggregate-report/pom.xml + options: '--batch-mode -Djava-lts -DskipTests -Dgpg.skip' + mavenOptions: '$(LoggingOptions)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' - script: | git clone https://github.com/JonathanGiles/DependencyChecker.git @@ -127,12 +170,14 @@ jobs: publishJUnitResults: false goals: 'clean package exec:java' + # We only copy artifacts into the staging in nightly builds, we don't bother with this for PR validation builds. - powershell: | copy -r target/staging $(Build.ArtifactStagingDirectory) copy eng/code-quality-reports/src/main/resources/index.html $(Build.ArtifactStagingDirectory) copy eng/spotbugs-aggregate-report/target/spotbugs/spotbugsXml.html (Join-Path $(Build.ArtifactStagingDirectory) "staging") copy output/dependencies.html (Join-Path $(Build.ArtifactStagingDirectory) "staging") displayName: 'Copy reports to artifact staging' + condition: ne(variables['Build.Reason'], 'PullRequest') - task: PublishPipelineArtifact@0 condition: succeededOrFailed() diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 6846affce688..68949203610d 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -67,13 +67,25 @@ jobs: condition: and(succeededOrFailed(), ne(variables['Build.Reason'], 'PullRequest')) displayName: 'Component Detection' - # We `install` separately from running `site:site site:stage` so that the `install` brings in the non-shipping-modules, - # but we don't include them in the Maven site commands (so that we don't generate reports for the non-shipping modules). + # We `install` the code quality reports tooling into our local m2 cache separately from building the Maven project + # reports. This means it is available as part of that, but also so that this is not documented in the project report. - task: Maven@3 displayName: 'Install reporting tools' + inputs: + mavenPomFile: eng/code-quality-reports/pom.xml + options: '--batch-mode' + mavenOptions: '$(LoggingOptions)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' + + - task: Maven@3 + displayName: 'Install all client libraries (for SpotBugs analysis)' inputs: mavenPomFile: pom.client.xml - options: '$(DefaultOptions) -Djava-lts -Dinclude-non-shipping-modules -DskipTests -Dgpg.skip' + options: '$(DefaultOptions) -Djava-lts -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true' mavenOptions: '$(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' @@ -81,8 +93,24 @@ jobs: publishJUnitResults: false goals: 'install' + # Run SpotBugs and CheckStyle tools to ensure high code quality - these will fail the build if issues are found + - task: Maven@3 + displayName: 'Run SpotBugs and CheckStyle' + inputs: + mavenPomFile: pom.client.xml + options: '-Djava-lts -DskipTests -Dgpg.skip' + mavenOptions: '' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'spotbugs:spotbugs checkstyle:checkstyle' + + # Generate the Maven site report, including SpotBugs, JavaDoc, CheckStyle, Jacoco, etc only when we are not + # running as a PR check. - task: Maven@3 displayName: 'Generate Maven project site, including JavaDocs, SpotBugs, and CheckStyle reports' + condition: ne(variables['Build.Reason'], 'PullRequest') inputs: mavenPomFile: pom.client.xml options: '$(DefaultOptions) -Djava-lts -DskipTests -Dgpg.skip' @@ -91,7 +119,22 @@ jobs: jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false - goals: 'site:site site:stage' + goals: 'install site:site site:stage' + + # We run a separate SpotBugs aggregate report step here to roll-up all the issues identified per-module in the + # previous step. This is only generated in non-PR builds (i.e. nightly runs, etc) + - task: Maven@3 + displayName: 'Run SpotBugs' + condition: ne(variables['Build.Reason'], 'PullRequest') + inputs: + mavenPomFile: eng/spotbugs-aggregate-report/pom.xml + options: '--batch-mode -Djava-lts -DskipTests -Dgpg.skip' + mavenOptions: '$(LoggingOptions)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' - script: | git clone https://github.com/JonathanGiles/DependencyChecker.git @@ -122,12 +165,14 @@ jobs: publishJUnitResults: false goals: 'clean package exec:java' + # We only copy artifacts into the staging in nightly builds, we don't bother with this for PR validation builds. - powershell: | copy -r target/staging $(Build.ArtifactStagingDirectory) copy eng/code-quality-reports/src/main/resources/index.html $(Build.ArtifactStagingDirectory) copy eng/spotbugs-aggregate-report/target/spotbugs/spotbugsXml.html (Join-Path $(Build.ArtifactStagingDirectory) "staging") copy output/dependencies.html (Join-Path $(Build.ArtifactStagingDirectory) "staging") displayName: 'Copy reports to artifact staging' + condition: ne(variables['Build.Reason'], 'PullRequest') - task: PublishBuildArtifacts@1 condition: succeededOrFailed() @@ -135,6 +180,7 @@ jobs: inputs: artifactName: reports + - job: 'Test' variables: diff --git a/pom.client.xml b/pom.client.xml index d4ed7878ba44..ed6cbb10b7c9 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -454,20 +454,6 @@ - - org.apache.maven.plugins - maven-jxr-plugin - 3.0.0 - - - aggregate - false - - aggregate - - - - org.apache.maven.plugins maven-checkstyle-plugin @@ -504,21 +490,14 @@ com.github.spotbugs spotbugs-maven-plugin ${spotbugs.maven.version} - - - non-aggregate - - spotbugs - - - - aggregate - false - - spotbugs - - - + + Max + Low + true + ${project.build.directory}/spotbugs + eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml + true + org.apache.maven.plugins @@ -573,9 +552,6 @@ ci-management dependencies issue-management - licenses - plugins - plugin-management