diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml new file mode 100644 index 0000000..028d748 --- /dev/null +++ b/.github/workflows/broken_links_checker.yml @@ -0,0 +1,22 @@ +name: Broken Links Checker + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Configure broken links checker + run: | + mkdir -p ./target + echo '{ "aliveStatusCodes": [429, 200] }' > ./target/broken_links_checker.json + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + config-file: ./target/broken_links_checker.json \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58d8b7f..9aaf1f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [11, 16] + java: [11, 17] + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-java-${{ matrix.java }} + cancel-in-progress: true + name: "Build with Java ${{ matrix.java }}" env: DEFAULT_JAVA: 11 @@ -26,18 +30,10 @@ jobs: with: distribution: 'temurin' java-version: ${{ matrix.java }} + cache: 'gradle' - uses: gradle/wrapper-validation-action@v1 - - name: Cache Gradle packages and wrapper - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-java-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-gradle- - - name: Cache SonarQube packages uses: actions/cache@v3 with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f1d848b..9b647bf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,7 +14,10 @@ jobs: runs-on: ubuntu-latest strategy: - fail-fast: false + fail-fast: true + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true steps: - name: Checkout repository @@ -24,15 +27,7 @@ jobs: with: distribution: 'temurin' java-version: 11 - - - name: Cache Gradle packages and wrapper - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: ${{ runner.os }}-gradle- + cache: 'gradle' - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 4d6d3e0..043173d 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,5 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull @@ -11,6 +12,7 @@ org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning @@ -68,6 +70,7 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning @@ -104,6 +107,7 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false org.eclipse.jdt.core.formatter.align_with_spaces=false @@ -132,6 +136,8 @@ org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon=0 org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 @@ -150,6 +156,7 @@ org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow=0 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_type_annotations=0 @@ -281,6 +288,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert @@ -373,6 +381,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert @@ -456,6 +465,8 @@ org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=100 @@ -497,5 +508,6 @@ org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator=false org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs index 30d85ad..85eaff2 100644 --- a/.settings/org.eclipse.jdt.ui.prefs +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -1,7 +1,8 @@ eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_ursusminor.de -formatter_settings_version=20 +formatter_settings_version=22 +org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_all=false sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false @@ -16,27 +17,35 @@ sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.array_with_curly=false sp_cleanup.arrays_fill=false sp_cleanup.bitwise_conditional_expression=false sp_cleanup.boolean_literal=false +sp_cleanup.boolean_value_rather_than_comparison=false sp_cleanup.break_loop=false sp_cleanup.collection_cloning=false +sp_cleanup.comparing_on_criteria=false sp_cleanup.comparison_statement=false +sp_cleanup.controlflow_merge=false sp_cleanup.convert_functional_interfaces=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false sp_cleanup.convert_to_switch_expressions=false sp_cleanup.correct_indentation=false +sp_cleanup.do_while_rather_than_while=false sp_cleanup.double_negation=false sp_cleanup.else_if=false sp_cleanup.embedded_if=false sp_cleanup.evaluate_nullable=false +sp_cleanup.extract_increment=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=false sp_cleanup.hash=false sp_cleanup.if_condition=false sp_cleanup.insert_inferred_type_arguments=false sp_cleanup.instanceof=false +sp_cleanup.instanceof_keyword=false +sp_cleanup.invert_equals=false sp_cleanup.join=false sp_cleanup.lazy_logical_operator=false sp_cleanup.make_local_variable_final=true @@ -46,6 +55,7 @@ sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.map_cloning=false sp_cleanup.merge_conditional_blocks=false +sp_cleanup.multi_catch=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.no_string_creation=false @@ -53,10 +63,18 @@ sp_cleanup.no_super=false sp_cleanup.number_suffix=false sp_cleanup.objects_equals=false sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false +sp_cleanup.operand_factorization=false sp_cleanup.organize_imports=true sp_cleanup.overridden_assignment=false +sp_cleanup.overridden_assignment_move_decl=false +sp_cleanup.plain_replacement=false sp_cleanup.precompile_regex=false +sp_cleanup.primitive_comparison=false +sp_cleanup.primitive_parsing=false +sp_cleanup.primitive_rather_than_wrapper=false sp_cleanup.primitive_serialization=false +sp_cleanup.pull_out_if_from_if_else=false sp_cleanup.pull_up_assignment=false sp_cleanup.push_down_negation=false sp_cleanup.qualify_static_field_accesses_with_declaring_class=false @@ -64,6 +82,8 @@ sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.reduce_indentation=false +sp_cleanup.redundant_comparator=false sp_cleanup.redundant_falling_through_block_end=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_redundant_modifiers=false @@ -77,18 +97,35 @@ sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_method_parameters=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true +sp_cleanup.return_expression=false sp_cleanup.simplify_lambda_expression_and_method_ref=false +sp_cleanup.single_used_field=false sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false +sp_cleanup.standard_comparison=false +sp_cleanup.static_inner_class=false sp_cleanup.strictly_equal_or_different=false +sp_cleanup.stringbuffer_to_stringbuilder=false sp_cleanup.stringbuilder=false +sp_cleanup.stringbuilder_for_local_vars=false +sp_cleanup.stringconcat_to_textblock=false +sp_cleanup.substring=false sp_cleanup.switch=false +sp_cleanup.system_property=false +sp_cleanup.system_property_boolean=false +sp_cleanup.system_property_file_encoding=false +sp_cleanup.system_property_file_separator=false +sp_cleanup.system_property_line_separator=false +sp_cleanup.system_property_path_separator=false sp_cleanup.ternary_operator=false sp_cleanup.try_with_resource=false +sp_cleanup.unlooped_while=false +sp_cleanup.unreachable_block=false sp_cleanup.use_anonymous_class_creation=false sp_cleanup.use_autoboxing=false sp_cleanup.use_blocks=true @@ -96,6 +133,7 @@ sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_directly_map_method=false sp_cleanup.use_lambda=true sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_string_is_blank=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false @@ -104,3 +142,4 @@ sp_cleanup.use_unboxing=false sp_cleanup.use_var=false sp_cleanup.useless_continue=false sp_cleanup.useless_return=false +sp_cleanup.valueof_rather_than_instantiation=false diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb96d6..baa8dd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Pull request [#24](https://github.com/itsallcode/openfasttrace-gradle/pull/24): +- [PR #24](https://github.com/itsallcode/openfasttrace-gradle/pull/24): - Upgrade to [OpenFastTrace 3.2.1](https://github.com/itsallcode/openfasttrace/releases/tag/3.2.1) - Upgrade other dependencies - Build and test with Java 16. Please note that Java 16 is only supported with Gradle 7.0+. -- [25](https://github.com/itsallcode/openfasttrace-gradle/pull/25): Upgrade build to Gradle 7.2, test with 7.0. +- [PR #25](https://github.com/itsallcode/openfasttrace-gradle/pull/25): Upgrade build to Gradle 7.2, test with 7.0. +- [PR #32](https://github.com/itsallcode/openfasttrace-gradle/pull/32): Upgrade dependencies + - Upgrade to [OpenFastTrace 3.5.0](https://github.com/itsallcode/openfasttrace/releases/tag/3.5.0) + - Gradle 6.0 is no longer supported. + - Build and test with Java 17. Please note that Java 17 is only supported with Gradle 7.5+. +- [PR #33](https://github.com/itsallcode/openfasttrace-gradle/pull/33): Removed license header from sources ## [0.9.0] - 2021-05-30 diff --git a/README.md b/README.md index 922ce0b..b19c8bc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Gradle plugin for the requirement tracing suite [OpenFastTrace](https://github.c ## Usage -1. Preconditions: Java 11 and Gradle 6.0 +1. Preconditions: Java 11 and Gradle 7.0 1. Add plugin [`org.itsallcode.openfasttrace`](https://plugins.gradle.org/plugin/org.itsallcode.openfasttrace) to your project: ```gradle @@ -27,7 +27,7 @@ Gradle plugin for the requirement tracing suite [OpenFastTrace](https://github.c 1. Run ```bash - $ ./gradlew traceRequirements + ./gradlew traceRequirements ``` 1. Report is written to `build/reports/tracing.txt` by default. @@ -148,16 +148,16 @@ Import into eclipse using [buildship](https://projects.eclipse.org/projects/tool 1. Select Project root directory 1. Click "Finish" -### Generate license header for added files: +### Check if dependencies are up-to-date ```bash -$ ./gradlew licenseFormat +./gradlew dependencyUpdates ``` -### Check if dependencies are up-to-date +### Check dependencies for vulnerabilities ```bash -$ ./gradlew dependencyUpdates +./gradlew ossIndexAudit ``` ### Run local sonar analysis @@ -189,7 +189,7 @@ gradle.publish.secret = 1. Run ```bash - $ ./gradlew clean publishPlugins --info + ./gradlew clean publishPlugins --info ``` Plugin will be published at https://plugins.gradle.org/m2/org/itsallcode/openfasttrace/org.itsallcode.openfasttrace.gradle.plugin/ diff --git a/build.gradle b/build.gradle index 015f071..d76b823 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,11 @@ plugins { id 'java-gradle-plugin' id 'jacoco' - id 'com.gradle.plugin-publish' version '0.15.0' - id 'com.github.hierynomus.license' version '0.16.1' - id 'org.sonarqube' version '3.3' + id 'com.gradle.plugin-publish' version '1.0.0' + id 'org.sonarqube' version '3.4.0.2513' id 'pl.droidsonroids.jacoco.testkit' version '1.0.9' - id 'com.github.ben-manes.versions' version '0.39.0' + id 'com.github.ben-manes.versions' version '0.42.0' + id 'org.sonatype.gradle.plugins.scan' version '2.4.1' } repositories { @@ -21,8 +21,8 @@ targetCompatibility = 11 ext { gradlePluginId = 'org.itsallcode.openfasttrace' - oftVersion = '3.2.1' - junitVersion = '5.7.2' + oftVersion = '3.5.0' + junitVersion = '5.9.0' if (project.hasProperty('oftSourceDir')) { oftSourceDir = file(project.oftSourceDir) useOftSources = oftSourceDir.exists() @@ -79,25 +79,20 @@ clean { propertyFiles.each { delete it } } -gradlePlugin { - plugins { - openFastTracePlugin { - id = gradlePluginId - implementationClass = 'org.itsallcode.openfasttrace.gradle.OpenFastTracePlugin' - } - } -} - pluginBundle { website = 'https://github.com/itsallcode/openfasttrace-gradle' - vcsUrl = 'https://github.com/itsallcode/openfasttrace-gradle' - description = 'Gradle plugin for tracing requirements using OpenFastTrace' + vcsUrl = 'https://github.com/itsallcode/openfasttrace-gradle.git' tags = ['requirementstracing', 'requirements', 'tracing', 'reqtracing', 'openfasttrace', 'oft'] +} +gradlePlugin { + description = 'Gradle plugin for tracing requirements using OpenFastTrace' plugins { openFastTracePlugin { id = gradlePluginId + implementationClass = 'org.itsallcode.openfasttrace.gradle.OpenFastTracePlugin' displayName = 'OpenFastTrace requirements tracing plugin' + description = 'Gradle plugin for tracing requirements using OpenFastTrace' } } } @@ -123,20 +118,6 @@ project.tasks["sonarqube"].dependsOn jacocoTestReport publishPlugins.dependsOn check -license { - header = file('gradle/license-header.txt') - strictCheck = true - skipExistingHeaders = false - ext.year = 2017 - ext.name = "It's all code" - ext.email = 'christoph at users.sourceforge.net' -} - -downloadLicenses { - includeProjectDependencies = true - ignoreFatalParseErrors = false -} - def isNonStable = { String version -> def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) } def regex = /^[0-9,.v-]+(-r)?$/ @@ -149,3 +130,12 @@ tasks.named("dependencyUpdates").configure { isNonStable(it.candidate.version) && !isNonStable(it.currentVersion) } } + +ossIndexAudit { + allConfigurations = false + useCache = true + excludeVulnerabilityIds = [] + printBanner = false +} + +rootProject.tasks["build"].dependsOn(tasks["ossIndexAudit"]) diff --git a/gradle/license-header.txt b/gradle/license-header.txt deleted file mode 100644 index 10a6b33..0000000 --- a/gradle/license-header.txt +++ /dev/null @@ -1,15 +0,0 @@ -openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace -Copyright (C) ${year} ${name} <${email}> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefa..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..53a6b23 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 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 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePlugin.java b/src/main/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePlugin.java index 2a0bc59..0e95114 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePlugin.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePlugin.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle; import static java.util.stream.Collectors.toList; @@ -45,14 +28,14 @@ public class OpenFastTracePlugin implements Plugin private static final String TASK_GROUP_NAME = "trace"; @Override - public void apply(Project rootProject) + public void apply(final Project rootProject) { LOG.info("Initializing OpenFastTrack plugin for project '{}'", rootProject); rootProject.allprojects(this::createConfigDsl); createTasks(rootProject); } - private void createConfigDsl(Project project) + private void createConfigDsl(final Project project) { LOG.info("Setting up plugin configuration for project '{}'", project.getName()); @@ -62,14 +45,14 @@ private void createConfigDsl(Project project) project); } - private void createTasks(Project rootProject) + private void createTasks(final Project rootProject) { LOG.info("Creating tasks for project '{}'", rootProject.getName()); final TaskProvider collectTask = createCollectTask(rootProject); createTracingTask(rootProject, collectTask); } - private TaskProvider createCollectTask(Project rootProject) + private TaskProvider createCollectTask(final Project rootProject) { return rootProject.getTasks().register("collectRequirements", CollectTask.class, task -> { task.setGroup(TASK_GROUP_NAME); @@ -81,7 +64,8 @@ private TaskProvider createCollectTask(Project rootProject) }); } - private void createTracingTask(Project rootProject, TaskProvider collectTask) + private void createTracingTask(final Project rootProject, + final TaskProvider collectTask) { rootProject.getTasks().register("traceRequirements", TraceTask.class, task -> { task.setGroup(TASK_GROUP_NAME); @@ -110,7 +94,7 @@ private void createTracingTask(Project rootProject, TaskProvider co }); } - private Set getAllInputDirectories(Set allProjects) + private Set getAllInputDirectories(final Set allProjects) { return allProjects.stream() // .map(project -> getConfig(project).getInputDirectories().getFiles()) // @@ -118,15 +102,14 @@ private Set getAllInputDirectories(Set allProjects) .collect(toSet()); } - private Set getImportedRequirements(Set allProjects) + private Set getImportedRequirements(final Set allProjects) { - return allProjects.stream() // .flatMap(this::getImportedRequirements) // .collect(toSet()); } - private Stream getImportedRequirements(Project project) + private Stream getImportedRequirements(final Project project) { final String configurationName = "oftRequirementConfig"; final Configuration configuration = project.getConfigurations().create(configurationName); @@ -140,7 +123,7 @@ private Stream getImportedRequirements(Project project) return files.stream(); } - private List getPathConfig(Set allProjects) + private List getPathConfig(final Set allProjects) { return allProjects.stream() // .map(this::getTagPathConfig) // @@ -149,7 +132,7 @@ private List getPathConfig(Set allProjects) .collect(toList()); } - private Optional getTagPathConfig(Project project) + private Optional getTagPathConfig(final Project project) { final TagPathConfiguration tagPathConfig = getConfig(project).getTagPathConfig(); if (tagPathConfig.getPathConfig().isEmpty()) @@ -159,7 +142,7 @@ private Optional getTagPathConfig(Project project) return Optional.of(new SerializableTagPathConfig(tagPathConfig)); } - private TracingConfig getConfig(Project project) + private TracingConfig getConfig(final Project project) { return project.getExtensions().getByType(TracingConfig.class); } diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagConfig.java b/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagConfig.java index 2e5c32e..0378dc8 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagConfig.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagConfig.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle.config; import org.gradle.api.Project; @@ -31,7 +14,7 @@ public class TagConfig public String tagArtifactType; public String coveredItemNamePrefix; - TagConfig(Project project) + TagConfig(final Project project) { this.project = project; } diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagPathConfiguration.java b/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagPathConfiguration.java index e05d1d6..48dc016 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagPathConfiguration.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/config/TagPathConfiguration.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle.config; import java.util.ArrayList; @@ -28,12 +11,12 @@ public class TagPathConfiguration private final Project project; private final List tagConfigs = new ArrayList<>(); - public TagPathConfiguration(Project project) + public TagPathConfiguration(final Project project) { this.project = project; } - public void tag(Action action) + public void tag(final Action action) { final TagConfig tagConfig = new TagConfig(project); action.execute(tagConfig); diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/config/TracingConfig.java b/src/main/java/org/itsallcode/openfasttrace/gradle/config/TracingConfig.java index f4b9dba..f51847a 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/config/TracingConfig.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/config/TracingConfig.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle.config; import java.util.List; @@ -41,7 +24,7 @@ public class TracingConfig private final ListProperty filteredArtifactTypes; private final Property filterAcceptsItemsWithoutTag; - public TracingConfig(Project project) + public TracingConfig(final Project project) { this.inputDirectories = project.files(); this.reportFile = project.getObjects().fileProperty(); @@ -96,47 +79,47 @@ public Property getFilterAcceptsItemsWithoutTag() return filterAcceptsItemsWithoutTag; } - public void setReportVerbosity(String reportVerbosity) + public void setReportVerbosity(final String reportVerbosity) { setReportVerbosity(ReportVerbosity.valueOf(reportVerbosity)); } - public void setReportVerbosity(ReportVerbosity reportVerbosity) + public void setReportVerbosity(final ReportVerbosity reportVerbosity) { this.reportVerbosity.set(reportVerbosity); } - public void setReportFormat(String reportFormat) + public void setReportFormat(final String reportFormat) { this.reportFormat.set(reportFormat); } - public void setInputDirectories(ConfigurableFileCollection inputDirectories) + public void setInputDirectories(final ConfigurableFileCollection inputDirectories) { this.inputDirectories.setFrom(inputDirectories); } - public void setReportFile(RegularFileProperty reportFile) + public void setReportFile(final RegularFileProperty reportFile) { this.reportFile.set(reportFile); } - public void setImportedRequirements(List importedRequirements) + public void setImportedRequirements(final List importedRequirements) { this.importedRequirements.set(importedRequirements); } - public void setFilteredTags(List filteredTags) + public void setFilteredTags(final List filteredTags) { this.filteredTags.set(filteredTags); } - public void setFilteredArtifactTypes(List filteredArtifactTypes) + public void setFilteredArtifactTypes(final List filteredArtifactTypes) { this.filteredArtifactTypes.set(filteredArtifactTypes); } - public void setFilterAcceptsItemsWithoutTag(boolean filterAcceptsItemsWithoutTag) + public void setFilterAcceptsItemsWithoutTag(final boolean filterAcceptsItemsWithoutTag) { this.filterAcceptsItemsWithoutTag.set(filterAcceptsItemsWithoutTag); } diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java b/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java index 2c40244..9f18cfb 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle.task; import static java.util.stream.Collectors.joining; @@ -41,7 +24,6 @@ import org.itsallcode.openfasttrace.core.ExportSettings; import org.itsallcode.openfasttrace.core.Oft; import org.itsallcode.openfasttrace.core.OftRunner; -import org.itsallcode.openfasttrace.exporter.specobject.SpecobjectExporterFactory; import org.itsallcode.openfasttrace.gradle.task.config.SerializableTagPathConfig; public class CollectTask extends DefaultTask @@ -89,7 +71,7 @@ public void collectRequirements() throws IOException private ExportSettings getExportSettings() { return ExportSettings.builder() // - .outputFormat(SpecobjectExporterFactory.SUPPORTED_FORMAT) // + .outputFormat("specobject") // .newline(Newline.UNIX) // .build(); } @@ -127,7 +109,7 @@ private List getPathConfigInternal() return paths; } - private String formatPathConfig(PathConfig config) + private String formatPathConfig(final PathConfig config) { return " - " + config.getDescription() + " (type " + config.getTagArtifactType() + "): covers '" + config.getCoveredItemArtifactType() + "', prefix: '" diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java b/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java index 64b5bb9..d7d8ba9 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle.task; import static java.util.stream.Collectors.toList; diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagConfig.java b/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagConfig.java index 8ab5f8c..f4fc4b5 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagConfig.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagConfig.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle.task.config; import static java.util.stream.Collectors.toList; @@ -37,7 +20,7 @@ public class SerializableTagConfig implements Serializable private final String tagArtifactType; private final String coveredItemNamePrefix; - public SerializableTagConfig(TagConfig tagConfig) + public SerializableTagConfig(final TagConfig tagConfig) { paths = tagConfig.paths.getFiles(); coveredItemArtifactType = tagConfig.coveredItemArtifactType; diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagPathConfig.java b/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagPathConfig.java index a146abd..a6864cb 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagPathConfig.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/task/config/SerializableTagPathConfig.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle.task.config; import static java.util.stream.Collectors.toList; @@ -33,7 +16,7 @@ public class SerializableTagPathConfig implements Serializable private final List tagConfigs; - public SerializableTagPathConfig(TagPathConfiguration tagPathConfig) + public SerializableTagPathConfig(final TagPathConfiguration tagPathConfig) { tagConfigs = tagPathConfig.getPathConfig().stream().map(SerializableTagConfig::new) .collect(toList()); diff --git a/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java b/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java index 4baaf37..49622a3 100644 --- a/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java +++ b/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java @@ -1,36 +1,22 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle; public enum GradleTestConfig { - CURRENT_VERSION(null), SIX_ZERO("6.0"), SEVEN_ZERO("7.0"); + CURRENT_VERSION(null), SEVEN_ZERO("7.0"), SEVEN_FIVE("7.5.1"); public final String gradleVersion; - private GradleTestConfig(String gradleVersion) + private GradleTestConfig(final String gradleVersion) { this.gradleVersion = gradleVersion; } - public boolean supportedWithJvm() { - if(this == SIX_ZERO) { - return System.getProperty("java.version").startsWith("11"); + public boolean supportedWithJvm() + { + final boolean isJava11 = System.getProperty("java.version").startsWith("11"); + if (this == SEVEN_ZERO) + { + return isJava11; } return true; } diff --git a/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java b/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java index b9c862b..2c76037 100644 --- a/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java +++ b/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle; import static java.util.Arrays.asList; @@ -61,7 +44,7 @@ class OpenFastTracePluginTest @ParameterizedTest @EnumSource - void testTracingTaskAddedToProject(GradleTestConfig config) + void testTracingTaskAddedToProject(final GradleTestConfig config) { final BuildResult buildResult = runBuild(config, PROJECT_DEFAULT_CONFIG_DIR, "tasks"); assertThat(buildResult.getOutput(), containsString( @@ -70,7 +53,7 @@ void testTracingTaskAddedToProject(GradleTestConfig config) @ParameterizedTest @EnumSource - void testTraceExampleProjectWithDefaultConfig(GradleTestConfig config) throws IOException + void testTraceExampleProjectWithDefaultConfig(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, PROJECT_DEFAULT_CONFIG_DIR, "clean", "traceRequirements"); @@ -81,7 +64,7 @@ void testTraceExampleProjectWithDefaultConfig(GradleTestConfig config) throws IO @ParameterizedTest @EnumSource - void testCollectExampleProjectWithCustomConfig(GradleTestConfig config) throws IOException + void testCollectExampleProjectWithCustomConfig(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "clean", "collectRequirements"); @@ -125,7 +108,7 @@ void testCollectExampleProjectWithCustomConfig(GradleTestConfig config) throws I @ParameterizedTest @EnumSource - void testCollectIsUpToDateWhenAlreadyRunBefore(GradleTestConfig config) throws IOException + void testCollectIsUpToDateWhenAlreadyRunBefore(final GradleTestConfig config) throws IOException { BuildResult buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "clean", "collectRequirements"); @@ -136,7 +119,7 @@ void testCollectIsUpToDateWhenAlreadyRunBefore(GradleTestConfig config) throws I @ParameterizedTest @EnumSource - void testHtmlReportConfig(GradleTestConfig config) throws IOException + void testHtmlReportConfig(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, HTML_REPORT_CONFIG_DIR, "clean", "traceRequirements"); @@ -148,7 +131,7 @@ void testHtmlReportConfig(GradleTestConfig config) throws IOException @ParameterizedTest @EnumSource - void testTraceTaskUpToDateWhenAlreadyRun(GradleTestConfig config) throws IOException + void testTraceTaskUpToDateWhenAlreadyRun(final GradleTestConfig config) throws IOException { BuildResult buildResult = runBuild(config, HTML_REPORT_CONFIG_DIR, "clean", "traceRequirements"); @@ -159,7 +142,7 @@ void testTraceTaskUpToDateWhenAlreadyRun(GradleTestConfig config) throws IOExcep @ParameterizedTest @EnumSource - void testTraceExampleProjectWithCustomConfig(GradleTestConfig config) throws IOException + void testTraceExampleProjectWithCustomConfig(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "clean", "traceRequirements"); @@ -171,7 +154,7 @@ void testTraceExampleProjectWithCustomConfig(GradleTestConfig config) throws IOE @ParameterizedTest @EnumSource - void testTraceMultiProject(GradleTestConfig config) throws IOException + void testTraceMultiProject(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, MULTI_PROJECT_DIR, "clean", "traceRequirements"); @@ -181,7 +164,7 @@ void testTraceMultiProject(GradleTestConfig config) throws IOException @ParameterizedTest @EnumSource - void testTraceDependencyProject(GradleTestConfig config) throws IOException + void testTraceDependencyProject(final GradleTestConfig config) throws IOException { BuildResult buildResult = runBuild(config, DEPENDENCY_CONFIG_DIR, "clean"); final Path dependencyZip = DEPENDENCY_CONFIG_DIR.resolve("build/repo/requirements-1.0.zip"); @@ -197,7 +180,7 @@ void testTraceDependencyProject(GradleTestConfig config) throws IOException @ParameterizedTest @EnumSource - void testPublishToMavenRepo(GradleTestConfig config) throws IOException + void testPublishToMavenRepo(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, PUBLISH_CONFIG_DIR, "clean", "publishToMavenLocal"); @@ -227,7 +210,8 @@ void testPublishToMavenRepo(GradleTestConfig config) throws IOException } } - private static String readEntry(ZipFile zip, String entryName) throws IOException, ZipException + private static String readEntry(final ZipFile zip, final String entryName) + throws IOException, ZipException { final ZipArchiveEntry reqirementsEntry = zip.getEntry(entryName); try (BufferedReader reader = new BufferedReader( @@ -248,7 +232,7 @@ private static void createDependencyZip(final Path dependencyZip) throws IOExcep } } - private static void assertFileContent(Path file, String... lines) throws IOException + private static void assertFileContent(final Path file, final String... lines) throws IOException { final String fileContent = fileContent(file); for (final String line : lines) @@ -257,13 +241,13 @@ private static void assertFileContent(Path file, String... lines) throws IOExcep } } - private static String fileContent(Path file) throws IOException + private static String fileContent(final Path file) throws IOException { return new String(Files.readAllBytes(file), StandardCharsets.UTF_8); } - private static BuildResult runBuild(GradleTestConfig config, Path projectDir, - String... arguments) + private static BuildResult runBuild(final GradleTestConfig config, final Path projectDir, + final String... arguments) { assumeTrue(config.supportedWithJvm()); configureJacoco(projectDir); @@ -286,7 +270,7 @@ private static BuildResult runBuild(GradleTestConfig config, Path projectDir, return runner.build(); } - private static void configureJacoco(Path projectDir) + private static void configureJacoco(final Path projectDir) { final String testkitGradleConfig = TestUtil.readResource(OpenFastTracePluginTest.class, "/testkit-gradle.properties"); diff --git a/src/test/java/org/itsallcode/openfasttrace/gradle/TestUtil.java b/src/test/java/org/itsallcode/openfasttrace/gradle/TestUtil.java index d35ca01..5b342cd 100644 --- a/src/test/java/org/itsallcode/openfasttrace/gradle/TestUtil.java +++ b/src/test/java/org/itsallcode/openfasttrace/gradle/TestUtil.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle; import java.io.BufferedReader; @@ -28,7 +11,7 @@ public class TestUtil { - public static String readResource(Class clazz, String resourceName) + public static String readResource(final Class clazz, final String resourceName) { final URL resource = clazz.getResource(resourceName); if (resource == null) @@ -52,7 +35,7 @@ public static String readResource(Class clazz, String resourceName) } } - public static void writeFile(Path file, String content) + public static void writeFile(final Path file, final String content) { try { diff --git a/src/test/java/org/itsallcode/openfasttrace/gradle/ZipFileBuilder.java b/src/test/java/org/itsallcode/openfasttrace/gradle/ZipFileBuilder.java index 37facf5..727299e 100644 --- a/src/test/java/org/itsallcode/openfasttrace/gradle/ZipFileBuilder.java +++ b/src/test/java/org/itsallcode/openfasttrace/gradle/ZipFileBuilder.java @@ -1,20 +1,3 @@ -/** - * openfasttrace-gradle - Gradle plugin for tracing requirements using OpenFastTrace - * Copyright (C) 2017 It's all code - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ package org.itsallcode.openfasttrace.gradle; import java.io.File; @@ -30,24 +13,24 @@ public class ZipFileBuilder implements AutoCloseable { private final ZipOutputStream zipOutputStream; - private ZipFileBuilder(ZipOutputStream zipOutputStream) + private ZipFileBuilder(final ZipOutputStream zipOutputStream) { this.zipOutputStream = zipOutputStream; } - public static ZipFileBuilder create(Path target) throws IOException + public static ZipFileBuilder create(final Path target) throws IOException { return create(target.toFile()); } - public static ZipFileBuilder create(File target) throws IOException + public static ZipFileBuilder create(final File target) throws IOException { final ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(target), StandardCharsets.UTF_8); return new ZipFileBuilder(zipOutputStream); } - public ZipFileBuilder addEntry(final String entryName, Path file) throws IOException + public ZipFileBuilder addEntry(final String entryName, final Path file) throws IOException { addEntry(entryName, Files.readAllBytes(file)); return this;