diff --git a/.github/workflows/on_pull_request_push_run_test_and_coverage.yml b/.github/workflows/on_pull_request_push_run_test_and_coverage.yml index 7f8bfdd0..2d679c55 100644 --- a/.github/workflows/on_pull_request_push_run_test_and_coverage.yml +++ b/.github/workflows/on_pull_request_push_run_test_and_coverage.yml @@ -18,16 +18,13 @@ jobs: env: TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }} TOKEN_FOR_GITLAB: ${{ secrets.TOKEN_FOR_GITLAB }} + # Seen on https://stackoverflow.com/a/70405596/15619 - name: Add coverage to PR id: jacoco - uses: madrapps/jacoco-report@v1.3 + uses: madrapps/jacoco-report@v1.6.1 with: - paths: | - ${{ github.workspace }}/architecture-documentation/target/site/jacoco/jacoco.xml, - ${{ github.workspace }}/markdown-to-asciidoc/target/site/jacoco/jacoco.xml, - ${{ github.workspace }}/maven-metadata-inferer/target/site/jacoco/jacoco.xml, - ${{ github.workspace }}/sequence-diagram-generator/target/site/jacoco/jacoco.xml - token: ${{ secrets.GITHUB_TOKEN }} + paths: "**/target/site/jacoco/jacoco.xml" + token: "${{ secrets.GITHUB_TOKEN }}" min-coverage-overall: 10 min-coverage-changed-files: 50 title: Current coverage (as computed by Jacoco) diff --git a/.github/workflows/on_push_on_master_deploy_build.yml b/.github/workflows/on_push_on_master_deploy_build.yml index c22124ff..4f1148d3 100644 --- a/.github/workflows/on_push_on_master_deploy_build.yml +++ b/.github/workflows/on_push_on_master_deploy_build.yml @@ -36,7 +36,7 @@ jobs: TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }} TOKEN_FOR_GITLAB: ${{ secrets.TOKEN_FOR_GITLAB }} - name: Upload artifact - uses: actions/upload-pages-artifact@main + uses: actions/upload-pages-artifact@v3.0.1 with: path: ./architecture-documentation/target/asciidoc/docs/html retention-days: ${{ inputs.retention-days }} @@ -51,4 +51,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v1 \ No newline at end of file + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/on_release_update_readme.yml b/.github/workflows/on_release_update_readme.yml deleted file mode 100644 index 5ef454be..00000000 --- a/.github/workflows/on_release_update_readme.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: On release update readme to have the correct version -on: - release: - types: - - published # It seems that you can publish directly witout creating -jobs: - replace_version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Modify version number in README - uses: vyan024/file-regex-replace-2023 - with: - regex: '=[0-9]+\.[0-9]+\.[0-9]+ ' - replacement: '=${{ github.event.release.tag_name }} ' - include: '^README\.md' # Optional, defaults to ".*" - - name: Modify version number in release action - uses: vyan024/file-regex-replace-2023 - with: - regex: '"[0-9]+\.[0-9]+\.[0-9]+"' - replacement: '=${{ github.event.release.tag_name }} ' - include: '^\.github\/workflows\/on_workflow_dispatch_perform_maven_release\.yml' # Optional, defaults to ".*" - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.TOKEN_FOR_GITHUB }} - commit-message: "Updated readme to have version ${{ github.event.release.tag_name }} in" - committer: GitHub - author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> - signoff: false - base: main - branch: chore/update-readme-version - branch-suffix: timestamp - delete-branch: true - title: 'πŸ€– Update readme version to ${{ github.event.release.tag_name }}' - body: | - This pull request has been generated by run of GitHub action ".github/workflows/on_release_update_readme.yml" - draft: false \ No newline at end of file diff --git a/.github/workflows/on_tag_generate_release_notes.yml b/.github/workflows/on_tag_generate_release_notes.yml deleted file mode 100644 index 494e4fae..00000000 --- a/.github/workflows/on_tag_generate_release_notes.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: On tag created generate GitHub release with notes -on: - push: - tags: - - '[0-9]+.[0-9]+.[0-9]+' - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: lakto/gren-action@v2.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - with: - options: '--override' \ No newline at end of file diff --git a/.github/workflows/on_workflow_dispatch_perform_maven_release.yml b/.github/workflows/on_workflow_dispatch_perform_maven_release.yml index a68dcb0e..85b601b4 100644 --- a/.github/workflows/on_workflow_dispatch_perform_maven_release.yml +++ b/.github/workflows/on_workflow_dispatch_perform_maven_release.yml @@ -9,7 +9,7 @@ on: releaseversion: description: 'Release version' required: true - default: "0.1.11" + default: "0.1.14" jobs: build: @@ -28,10 +28,12 @@ jobs: fetch-depth: '0' - name: Import GPG key id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 + uses: crazy-max/ghaction-import-gpg@v6.1.0 with: gpg_private_key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: List gpg keys (there should be only one) + run: gpg -K - name: Setup git configuration run: | git config --global user.email "aadarchi-releaser-bot@users.noreply.github.com" @@ -46,7 +48,7 @@ jobs: server-username: ${{ secrets.OSS_SONATYPE_USERNAME }} server-password: ${{ secrets.OSS_SONATYPE_PASSWORD }} - name: Do not forget to configure Maven Settings! - uses: s4u/maven-settings-action@v2.8.0 + uses: s4u/maven-settings-action@v3.0.0 with: override: true githubServer: true @@ -68,4 +70,13 @@ jobs: - name: Build with Maven run: mvn --no-transfer-progress -B release:prepare release:perform -Prelease --file pom.xml env: - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file + GITHUB_TOKEN: ${{ github.token }} + - name: Get created tag name (for GitHuub release creation) + id: tag + run: echo "CREATED_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + - name: Create associated GitHub release + uses: lakto/gren-action@v2.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + options: "--override --data-source=issues --prerelease --tags=${{ steps.tag.outputs.CREATED_GIT_TAG }}" \ No newline at end of file diff --git a/README.md b/README.md index 2b72accb..18075ce7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,9 @@ -

Welcome to Aadarchi πŸ‘‹

-

- -GitHub Workflow Status - - GitHub version -GitHub commit activity - - Twitter: Riduidel - -

+# Welcome to Aadarchi πŸ‘‹ + +[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/Riduidel/aadarchi/on_push_on_master_deploy_build.yml)](https://github.com/Riduidel/aadarchi/actions/workflows/on_push_on_master_deploy_build.yml) +[![GitHub version](https://badge.fury.io/gh/Riduidel%2Faadarchi.svg)](https://badge.fury.io/gh/Riduidel%2Faadarchi) +![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/Riduidel/aadarchi) +![Mastodon Follow](https://img.shields.io/mastodon/follow/000004227?domain=https%3A%2F%2Fframapiaf.org) > A Maven archetype allowing you to easily create your agile architecture documentation using a mix of C4, Asciidoc and PlantUML. This archetype uses [Structurizr](https://github.com/structurizr/java/) to build the architecture model, and [Agile architecture documentation](https://web.archive.org/web/20210518020154/http://www.codingthearchitecture.com/2016/05/31/agile_software_architecture_documentation.html) template, all by Simon Brown. @@ -18,7 +13,7 @@ You can use the archetype by running this maven-friendly πŸ˜…command. Current version is ![GitHub version](https://badge.fury.io/gh/Riduidel%2Faadarchi.svg) ```sh -mvn archetype:generate -DarchetypeVersion=0.1.11 -Daadarchi-version=0.1.11 -DarchetypeGroupId=io.github.Riduidel.aadarchi -DarchetypeArtifactId=archetype +mvn archetype:generate -DarchetypeVersion=0.1.14 -Daadarchi-version=0.1.14 -DarchetypeGroupId=io.github.Riduidel.aadarchi -DarchetypeArtifactId=archetype ``` This will ask you a few questions and generate the project. @@ -94,7 +89,7 @@ Way more details are available in the [architecture documentation (which uses th πŸ‘€ **Nicolas Delsaux** -* Twitter: [@Riduidel](https://twitter.com/Riduidel) +* Mastodon: [@Riduidel](https://framapiaf.org/@Riduidel) * Github: [@Riduidel](https://github.com/Riduidel) ## 🀝 Contributing diff --git a/aadarchi-maven-plugin/pom.xml b/aadarchi-maven-plugin/pom.xml index 13f05dcd..9d0fde0f 100644 --- a/aadarchi-maven-plugin/pom.xml +++ b/aadarchi-maven-plugin/pom.xml @@ -1,249 +1,250 @@ - - - - system - io.github.Riduidel.aadarchi - 0.1.12-SNAPSHOT - - 4.0.0 - - aadarchi-maven-plugin - maven-plugin - Aadarchi : Maven plugin - This maven plugin allows integration of our documentation system into maven builds by providing a set of useful mojos - - - 9.2.9.0 - - 4.3.0 - - - - - - mavengems - mavengem:https://rubygems.org - - - - - - - org.twdata.maven - mojo-executor - 2.4.0 - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.6.4 - provided - - - org.apache.maven - maven-plugin-api - 3.8.6 - - - ${project.groupId} - base - ${project.version} - - - javax.enterprise - cdi-api - - - - - ${project.groupId} - cdi-in-maven-plugin-helper - ${project.version} - - - javax.enterprise - cdi-api - - - - - - io.github.Riduidel.aadarchi - maven-metadata-inferer - ${project.version} - - - javax.enterprise - cdi-api - - - - - net.alchim31 - livereload-jvm - 0.2.0 - - - - - org.apache.commons - commons-vfs2 - - - org.apache.hadoop - hadoop-hdfs-client - - - - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.9.0 - - - - - - - org.torquebox.mojo - mavengem-wagon - 1.0.3 - - - - - - integration-tests - - - !skip_integration - - - - - - org.apache.maven.plugins - maven-invoker-plugin - 3.6.0 - - true - - ${project.version} - - src/it - - **/pom.xml - - - ${project.build.directory}/it - - ${project.build.directory}/local-repo - - src/it/settings.xml - verify.groovy - - - - - - install - run - - - - - - - - - Download rubgems in a scope where I can access that damned repository - - - ${basedir}/src/main/resources/META-INF/gems - - - - 0.5.0 - 4.1.0 - ${project.basedir}/src/main/resources/META-INF/gems - - - - - rubygems - asciidoctor-kroki - ${version.asciidoctor.kroki} - gem - - - - rubygems - asciidoctor - - - rubygems - thread_safe - - - rubygems - concurrent-ruby - - - - - rubygems - asciidoctor-revealjs - ${version.asciidoctor.revealjs} - gem - - - - rubygems - asciidoctor - - - rubygems - thread_safe - - - rubygems - concurrent-ruby - - - - - - - - de.saumya.mojo - gem-maven-plugin - 2.0.1 - - ${version.jruby} - ${gems.destination} - ${gems.destination} - - - - - install-gems - - initialize - - initialize - - - - - - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + + aadarchi-maven-plugin + maven-plugin + Aadarchi : Maven plugin + This maven plugin allows integration of our documentation system into maven builds by providing a set of useful mojos + + + 9.2.9.0 + + 4.3.0 + + + + + ${project.groupId} + base + ${project.version} + + + javax.enterprise + cdi-api + + + + + ${project.groupId} + cdi-in-maven-plugin-helper + ${project.version} + + + javax.enterprise + cdi-api + + + + + + io.github.Riduidel.aadarchi + maven-metadata-inferer + ${project.version} + + + javax.enterprise + cdi-api + + + + + net.alchim31 + livereload-jvm + 0.2.0 + + + + + org.apache.commons + commons-vfs2 + + + org.apache.hadoop + hadoop-hdfs-client + + + + + org.apache.maven + maven-plugin-api + 3.8.6 + + + + org.twdata.maven + mojo-executor + 2.4.0 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.6.4 + provided + + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.9.0 + + + + + + + org.torquebox.mojo + mavengem-wagon + 1.0.3 + + + + + + + + mavengems + mavengem:https://rubygems.org + + + + + integration-tests + + + !skip_integration + + + + + + org.apache.maven.plugins + maven-invoker-plugin + 3.6.0 + + true + + ${project.version} + + src/it + + **/pom.xml + + + ${project.build.directory}/it + + ${project.build.directory}/local-repo + + src/it/settings.xml + verify.groovy + + + + + + install + run + + + + + + + + + Download rubgems in a scope where I can access that damned repository + + + ${basedir}/src/main/resources/META-INF/gems + + + + 0.5.0 + 4.1.0 + ${project.basedir}/src/main/resources/META-INF/gems + + + + + rubygems + asciidoctor-kroki + ${version.asciidoctor.kroki} + gem + + + + rubygems + asciidoctor + + + rubygems + thread_safe + + + rubygems + concurrent-ruby + + + + + rubygems + asciidoctor-revealjs + ${version.asciidoctor.revealjs} + gem + + + + rubygems + asciidoctor + + + rubygems + thread_safe + + + rubygems + concurrent-ruby + + + + + + + + de.saumya.mojo + gem-maven-plugin + 2.0.1 + + ${version.jruby} + ${gems.destination} + ${gems.destination} + + + + + install-gems + + initialize + + initialize + + + + + + + + diff --git a/aadarchi-maven-plugin/src/it/1_from_workspace_dsl/verify.groovy b/aadarchi-maven-plugin/src/it/1_from_workspace_dsl/verify.groovy index 41a2de92..630a8507 100644 --- a/aadarchi-maven-plugin/src/it/1_from_workspace_dsl/verify.groovy +++ b/aadarchi-maven-plugin/src/it/1_from_workspace_dsl/verify.groovy @@ -6,7 +6,8 @@ Is there one line containing project version? And if so, does it contains the "p def lines = logFile.readLines() // Now filter that collection def inStep = lines.findAll { it.contains "ArchitectureEnhancer" } - assert inStep.size>1 + logger.info "Found lines ${inStep}" + assert inStep.size()>1 // We have log lines, but do we also have generated content ? File structurizrOutput = new File(basedir, "target/structurizr") assert structurizrOutput.exists() && structurizrOutput.isDirectory() diff --git a/aadarchi-test-utils/pom.xml b/aadarchi-test-utils/pom.xml index 0a2ba2fd..0bb67fc6 100644 --- a/aadarchi-test-utils/pom.xml +++ b/aadarchi-test-utils/pom.xml @@ -1,23 +1,25 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - Aadarchi : test utilities - aadarchi-test-utils - Some test utilities dedicated to the improvement of Aadarchi quality. - Mainly contains tools allowing easy injection of Maven properties into tests - - - jakarta.enterprise - jakarta.enterprise.cdi-api - - - - org.apache.deltaspike.core - deltaspike-core-impl - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + aadarchi-test-utils + Aadarchi : test utilities + Some test utilities dedicated to the improvement of Aadarchi quality. + Mainly contains tools allowing easy injection of Maven properties into tests + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + + org.apache.deltaspike.core + deltaspike-core-impl + + + diff --git a/adr-tickets-extractor/pom.xml b/adr-tickets-extractor/pom.xml index 578c79e1..68e4e6b3 100644 --- a/adr-tickets-extractor/pom.xml +++ b/adr-tickets-extractor/pom.xml @@ -1,22 +1,25 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - adr-tickets-extractor - Aadarchi : ADR ticket extractor - Provides mechanisms to initialize repository elements AND include project ADR from GitHub issues - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - org.freemarker - freemarker - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + adr-tickets-extractor + Aadarchi : ADR ticket extractor + Provides mechanisms to initialize repository elements AND include project ADR from GitHub issues + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + io.github.Riduidel.aadarchi + freemarker-cdi-producer + ${project.version} + + + diff --git a/archetype/pom.xml b/archetype/pom.xml index 8f1baa07..581a6365 100644 --- a/archetype/pom.xml +++ b/archetype/pom.xml @@ -1,137 +1,137 @@ - - 4.0.0 - - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - archetype - maven-archetype - - Aadarchi : Archetype - Easily create configuration to document your project with this archetype - - - - - io.github.Riduidel.aadarchi - aadarchi-maven-plugin - ${project.version} - provided - - - io.github.Riduidel.aadarchi - github-scm-handler - ${project.version} - provided - - - - - - - src/main/resources - true - - archetype-resources/pom.xml - - - - src/main/resources - false - - archetype-resources/pom.xml - - - - - - org.apache.maven.archetype - archetype-packaging - 3.1.2 - - - - - org.apache.maven.plugins - maven-archetype-plugin - 3.2.1 - - - - ${project.version} - - - - - - - - org.apache.maven.plugins - maven-resources-plugin - - false - - - - - - - - - generate-asciidoc-templates - - - http://www.codingthearchitecture.com/2016/05/31/agile_software_architecture_documentation.html - ${asciidoc.source.docs.directory} - - - - - org.codehaus.gmavenplus - gmavenplus-plugin - - - generate-resources - - execute - - - - - - - - - - - org.codehaus.groovy - groovy-all - - 2.5.8 - runtime - pom - - - - org.jsoup - jsoup - ${version.jsoup} - - - - ch.qos.logback - logback-classic - 1.2.3 - - - - - - - - \ No newline at end of file + + + 4.0.0 + + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + archetype + maven-archetype + + Aadarchi : Archetype + Easily create configuration to document your project with this archetype + + + + + io.github.Riduidel.aadarchi + aadarchi-maven-plugin + ${project.version} + provided + + + io.github.Riduidel.aadarchi + github-scm-handler + ${project.version} + provided + + + + + + + true + src/main/resources + + archetype-resources/pom.xml + + + + false + src/main/resources + + archetype-resources/pom.xml + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + false + + + + + + + + org.apache.maven.plugins + maven-archetype-plugin + 3.2.1 + + + + ${project.version} + + + + + + + org.apache.maven.archetype + archetype-packaging + 3.1.2 + + + + + + generate-asciidoc-templates + + http://www.codingthearchitecture.com/2016/05/31/agile_software_architecture_documentation.html + ${asciidoc.source.docs.directory} + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + + + ch.qos.logback + logback-classic + 1.2.3 + + + + org.jsoup + jsoup + ${version.jsoup} + + + org.codehaus.groovy + groovy-all + + 2.5.8 + pom + runtime + + + + + + execute + + generate-resources + + + + + + + + + + + + + diff --git a/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml index 154e5e7e..6a961e22 100644 --- a/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -21,6 +21,12 @@ .github/**/* + + .mvn + + **/* + + ${project.version} diff --git a/archetype/src/main/resources/archetype-resources/src/architecture/resources/workspace.dsl b/archetype/src/main/resources/archetype-resources/src/architecture/resources/workspace.dsl index d519a6d2..d043d9ef 100644 --- a/archetype/src/main/resources/archetype-resources/src/architecture/resources/workspace.dsl +++ b/archetype/src/main/resources/archetype-resources/src/architecture/resources/workspace.dsl @@ -19,5 +19,17 @@ workspace "aadarchi-documentation-system" { component "myContainer" "ContainerComponents" "myContainer components" { include * } + styles { + element queue { + shape Pipe + } + element topic { + shape Pipe + } + element table { + shape Box + } + } + theme default } } \ No newline at end of file diff --git a/architecture-documentation/pom.xml b/architecture-documentation/pom.xml index 30720e5a..f865d383 100644 --- a/architecture-documentation/pom.xml +++ b/architecture-documentation/pom.xml @@ -1,237 +1,238 @@ - - 4.0.0 - - system - io.github.Riduidel.aadarchi - 0.1.12-SNAPSHOT - - architecture-documentation - Aadarchi : System documentation generator - Using Aadarchi to document agile archiecture documentation system - - 11 - UTF-8 - UTF-8 - highlightjs - org.ndx.aadarchi.base.ArchitectureDocumentationBuilder - - - - - https://github.com/Riduidel/aadarchi/issues - - - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - io.github.Riduidel.aadarchi - structurizr-components-detector - ${project.version} - - - io.github.Riduidel.aadarchi - sipoc-diagram-generator - ${project.version} - - - io.github.Riduidel.aadarchi - github-scm-handler - ${project.version} - - - io.github.Riduidel.aadarchi - adr-tickets-extractor - ${project.version} - - - io.github.Riduidel.aadarchi - model-linter - ${project.version} - - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - - - - org.jboss.weld - weld-junit5 - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${maven.compiler.release} - - - - org.apache.maven.plugins - maven-release-plugin - - true - true - -Dasciidoc.documents.hide.bug.report=true - settings-aadarchi,release - - - - - - - ${project.groupId} - aadarchi-maven-plugin - ${project.version} - - - - generate-model - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${version.java} - - - - - - - - generate-docs - - - src/docs/asciidoc - - - - ${project.build.directory}/asciidoc/docs - - - - package - - - ${project.groupId} - aadarchi-maven-plugin - ${project.version} - - - generate-html-doc - package - - generate-html-docs - - - - generate-pdf-doc - package - - generate-pdf-docs - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - package - - attach-artifact - - - - - ${project.build.directory}/asciidoc/docs/pdf/index.pdf - pdf - documentation - - - - - - - - - - - - - generate-slides - - - src/slides/asciidoc - - - - - - ${project.groupId} - aadarchi-maven-plugin - ${project.version} - - - generate-html-slides - package - - generate-html-slides - - - - - - - - - - livereload - - package - - - ${project.groupId} - aadarchi-maven-plugin - ${project.version} - - - generate-html-slides - package - - livereload - - - - - - - - - \ No newline at end of file + + + 4.0.0 + + system + io.github.Riduidel.aadarchi + 0.1.15-SNAPSHOT + + architecture-documentation + Aadarchi : System documentation generator + Using Aadarchi to document agile archiecture documentation system + + 11 + UTF-8 + UTF-8 + highlightjs + org.ndx.aadarchi.base.ArchitectureDocumentationBuilder + + + + + + io.github.Riduidel.aadarchi + adr-tickets-extractor + ${project.version} + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + io.github.Riduidel.aadarchi + github-scm-handler + ${project.version} + + + io.github.Riduidel.aadarchi + model-linter + ${project.version} + + + io.github.Riduidel.aadarchi + sipoc-diagram-generator + ${project.version} + + + io.github.Riduidel.aadarchi + structurizr-components-detector + ${project.version} + + + + org.jboss.weld + weld-junit5 + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${maven.compiler.release} + + + + org.apache.maven.plugins + maven-release-plugin + + true + true + -Dasciidoc.documents.hide.bug.report=true + settings-aadarchi,release + + + + + + + ${project.groupId} + aadarchi-maven-plugin + ${project.version} + + + + generate-model + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${version.java} + + + + + + + https://github.com/Riduidel/aadarchi/issues + + + + + generate-docs + + + src/docs/asciidoc + + + + ${project.build.directory}/asciidoc/docs + + + + package + + + ${project.groupId} + aadarchi-maven-plugin + ${project.version} + + + generate-html-doc + + generate-html-docs + + package + + + generate-pdf-doc + + generate-pdf-docs + + package + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + + attach-artifact + + package + + + + ${project.build.directory}/asciidoc/docs/pdf/index.pdf + pdf + documentation + + + + + + + + + + + + + generate-slides + + + src/slides/asciidoc + + + + + + ${project.groupId} + aadarchi-maven-plugin + ${project.version} + + + generate-html-slides + + generate-html-slides + + package + + + + + + + + + livereload + + package + + + ${project.groupId} + aadarchi-maven-plugin + ${project.version} + + + generate-html-slides + + livereload + + package + + + + + + + + diff --git a/architecture-documentation/src/architecture/resources/workspace.dsl b/architecture-documentation/src/architecture/resources/workspace.dsl index 20c90dee..282056e0 100644 --- a/architecture-documentation/src/architecture/resources/workspace.dsl +++ b/architecture-documentation/src/architecture/resources/workspace.dsl @@ -7,6 +7,7 @@ workspace "aadarchi-documentation-system" { "aadarchi.tickets.project" "aadarchi-documentation-system" "aadarchi.tickets.adr.label" "decision" "aadarchi.maven.pom" "pom.xml" + "aadarchi.maven.filter.dependencies.tagged" "testing, jackson, commons, io" } maven = container "maven" "The maven build engine" "java, maven" aadarchi_maven_plugin = container "aadarchi-maven-plugin" { @@ -24,7 +25,10 @@ workspace "aadarchi-documentation-system" { aadarchi_maven_plugin -> this } archetype_6 = container "archetype" "" "maven" - architecture_documentation = container "architecture-documentation" + architecture_documentation = container "architecture-documentation" { + this -> aadarchi_maven_plugin "Generates architecture diagrams" + this -> aadarchi_maven_plugin "Generates documentation artifacts" + } } person_architect -> archetype_6 "Bootstrap a valid project" person_architect -> maven "Generates documentation" diff --git a/base/pom.xml b/base/pom.xml index 12875d79..176e1095 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -1,98 +1,100 @@ - - 4.0.0 - - system - io.github.Riduidel.aadarchi - 0.1.12-SNAPSHOT - - base - Aadarchi : Base module - Base module defining the various used interfaces, and some very useful implementations - jar - - - jakarta.enterprise - jakarta.enterprise.cdi-api - - - org.jboss.weld.se - weld-se-core - - - com.structurizr - structurizr-annotations - - - com.structurizr - structurizr-client - - - - com.fasterxml.jackson.core - jackson-annotations - - - - - com.structurizr - structurizr-dsl - - - com.structurizr - structurizr-export - - - ${project.groupId} - cdi-config-extension - ${project.version} - - - ${project.groupId} - MarkdownToAsciidoc - ${project.version} - - - commons-io - commons-io - - - org.apache.commons - commons-lang3 - - - org.apache.commons - commons-text - 1.10.0 - - - com.pivovarit - throwing-function - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.assertj - assertj-core - test - - - org.jboss.weld - weld-junit5 - test - - - ${project.groupId} - aadarchi-test-utils - ${project.version} - test - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + base + jar + Aadarchi : Base module + Base module defining the various used interfaces, and some very useful implementations + + + ${project.groupId} + cdi-config-extension + ${project.version} + + + ${project.groupId} + markdown-to-asciidoc + ${project.version} + + + com.pivovarit + throwing-function + + + com.structurizr + structurizr-annotations + + + com.structurizr + structurizr-client + + + + com.fasterxml.jackson.core + jackson-annotations + + + + + com.structurizr + structurizr-dsl + + + com.structurizr + structurizr-export + + + commons-io + commons-io + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + org.apache.commons + commons-lang3 + + + org.apache.commons + commons-text + 1.10.0 + + + org.jboss.weld.se + weld-se-core + + + ${project.groupId} + aadarchi-test-utils + ${project.version} + test + + + org.assertj + assertj-core + test + + + org.jboss.weld + weld-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/base/src/main/java/org/ndx/aadarchi/base/ArchitectureEnhancer.java b/base/src/main/java/org/ndx/aadarchi/base/ArchitectureEnhancer.java index c7b7b739..26e9b5ce 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/ArchitectureEnhancer.java +++ b/base/src/main/java/org/ndx/aadarchi/base/ArchitectureEnhancer.java @@ -1,6 +1,7 @@ package org.ndx.aadarchi.base; import java.io.File; +import java.util.Arrays; import java.util.Comparator; import java.util.Set; import java.util.SortedSet; @@ -99,6 +100,9 @@ private boolean filterEnhancer(Enhancer enhancer) { } } + public void enhance(Workspace workspace, Enhancer...enhancers) { + enhance(workspace, Arrays.asList(enhancers)); + } public void enhance(Workspace workspace, Iterable enhancers) { classloader = Thread.currentThread().getContextClassLoader(); logger.info(() -> String.format("Enhancers applied to this architecture are:\n%s", @@ -163,7 +167,9 @@ private void enhancerVisitModel(ModelEnhancer enhancer, Model model) { Stream systems = model.getSoftwareSystems().stream(); if(enhancer.isParallel()) systems = systems.parallel(); - systems.filter(s -> withClassLoader(() -> enhancer.startVisit(s))) + systems + .sorted(new OrderedModelElement()) + .filter(s -> withClassLoader(() -> enhancer.startVisit(s))) .peek(s -> withClassLoader(() -> enhancerVisitSystem(enhancer, s))) .forEach(s -> withClassLoader(() -> enhancer.endVisit(s, outputBuilder))); enhancer.endVisit(model, outputBuilder); @@ -175,7 +181,9 @@ private void enhancerVisitSystem(ModelEnhancer enhancer, SoftwareSystem system) Stream containers = system.getContainers().stream(); if(enhancer.isParallel()) containers = containers.parallel(); - containers.filter(c -> withClassLoader(() -> enhancer.startVisit(c))) + containers + .sorted(new OrderedModelElement()) + .filter(c -> withClassLoader(() -> enhancer.startVisit(c))) .peek(c -> withClassLoader(() -> enhancerVisitContainer(enhancer, c))) .forEach(c -> withClassLoader(() -> enhancer.endVisit(c, outputBuilder))); } @@ -185,7 +193,9 @@ private void enhancerVisitContainer(ModelEnhancer enhancer, Container container) Stream systems = container.getComponents().stream(); if(enhancer.isParallel()) systems = systems.parallel(); - systems.filter(c -> withClassLoader(() -> enhancer.startVisit(c))) + systems + .sorted(new OrderedModelElement()) + .filter(c -> withClassLoader(() -> enhancer.startVisit(c))) .forEach(c -> withClassLoader(() -> enhancer.endVisit(c, outputBuilder))); } diff --git a/base/src/main/java/org/ndx/aadarchi/base/OrderedModelElement.java b/base/src/main/java/org/ndx/aadarchi/base/OrderedModelElement.java new file mode 100644 index 00000000..b983fa0a --- /dev/null +++ b/base/src/main/java/org/ndx/aadarchi/base/OrderedModelElement.java @@ -0,0 +1,23 @@ +package org.ndx.aadarchi.base; + +import java.util.Comparator; + +import org.ndx.aadarchi.base.enhancers.ModelElementKeys; + +import com.structurizr.model.Element; + +public class OrderedModelElement implements Comparator { + + @Override + public int compare(Element o1, Element o2) { + if(o1.getProperties().containsKey(ModelElementKeys.ORDERING)) { + if(o2.getProperties().containsKey(ModelElementKeys.ORDERING)) { + long n1 = Long.parseLong(o1.getProperties().get(ModelElementKeys.ORDERING)); + long n2 = Long.parseLong(o1.getProperties().get(ModelElementKeys.ORDERING)); + return (int) (n1-n2); + } + } + return o1.getCanonicalName().compareTo(o2.getCanonicalName()); + } + +} diff --git a/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java b/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java index 163ffc39..9da948ec 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java +++ b/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java @@ -161,5 +161,11 @@ public static interface CheckoutLocation { * When set, this property contains a description used for {@link #EXTERNAL_DEPENDENCIES} * generated links */ - String EXTERNAL_DEPENDENCY_DESCRIPTION = PREFIX+".depends.description"; + String EXTERNAL_DEPENDENCY_DESCRIPTION = PREFIX+"depends.description"; + /** + * When set, model elements will be ordered according to this key instead of the name (which is used by default). + * Why introducing this complexity? Because it allows cleaner, and more controlled, ordering. + * Please use integer or long values (floats and double won't be supported here) + */ + String ORDERING = PREFIX+"ordering"; } diff --git a/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java b/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java index 0321f662..258d2a5b 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java +++ b/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java @@ -2,6 +2,10 @@ import com.structurizr.view.ComponentView; import com.structurizr.view.ContainerView; +import com.structurizr.view.DeploymentView; +import com.structurizr.view.SystemContextView; +import com.structurizr.view.SystemLandscapeView; + import org.ndx.aadarchi.base.OutputBuilder; import org.ndx.aadarchi.base.enhancers.ModelElementKeys; import org.ndx.aadarchi.base.enhancers.ViewEnhancerAdapter; @@ -34,6 +38,42 @@ protected boolean startVisit(ComponentView c) { return true; } + @Override + protected boolean startVisit(DeploymentView c) { + return true; + } + + @Override + protected boolean startVisit(SystemContextView c) { + return true; + } + @Override + protected boolean startVisit(SystemLandscapeView c) { + return true; + } + @Override + protected void endVisit(DeploymentView c, OutputBuilder builder) { + if(c.getProperties().containsKey(NAME)) { + c.addAllDeploymentNodes(); + } + super.endVisit(c, builder); + } + @Override + protected void endVisit(SystemContextView c, OutputBuilder builder) { + if(c.getProperties().containsKey(NAME)) { + c.addAllSoftwareSystems(); + c.addAllPeople(); + } + super.endVisit(c, builder); + } + @Override + protected void endVisit(SystemLandscapeView c, OutputBuilder builder) { + if(c.getProperties().containsKey(NAME)) { + c.addAllSoftwareSystems(); + c.addAllPeople(); + } + } + @Override protected void endVisit(ComponentView c, OutputBuilder builder) { if(c.getProperties().containsKey(NAME)) { diff --git a/base/src/main/java/org/ndx/aadarchi/base/utils/FileContentCache.java b/base/src/main/java/org/ndx/aadarchi/base/utils/FileContentCache.java index 590a83a1..396fde41 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/utils/FileContentCache.java +++ b/base/src/main/java/org/ndx/aadarchi/base/utils/FileContentCache.java @@ -12,6 +12,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; +import org.apache.commons.vfs2.provider.local.LocalFile; import org.apache.deltaspike.core.api.config.ConfigProperty; import org.ndx.aadarchi.base.enhancers.ModelElementKeys; import org.ndx.aadarchi.base.enhancers.ModelElementKeys.ConfigProperties.Force; @@ -34,17 +35,35 @@ public class FileContentCache { name = ModelElementKeys.ConfigProperties.CacheDir.NAME, defaultValue = ModelElementKeys.ConfigProperties.CacheDir.VALUE) FileObject cacheDir; - public InputStream openStreamFor(URL url, Function cacheLoader) throws IOException { + /** + * Open stream from the given source. + * @param source + * @param function + * @return + * @throws IOException + */ + private InputStream openStreamFor(FileObject source, Function function) throws IOException { + // We shouldn't cache local files. + // It's both inefficient, and triggers weird bugs on Windows + if(source instanceof LocalFile) { + return source.getContent().getInputStream(); + } + // Sometimes this url uses custom protocols, which Java doesn't fully understand + // So replace all non standard protocols by http + String uri = source.getPublicURIString() + .replace("github:", "http:") + .replace("gitlab:", "http:") + .replace("http5s:", "https:") + .replace("http5:", "http:") + ; + URL url = new URL(uri); FileObject file = toCacheFile(url); if(force || !file.exists() || shouldRefresh(file)) { - refreshCache(file, url, cacheLoader); + refreshCache(file, url, function); } // Now it's time to load file in cache return file.getContent().getInputStream(); } - public InputStream openStreamFor(String string, Function cacheLoader) throws IOException { - return openStreamFor(new URL(string), cacheLoader); - } /** * Get cached version of remote file @@ -54,13 +73,8 @@ public InputStream openStreamFor(String string, Function cache */ public InputStream openStreamFor(FileObject file) throws IOException { try { - // Sometimes this url uses custom protocols, which Java doesn't fully understand - // So replace all non standard protocols by http - String uri = file.getPublicURIString() - .replace("github:", "http:") - .replace("gitlab:", "http:"); return openStreamFor( - uri, + file, ThrowingFunction.unchecked(_url -> file.getContent().getInputStream())); } finally { file.close(); @@ -100,7 +114,9 @@ private boolean shouldRefresh(FileObject file) { private FileObject toCacheFile(URL url) { try { FileObject domain = cacheDir.resolveFile(url.getHost()); - String pathInUrl = url.getFile().replace('?', '_'); + String pathInUrl = url.getFile() + .replace('?', '_') + .replace(":", "__"); // Don't forget that linux systems don't like when paths start with "/" if(pathInUrl.startsWith("/")) pathInUrl = pathInUrl.substring(1); diff --git a/base/src/main/java/org/ndx/aadarchi/base/utils/StructurizrUtils.java b/base/src/main/java/org/ndx/aadarchi/base/utils/StructurizrUtils.java index 4c2735a2..5195c5cb 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/utils/StructurizrUtils.java +++ b/base/src/main/java/org/ndx/aadarchi/base/utils/StructurizrUtils.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.stream.Collectors; +import org.ndx.aadarchi.base.enhancers.ModelElementKeys; + import com.structurizr.PropertyHolder; import com.structurizr.Workspace; import com.structurizr.model.Component; @@ -22,8 +24,13 @@ public static String getCanonicalPath(Element element) { if(element.getParent()!=null) { returned = getCanonicalPath(element.getParent()); } - returned += "/" + element.getName(); - return returned; + returned += "/"; + if(element.getProperties().containsKey(ModelElementKeys.ORDERING)) { + long ordering = Long.parseLong(element.getProperties().get(ModelElementKeys.ORDERING)); + returned+= String.format("%02d-", ordering); + } + returned += element.getName(); + return returned.trim(); } public static List getHierarchy(List elements) { diff --git a/base/src/main/java/org/ndx/aadarchi/base/utils/descriptions/RelationshipDescriptionProvider.java b/base/src/main/java/org/ndx/aadarchi/base/utils/descriptions/RelationshipDescriptionProvider.java index 7cda2654..76269f87 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/utils/descriptions/RelationshipDescriptionProvider.java +++ b/base/src/main/java/org/ndx/aadarchi/base/utils/descriptions/RelationshipDescriptionProvider.java @@ -51,7 +51,19 @@ private RelationshipFinder createRelationshipDescriptionFinder(Workspace workspa ModelElementKeys.ConfigProperties.RelationshipNames.NAME, ModelElementKeys.ConfigProperties.RelationshipNames.VALUE)); Properties returned = new Properties(); - if(!propertiesFile.exists()) { + if(propertiesFile.exists()) { + try { + try(InputStream input = new FileInputStream(propertiesFile)) { + returned.load(input); + } + } catch(IOException e) { + logger.log(Level.WARNING, + String.format("Unable to read descriptions.\nworkspace is %s.\nAssociated file is %s" , + workspace.getName(), + propertiesFile.getAbsolutePath()), + e); + } + } else { logger.log(Level.FINE, String.format("If you want to customize descriptions in %s," + " create file %s" @@ -59,17 +71,6 @@ private RelationshipFinder createRelationshipDescriptionFinder(Workspace workspa workspace.getName(), propertiesFile.getAbsolutePath())); } - try { - try(InputStream input = new FileInputStream(propertiesFile)) { - returned.load(input); - } - } catch(IOException e) { - logger.log(Level.WARNING, - String.format("Unable to read descriptions.\nworkspace is %s.\nAssociated file is %s" , - workspace.getName(), - propertiesFile.getAbsolutePath()), - e); - } return new RelationshipFinder(returned); } diff --git a/base/src/test/java/org/ndx/aadarchi/base/enhancers/scm/ReadmeReaderTest.java b/base/src/test/java/org/ndx/aadarchi/base/enhancers/scm/ReadmeReaderTest.java new file mode 100644 index 00000000..9314e76f --- /dev/null +++ b/base/src/test/java/org/ndx/aadarchi/base/enhancers/scm/ReadmeReaderTest.java @@ -0,0 +1,34 @@ +package org.ndx.aadarchi.base.enhancers.scm; + +import javax.inject.Inject; + +import org.assertj.core.util.Arrays; +import org.jboss.weld.junit5.EnableWeld; +import org.jboss.weld.junit5.WeldInitiator; +import org.jboss.weld.junit5.WeldSetup; +import org.junit.jupiter.api.Test; +import org.ndx.aadarchi.base.ArchitectureEnhancer; +import org.ndx.aadarchi.base.enhancers.ModelElementKeys; + +import com.structurizr.Workspace; + +@EnableWeld +class ReadmeReaderTest { + + @WeldSetup + public WeldInitiator weld = WeldInitiator.performDefaultDiscovery(); + + @Inject ReadmeReader tested; + @Inject ArchitectureEnhancer enhancer; + + @Test + void bug_81_can_read_a_local_readme_file() { + // Given + var w = new Workspace(getClass().getName(), "a test workspace"); + var system = w.getModel().addSoftwareSystem("The system to add a readme to"); + system.addProperty(ModelElementKeys.ConfigProperties.BasePath.NAME, "."); + // When + enhancer.enhance(w, tested); + } + +} diff --git a/base/src/test/java/org/ndx/aadarchi/base/utils/FileContentCacheTest.java b/base/src/test/java/org/ndx/aadarchi/base/utils/FileContentCacheTest.java new file mode 100644 index 00000000..f21511e4 --- /dev/null +++ b/base/src/test/java/org/ndx/aadarchi/base/utils/FileContentCacheTest.java @@ -0,0 +1,37 @@ +package org.ndx.aadarchi.base.utils; + +import java.io.IOException; + +import javax.inject.Inject; + +import org.apache.commons.vfs2.FileObject; +import org.apache.deltaspike.core.api.config.ConfigProperty; +import org.assertj.core.api.Assertions; +import org.jboss.weld.junit5.EnableWeld; +import org.jboss.weld.junit5.WeldInitiator; +import org.jboss.weld.junit5.WeldSetup; +import org.junit.jupiter.api.Test; +import org.junit.platform.commons.util.Preconditions; +import org.ndx.aadarchi.base.enhancers.ModelElementKeys.ConfigProperties.BasePath; + +@EnableWeld +class FileContentCacheTest { + + @WeldSetup + public WeldInitiator weld = WeldInitiator.performDefaultDiscovery(); + + @Inject FileContentCache tested; + @Inject @ConfigProperty(name=BasePath.NAME, defaultValue = BasePath.VALUE) FileObject basePath; + + @Test + void bug_81_can_read_a_local_readme_file() throws IOException { + // Given + var readme = basePath.resolveFile("README.md"); + Preconditions.condition(readme.exists(), "Readme file should exist"); + Preconditions.condition(readme.getContent().getSize()>0, "There should be some content in readme"); + // When + try(var input = tested.openStreamFor(readme)) { + Assertions.assertThat(input).isNotNull(); + } + } +} diff --git a/cdi-config-extension/pom.xml b/cdi-config-extension/pom.xml index 4ce94a1e..e47527cb 100644 --- a/cdi-config-extension/pom.xml +++ b/cdi-config-extension/pom.xml @@ -3,7 +3,7 @@ io.github.Riduidel.aadarchi system - 0.1.12-SNAPSHOT + 0.1.15-SNAPSHOT cdi-config-extension Aadarchi : CDI Config extension @@ -29,4 +29,4 @@ provided - \ No newline at end of file + diff --git a/cdi-in-maven-plugin-helper/pom.xml b/cdi-in-maven-plugin-helper/pom.xml index 146db9c4..982e41ad 100644 --- a/cdi-in-maven-plugin-helper/pom.xml +++ b/cdi-in-maven-plugin-helper/pom.xml @@ -1,54 +1,56 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - cdi-in-maven-plugin-helper - Aadarchi : CDI in Maven helper - This small java library provides a simple way to have a maven Mojo use CDI for bean injection - - - org.jboss.weld.se - weld-se-core - - - - org.apache.maven - maven-core - 3.8.5 - - - org.apache.maven - maven-plugin-api - 3.8.5 - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.6.4 - provided - - - - org.apache.deltaspike.core - deltaspike-core-impl - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.assertj - assertj-core - test - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + cdi-in-maven-plugin-helper + Aadarchi : CDI in Maven helper + This small java library provides a simple way to have a maven Mojo use CDI for bean injection + + + + org.apache.deltaspike.core + deltaspike-core-impl + + + + org.apache.maven + maven-core + 3.8.5 + + + org.apache.maven + maven-plugin-api + 3.8.5 + + + org.jboss.weld.se + weld-se-core + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.6.4 + provided + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/freemarker-cdi-producer/README.md b/freemarker-cdi-producer/README.md new file mode 100644 index 00000000..52e332a6 --- /dev/null +++ b/freemarker-cdi-producer/README.md @@ -0,0 +1,5 @@ +This component provides a simple CDI Producer allowing one to easily have Freemarker templates injected. + +# How + +Suppose you have a class named \ No newline at end of file diff --git a/freemarker-cdi-producer/pom.xml b/freemarker-cdi-producer/pom.xml new file mode 100644 index 00000000..1028d7f3 --- /dev/null +++ b/freemarker-cdi-producer/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + freemarker-cdi-producer + Freemarker CDI Producer + This CDI producer allows easy usage of Freemarker in a + CDI-compatible application. + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + org.assertj + assertj-core + + + org.freemarker + freemarker + + + io.github.Riduidel.aadarchi + aadarchi-test-utils + ${project.version} + test + + + org.jboss.weld + weld-junit5 + test + + + diff --git a/adr-tickets-extractor/src/main/java/org/ndx/aadarchi/tickets/FreemarkerTemplateProducer.java b/freemarker-cdi-producer/src/main/java/org/ndx/aadarchi/freemarker/FreemarkerTemplateProducer.java similarity index 86% rename from adr-tickets-extractor/src/main/java/org/ndx/aadarchi/tickets/FreemarkerTemplateProducer.java rename to freemarker-cdi-producer/src/main/java/org/ndx/aadarchi/freemarker/FreemarkerTemplateProducer.java index 2a717d41..091eba80 100644 --- a/adr-tickets-extractor/src/main/java/org/ndx/aadarchi/tickets/FreemarkerTemplateProducer.java +++ b/freemarker-cdi-producer/src/main/java/org/ndx/aadarchi/freemarker/FreemarkerTemplateProducer.java @@ -1,47 +1,45 @@ -package org.ndx.aadarchi.tickets; - -import java.io.IOException; - -import javax.enterprise.inject.Produces; -import javax.enterprise.inject.spi.InjectionPoint; - -import org.ndx.aadarchi.base.AgileArchitectureException; - -import freemarker.template.Configuration; -import freemarker.template.DefaultObjectWrapper; -import freemarker.template.Template; -import freemarker.template.TemplateExceptionHandler; - -public class FreemarkerTemplateProducer { - public static class CantLoadTemplate extends AgileArchitectureException { - - public CantLoadTemplate(String message, Throwable cause) { - super(message, cause); - } - - } - @Produces Configuration createConfiguration() { - Configuration returned = new Configuration(); - returned.setObjectWrapper(new DefaultObjectWrapper()); - returned.setDefaultEncoding("UTF-8"); - returned.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); - returned.setIncompatibleEnhancements("2.3.20"); - return returned; - } - - /** - * Allow to inject a template named - * @param injection - * @return - */ - @Produces Template produceTemplate(InjectionPoint injection, Configuration configuration) { - Class beanClass = injection.getBean().getBeanClass(); - configuration.setClassForTemplateLoading(beanClass, "/templates/"+beanClass.getSimpleName()); - String templateName = String.format("%s.ftl", injection.getMember().getName()); - try { - return configuration.getTemplate(templateName); - } catch (IOException e) { - throw new CantLoadTemplate(String.format("Cant't load template %s", templateName), e); - } - } -} +package org.ndx.aadarchi.freemarker; + +import java.io.IOException; + +import javax.enterprise.inject.Produces; +import javax.enterprise.inject.spi.InjectionPoint; + +import freemarker.template.Configuration; +import freemarker.template.DefaultObjectWrapper; +import freemarker.template.Template; +import freemarker.template.TemplateExceptionHandler; + +public class FreemarkerTemplateProducer { + public static class CantLoadTemplate extends RuntimeException { + + public CantLoadTemplate(String message, Throwable cause) { + super(message, cause); + } + + } + @Produces Configuration createConfiguration() { + Configuration returned = new Configuration(); + returned.setObjectWrapper(new DefaultObjectWrapper()); + returned.setDefaultEncoding("UTF-8"); + returned.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + returned.setIncompatibleEnhancements("2.3.20"); + return returned; + } + + /** + * Allow to inject a template named + * @param injection + * @return + */ + @Produces Template produceTemplate(InjectionPoint injection, Configuration configuration) { + Class beanClass = injection.getBean().getBeanClass(); + configuration.setClassForTemplateLoading(beanClass, "/templates/"+beanClass.getSimpleName()); + String templateName = String.format("%s.ftl", injection.getMember().getName()); + try { + return configuration.getTemplate(templateName); + } catch (IOException e) { + throw new CantLoadTemplate(String.format("Cant't load template %s", templateName), e); + } + } +} diff --git a/freemarker-cdi-producer/src/main/resources/META-INF/beans.xml b/freemarker-cdi-producer/src/main/resources/META-INF/beans.xml new file mode 100644 index 00000000..af93b3c4 --- /dev/null +++ b/freemarker-cdi-producer/src/main/resources/META-INF/beans.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/freemarker-cdi-producer/src/test/java/org/ndx/aadarchi/freemarker/FreemarkerCDIProducerTest.java b/freemarker-cdi-producer/src/test/java/org/ndx/aadarchi/freemarker/FreemarkerCDIProducerTest.java new file mode 100644 index 00000000..3743cf32 --- /dev/null +++ b/freemarker-cdi-producer/src/test/java/org/ndx/aadarchi/freemarker/FreemarkerCDIProducerTest.java @@ -0,0 +1,27 @@ +package org.ndx.aadarchi.freemarker; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.inject.Named; + +import org.assertj.core.api.Assertions; +import org.jboss.weld.junit5.EnableWeld; +import org.jboss.weld.junit5.WeldInitiator; +import org.jboss.weld.junit5.WeldSetup; +import org.junit.jupiter.api.Test; + +import freemarker.template.Template; + +@EnableWeld +public class FreemarkerCDIProducerTest { + + @WeldSetup + public WeldInitiator weld = WeldInitiator.performDefaultDiscovery(); + + @Inject Template template; + +// @Test + public void can_inject_freemarker_template() { + Assertions.assertThat(template).isNotNull(); + } +} \ No newline at end of file diff --git a/freemarker-cdi-producer/src/test/resources/templates/FreemarkerCDIProducerTest/template.ftl b/freemarker-cdi-producer/src/test/resources/templates/FreemarkerCDIProducerTest/template.ftl new file mode 100644 index 00000000..548e8164 --- /dev/null +++ b/freemarker-cdi-producer/src/test/resources/templates/FreemarkerCDIProducerTest/template.ftl @@ -0,0 +1 @@ +Un texte \ No newline at end of file diff --git a/git-scm-handler-helper/pom.xml b/git-scm-handler-helper/pom.xml new file mode 100644 index 00000000..4789a117 --- /dev/null +++ b/git-scm-handler-helper/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + git-scm-handler-helper + + + org.eclipse.jgit + org.eclipse.jgit + + + diff --git a/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GitOperator.java b/git-scm-handler-helper/src/main/java/org/ndx/aadarchi/gitlab/GitOperator.java similarity index 68% rename from github-scm-handler/src/main/java/org/ndx/aadarchi/github/GitOperator.java rename to git-scm-handler-helper/src/main/java/org/ndx/aadarchi/gitlab/GitOperator.java index 3f9b124e..db5d5878 100644 --- a/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GitOperator.java +++ b/git-scm-handler-helper/src/main/java/org/ndx/aadarchi/gitlab/GitOperator.java @@ -1,4 +1,4 @@ -package org.ndx.aadarchi.github; +package org.ndx.aadarchi.gitlab; import java.io.File; import java.io.IOException; @@ -8,35 +8,29 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; - -import org.apache.deltaspike.core.api.config.ConfigProperty; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.ListBranchCommand.ListMode; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; -import com.structurizr.annotation.Component; - /** - * Component dedicated to low-level git operations - * @author Nicolas + * A class providing basic it operations */ -@Component -@ApplicationScoped public class GitOperator { - @Inject @ConfigProperty(name=Constants.CONFIG_GITHUB_LOGIN) private String login; - @Inject @ConfigProperty(name=Constants.CONFIG_GITHUB_TOKEN) private String token; + private static final Logger logger = Logger.getLogger(GitOperator.class.getName()); + private String login; + private String token; private Set branchesToCheckout; - @Inject - public void setBranchesToCheckout(@ConfigProperty(name=Constants.CONFIG_GIT_BRANCHES_TO_CHECKOUT, defaultValue = "develop, main, main") String names) { + /** + * Set the branches to checkout from a comma-separated string + * @param names + */ + public void setBranchesToCheckout(String names) { this.branchesToCheckout = Arrays.asList(names.split(",")).stream() .map(name -> name.trim()) .collect(Collectors.toSet()); } - @Inject Logger logger; /** * Clone the repo @@ -46,10 +40,6 @@ public void setBranchesToCheckout(@ConfigProperty(name=Constants.CONFIG_GIT_BRAN * @throws IOException if local file operation fails */ public void clone(String from, File into) throws GitAPIException, IOException { - if(login==null || login.isBlank()) { - throw new UnsupportedOperationException( - String.format("Unable to checkout projects of no Github login is provided. Please set the %s property to a non-null value", Constants.CONFIG_GITHUB_LOGIN)); - } if(into.exists()) { if(new File(into, ".git").exists()) { logger.info(String.format("%s seems to already be a git repository, we consider job's done.", into.getAbsolutePath())); @@ -84,9 +74,29 @@ public void clone(String from, File into) throws GitAPIException, IOException { .setAllPaths(true) .setName(from); }, () -> { - logger.warning(String.format("We found none of the %s branches in remote (but found %s). Please add one to %s in order for checkout to work", - branchesToCheckout, branchesNames, Constants.CONFIG_GIT_BRANCHES_TO_CHECKOUT)); + logger.warning(String.format("We found none of the %s branches in remote (but found %s). Please add one to branches to checkout in order for checkout to work", + branchesToCheckout, branchesNames)); }); } } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public Set getBranchesToCheckout() { + return branchesToCheckout; + } } \ No newline at end of file diff --git a/github-scm-handler/pom.xml b/github-scm-handler/pom.xml index f64c5cc8..cc53b6ee 100644 --- a/github-scm-handler/pom.xml +++ b/github-scm-handler/pom.xml @@ -1,78 +1,80 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - github-scm-handler - Aadarchi : GitHub SCM handler - Allow github infos to be included in project documentation - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - ${project.groupId} - github-vfs - ${project.version} - - - ${project.groupId} - MarkdownToAsciidoc - ${project.version} - - - org.kohsuke - github-api - - - - org.eclipse.jgit - org.eclipse.jgit - - - com.pivovarit - throwing-function - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.assertj - assertj-core - test - - - org.jboss.weld - weld-junit5 - - - io.github.Riduidel.aadarchi - aadarchi-test-utils - ${project.version} - test - - - - - - maven-surefire-plugin - - - ${aadarchi.github.token} - - - - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + github-scm-handler + Aadarchi : GitHub SCM handler + Allow github infos to be included in project documentation + + + ${project.groupId} + github-vfs + ${project.version} + + + ${project.groupId} + markdown-to-asciidoc + ${project.version} + + + com.pivovarit + throwing-function + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + io.github.Riduidel.aadarchi + git-scm-handler-helper + ${project.version} + + + org.jboss.weld + weld-junit5 + + + org.kohsuke + github-api + + + io.github.Riduidel.aadarchi + aadarchi-test-utils + ${project.version} + test + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + maven-surefire-plugin + + + ${aadarchi.github.token} + + + + + + diff --git a/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GitOperatorProducer.java b/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GitOperatorProducer.java new file mode 100644 index 00000000..ad483145 --- /dev/null +++ b/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GitOperatorProducer.java @@ -0,0 +1,42 @@ +package org.ndx.aadarchi.github; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Produces; +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.deltaspike.core.api.config.ConfigProperty; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.ListBranchCommand.ListMode; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.lib.Ref; +import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; +import org.ndx.aadarchi.gitlab.GitOperator; + +import com.structurizr.annotation.Component; + +/** + * Component dedicated to low-level git operations + * @author Nicolas + */ +public class GitOperatorProducer { + @Produces @Named("github") + public GitOperator buildGitOperator( + @ConfigProperty(name=Constants.CONFIG_GITHUB_LOGIN) String login, + @ConfigProperty(name=Constants.CONFIG_GITHUB_TOKEN) String token, + @ConfigProperty(name=Constants.CONFIG_GIT_BRANCHES_TO_CHECKOUT, defaultValue = "develop, main, main") String names) { + GitOperator returned = new GitOperator(); + returned.setLogin(login); + returned.setToken(token); + returned.setBranchesToCheckout(names); + return returned; + } +} \ No newline at end of file diff --git a/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GithubSCMHandler.java b/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GithubSCMHandler.java index 7eb531da..d7a772d1 100644 --- a/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GithubSCMHandler.java +++ b/github-scm-handler/src/main/java/org/ndx/aadarchi/github/GithubSCMHandler.java @@ -9,6 +9,7 @@ import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Instance; import javax.inject.Inject; +import javax.inject.Named; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; @@ -20,6 +21,7 @@ import org.ndx.aadarchi.base.utils.FileContentCache; import org.ndx.aadarchi.base.utils.icon.FontIcon; import org.ndx.aadarchi.github.vfs.GitHubFileSystemProvider; +import org.ndx.aadarchi.gitlab.GitOperator; import com.structurizr.annotation.Component; @@ -29,7 +31,7 @@ public class GithubSCMHandler implements SCMHandler { @Inject Logger logger; @Inject GitHub github; @Inject FileContentCache fileCache; - @Inject Instance cloner; + @Inject @Named("github") Instance cloner; @Inject @FontIcon(name="github") String githubIcon; @Inject GitHubFileSystemProvider gitHubFileSystem; @Override diff --git a/github-vfs/pom.xml b/github-vfs/pom.xml index c3aa02a0..b180d148 100644 --- a/github-vfs/pom.xml +++ b/github-vfs/pom.xml @@ -1,53 +1,61 @@ - - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - github-vfs - Aadarchi : GitHub virtual file system - A commons-vfs virtual file system allowing access to GitHub repository - - - org.kohsuke - github-api - - - com.pivovarit - throwing-function - - - org.apache.commons - commons-vfs2 - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.assertj - assertj-core - test - - - - - - maven-surefire-plugin - - - ${aadarchi.github.token} - - - - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + github-vfs + Aadarchi : GitHub virtual file system + A commons-vfs virtual file system allowing access to GitHub repository + + + com.pivovarit + throwing-function + + + org.apache.commons + commons-vfs2 + + + + org.apache.hadoop + hadoop-hdfs-client + + + + + org.kohsuke + github-api + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + maven-surefire-plugin + + + ${aadarchi.github.token} + + + + + + diff --git a/gitlab-scm-handler/pom.xml b/gitlab-scm-handler/pom.xml index 741d03e9..9c367f8b 100644 --- a/gitlab-scm-handler/pom.xml +++ b/gitlab-scm-handler/pom.xml @@ -1,68 +1,79 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - gitlab-scm-handler - Aadarchi : Gitlab SCM Handler - Allow gitlab infos to be included in project documentation - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - io.github.Riduidel.aadarchi - gitlab-vfs - ${project.version} - - - org.gitlab4j - gitlab4j-api - - - com.pivovarit - throwing-function - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.assertj - assertj-core - test - - - org.jboss.weld - weld-junit5 - - - io.github.Riduidel.aadarchi - aadarchi-test-utils - ${project.version} - test - - - - - - maven-surefire-plugin - - - ${aadarchi.gitlab.token} - - - - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + gitlab-scm-handler + Aadarchi : Gitlab SCM Handler + Allow gitlab infos to be included in project documentation + + + com.pivovarit + throwing-function + + + com.pivovarit + throwing-function + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + io.github.Riduidel.aadarchi + git-scm-handler-helper + ${project.version} + + + io.github.Riduidel.aadarchi + gitlab-vfs + ${project.version} + + + org.gitlab4j + gitlab4j-api + + + org.jboss.weld + weld-junit5 + + + io.github.Riduidel.aadarchi + aadarchi-test-utils + ${project.version} + test + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + maven-surefire-plugin + + + ${aadarchi.gitlab.token} + + + + + + diff --git a/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/Constants.java b/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/Constants.java index 17d133f6..78c019fd 100644 --- a/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/Constants.java +++ b/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/Constants.java @@ -6,7 +6,9 @@ public interface Constants { String CONFIG_GITLAB_TOKEN = ModelElementKeys.PREFIX+"gitlab.token"; + String CONFIG_GITLAB_LOGIN = ModelElementKeys.PREFIX+"gitlab.login"; String CONFIG_GITLAB_URL = ModelElementKeys.PREFIX+"gitlab.url"; + String CONFIG_GIT_BRANCHES_TO_CHECKOUT = ModelElementKeys.PREFIX+"git.branches.to.checkout"; static boolean isGitLabProject(GitLabApi api, String project) { return project.contains(api.getGitLabServerUrl()); } diff --git a/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitOperatorProducer.java b/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitOperatorProducer.java new file mode 100644 index 00000000..330ad4c9 --- /dev/null +++ b/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitOperatorProducer.java @@ -0,0 +1,42 @@ +package org.ndx.aadarchi.gitlab; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Produces; +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.deltaspike.core.api.config.ConfigProperty; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.ListBranchCommand.ListMode; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.lib.Ref; +import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; +import org.ndx.aadarchi.gitlab.GitOperator; + +import com.structurizr.annotation.Component; + +/** + * Component dedicated to low-level git operations + * @author Nicolas + */ +public class GitOperatorProducer { + @Produces @Named("gitlab") + public GitOperator buildGitOperator( + @ConfigProperty(name=Constants.CONFIG_GITLAB_LOGIN) String login, + @ConfigProperty(name=Constants.CONFIG_GITLAB_TOKEN) String token, + @ConfigProperty(name=Constants.CONFIG_GIT_BRANCHES_TO_CHECKOUT, defaultValue = "develop, main, main") String names) { + GitOperator returned = new GitOperator(); + returned.setLogin(login); + returned.setToken(token); + returned.setBranchesToCheckout(names); + return returned; + } +} \ No newline at end of file diff --git a/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitlabSCMHandler.java b/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitlabSCMHandler.java index 0348b162..991e6334 100644 --- a/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitlabSCMHandler.java +++ b/gitlab-scm-handler/src/main/java/org/ndx/aadarchi/gitlab/GitlabSCMHandler.java @@ -1,21 +1,31 @@ package org.ndx.aadarchi.gitlab; - import java.io.File; import java.io.IOException; +import javax.enterprise.inject.Instance; import javax.inject.Inject; +import javax.inject.Named; import org.apache.commons.vfs2.FileObject; +import org.apache.commons.vfs2.FileSystemException; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.gitlab4j.api.GitLabApiException; import org.ndx.aadarchi.base.enhancers.scm.SCMHandler; import org.ndx.aadarchi.base.utils.icon.FontIcon; +import org.ndx.aadarchi.gitlab.vfs.GitLabFileSystemProvider; import com.structurizr.annotation.Component; @Component public class GitlabSCMHandler implements SCMHandler { private @Inject GitLabContainer gitlab; - @Inject @FontIcon(name="gitlab") String gitlabIcon; + @Inject @Named("gitlab") Instance cloner; + @Inject + GitLabFileSystemProvider gitlabFileSystem; + @Inject + @FontIcon(name = "gitlab") + String gitlabIcon; @Override public boolean canHandle(String project) { @@ -34,11 +44,22 @@ public String asciidocText() { @Override public void checkout(String projectUrl, File checkoutLocation) throws IOException { - throw new UnsupportedOperationException(String.format("SCMHandler#checkout(%s,%s) is not yet implemented in GitlabSCMHandler. Sorry", projectUrl, checkoutLocation.getAbsolutePath())); + if(Constants.isGitLabProject(gitlab.getApi(), projectUrl)) { + try { + String httpTransportUrl = gitlab.getApi().getProjectApi().getProject(projectUrl).getHttpUrlToRepo(); + cloner.get().clone(httpTransportUrl, checkoutLocation); + } catch (GitLabApiException | GitAPIException e) { + throw new IOException(String.format("Unable to clone %s to %s", projectUrl, checkoutLocation.getAbsolutePath()), e); + } + } } @Override public FileObject getProjectRoot(String project) { - throw new UnsupportedOperationException("TODO Implement "+getClass().getSimpleName()+"#getProjectRoot()"); + try { + return gitlabFileSystem.getProjectRoot(project); + } catch (FileSystemException e) { + throw new GitLabHandlerException("Unable to obtain VFS", e); + } } } diff --git a/gitlab-vfs/pom.xml b/gitlab-vfs/pom.xml index 79056064..fe05a84a 100644 --- a/gitlab-vfs/pom.xml +++ b/gitlab-vfs/pom.xml @@ -1,40 +1,42 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - gitlab-vfs - Aadarchi : GitLab virtual file system - A commons-vfs virtual file system allowing access to GitLab repository - - - org.gitlab4j - gitlab4j-api - - - com.pivovarit - throwing-function - - - org.apache.commons - commons-vfs2 - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.assertj - assertj-core - test - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + gitlab-vfs + Aadarchi : GitLab virtual file system + A commons-vfs virtual file system allowing access to GitLab repository + + + com.pivovarit + throwing-function + + + org.apache.commons + commons-vfs2 + + + org.gitlab4j + gitlab4j-api + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/markdown-to-asciidoc/README.adoc b/markdown-to-asciidoc/README.adoc new file mode 100644 index 00000000..ecca01cf --- /dev/null +++ b/markdown-to-asciidoc/README.adoc @@ -0,0 +1,6 @@ += Markdown to AsciiDoc converter + +A markdown to asciidoc based upon the https://github.com/asciidocfx/MarkdownToAsciidoc[Markdown-to-asciidoc] github project. + +This code loads the https://github.com/markedjs/marked[marked] Markdown Javascript parser/compiler and an extension allowing rendering as Asciidoc in https://github.com/oracle/graaljs[graal.js]. +This way, we can have it run directly in the JVM while being executed as pure Javascript. \ No newline at end of file diff --git a/markdownToAsciidoc/pom.xml b/markdown-to-asciidoc/pom.xml similarity index 50% rename from markdownToAsciidoc/pom.xml rename to markdown-to-asciidoc/pom.xml index ace6f4e7..9165af99 100644 --- a/markdownToAsciidoc/pom.xml +++ b/markdown-to-asciidoc/pom.xml @@ -1,29 +1,41 @@ - - - 4.0.0 - - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - MarkdownToAsciidoc - Aadarchi : Markdown to Asciidoc - - - - org.graalvm.js - js - 22.0.0 - - - org.graalvm.js - js-scriptengine - 22.0.0 - - - - - \ No newline at end of file + + + 4.0.0 + + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + markdown-to-asciidoc + Aadarchi : Markdown to Asciidoc + + + + commons-io + commons-io + + + org.graalvm.js + js + 22.0.0 + + + org.graalvm.js + js-scriptengine + 22.0.0 + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + diff --git a/markdownToAsciidoc/src/main/java/com/kodcu/asciidocfx/ConversionException.java b/markdown-to-asciidoc/src/main/java/com/kodcu/asciidocfx/ConversionException.java similarity index 100% rename from markdownToAsciidoc/src/main/java/com/kodcu/asciidocfx/ConversionException.java rename to markdown-to-asciidoc/src/main/java/com/kodcu/asciidocfx/ConversionException.java diff --git a/markdownToAsciidoc/src/main/java/com/kodcu/asciidocfx/MarkdownToAsciidoc.java b/markdown-to-asciidoc/src/main/java/com/kodcu/asciidocfx/MarkdownToAsciidoc.java similarity index 79% rename from markdownToAsciidoc/src/main/java/com/kodcu/asciidocfx/MarkdownToAsciidoc.java rename to markdown-to-asciidoc/src/main/java/com/kodcu/asciidocfx/MarkdownToAsciidoc.java index 23cd03b0..e522f3e0 100644 --- a/markdownToAsciidoc/src/main/java/com/kodcu/asciidocfx/MarkdownToAsciidoc.java +++ b/markdown-to-asciidoc/src/main/java/com/kodcu/asciidocfx/MarkdownToAsciidoc.java @@ -3,6 +3,9 @@ import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; + +import org.apache.commons.io.IOUtils; + import java.io.*; import java.nio.charset.Charset; import java.nio.file.Files; @@ -23,25 +26,25 @@ public class MarkdownToAsciidoc { static { - try (InputStream markedStream = MarkdownToAsciidoc.class.getResourceAsStream("/marked.js"); - InputStream markedExtensionStream = MarkdownToAsciidoc.class.getResourceAsStream("/marked-extension.js"); - InputStreamReader markedIn = new InputStreamReader(markedStream, "UTF-8"); - InputStreamReader markedExtensionIn = new InputStreamReader(markedExtensionStream, "UTF-8"); - BufferedReader markedReader = new BufferedReader(markedIn); - BufferedReader markedExtensionReader = new BufferedReader(markedExtensionIn);) { - - String markedScript = markedReader.lines().collect(Collectors.joining("\n")); - String markedExtensionScript = markedExtensionReader.lines().collect(Collectors.joining("\n")); + try { + String markedScript = IOUtils.toString(MarkdownToAsciidoc.class.getResource("/marked.js"), "UTF-8"); + String markedExtensionScript = IOUtils.toString(MarkdownToAsciidoc.class.getResource("/marked-extension.js"), "UTF-8"); engine.eval(markedScript); engine.eval(markedExtensionScript); } catch (Exception e) { - e.printStackTrace(); + throw new UnsupportedOperationException("Unable to load marked scripts", e); } } - public static String convert(String markdown) { + /** + * Convert the input string, considered as Markdown, into Asciidoc. + * @see https://github.com/oracle/graaljs/blob/master/docs/user/NashornMigrationGuide.md#multithreading + * @param markdown + * @return + */ + public static synchronized String convert(String markdown) { try { engine.put("markdown", markdown); return (String) engine.eval("markdownToAsciidoc(markdown)"); diff --git a/markdownToAsciidoc/src/main/resources/marked-extension.js b/markdown-to-asciidoc/src/main/resources/marked-extension.js similarity index 95% rename from markdownToAsciidoc/src/main/resources/marked-extension.js rename to markdown-to-asciidoc/src/main/resources/marked-extension.js index 1fb50e01..d0f6336e 100644 --- a/markdownToAsciidoc/src/main/resources/marked-extension.js +++ b/markdown-to-asciidoc/src/main/resources/marked-extension.js @@ -1,5 +1,10 @@ var md2AscRenderer = new marked.Renderer(); +md2AscRenderer.html = function (text, block) { + return "++++\n"+text+"\n++++\n"; +}; + + md2AscRenderer.heading = function (text, level) { return "\n" + repeatStuff("=", level) + " " + text + "\n"; }; @@ -106,14 +111,7 @@ md2AscRenderer.image = function (href, title, text) { }; function markdownToAsciidoc(input) { - var result = ""; - try { - var result = marked(input, {renderer: md2AscRenderer}); - } - catch (e) { - throw e; - } - return result; + return marked(input, {renderer: md2AscRenderer}); } function repeatStuff(s, n) { diff --git a/markdownToAsciidoc/src/main/resources/marked.js b/markdown-to-asciidoc/src/main/resources/marked.js similarity index 100% rename from markdownToAsciidoc/src/main/resources/marked.js rename to markdown-to-asciidoc/src/main/resources/marked.js diff --git a/markdown-to-asciidoc/src/test/java/com/kodcu/asciidocfx/MarkdownToAsciidocTest.java b/markdown-to-asciidoc/src/test/java/com/kodcu/asciidocfx/MarkdownToAsciidocTest.java new file mode 100644 index 00000000..054b1b6c --- /dev/null +++ b/markdown-to-asciidoc/src/test/java/com/kodcu/asciidocfx/MarkdownToAsciidocTest.java @@ -0,0 +1,25 @@ +package com.kodcu.asciidocfx; + +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +class MarkdownToAsciidocTest { + @Test + void can_convert_a_text() { + Assertions.assertThat(MarkdownToAsciidoc.convert("text")).isEqualTo("\ntext\n"); + } + @Test + void can_run_multiple_parallel_calls_for_388() { + // Given + // When + String text = IntStream.range(0, 100).parallel() + .mapToObj(index -> MarkdownToAsciidoc.convert("text "+index)) + .collect(Collectors.joining("\n")); + // Then + Assertions.assertThat(text).containsSubsequence("text 1", "text 2", "text 3"); + } + +} diff --git a/markdownToAsciidoc/README.adoc b/markdownToAsciidoc/README.adoc deleted file mode 100644 index c2903423..00000000 --- a/markdownToAsciidoc/README.adoc +++ /dev/null @@ -1,31 +0,0 @@ -= Markdown to AsciiDoc converter - -A small, lightweight converter for Markdown to http://www.asciidoc.org[AsciiDoc] written in Java, and using Javascript. - -It's a fork from https://github.com/asciidocfx/MarkdownToAsciidoc/tree/master[Github] + -We added Graal dependences to run JS without using Java 8 JVM compiler. - -== Usage - -To use the library, call the following: - -.Synchronous way -[source,java] ----- -String result = MarkdownToAsciidoc.convert("# Tittle"); ----- - -.Asynchronous way -[source,java] ----- -MarkdownToAsciidoc.convert("# Tittle", r -> { - System.out.println(r); -}); ----- - -.Path way -[source,java] ----- -Path outputPath = Paths.get("C:\\output.asciidoc"); -MarkdownToAsciidoc.convert("# Tittle", outputPath); ----- \ No newline at end of file diff --git a/maven-metadata-inferer/pom.xml b/maven-metadata-inferer/pom.xml index 5eb7a479..278f6b30 100644 --- a/maven-metadata-inferer/pom.xml +++ b/maven-metadata-inferer/pom.xml @@ -1,102 +1,115 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - maven-metadata-inferer - Aadarchi : Maven metadata inferer - A module allowing as much informations as possible to be read - from Maven POM - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - org.apache.maven - maven-project - 2.2.1 - - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - - - org.assertj - assertj-core - - - org.jboss.weld - weld-junit5 - - - ${project.groupId} - aadarchi-test-utils - ${project.version} - test - - - com.fasterxml.jackson.core - jackson-databind - 2.15.2 - - - - - - ${project.basedir}/src/main/resources - - - ${project.build.directory}/generated/resources - - - - - - Download popular artifacts - - - - - - - - - com.googlecode.maven-download-plugin - download-maven-plugin - - - Download mvnrepository popular artifacts - generate-resources - - wget - - - - - false - true - true - - mvnrepository.json - - 10000 - - 10 - - - - - - - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + maven-metadata-inferer + Aadarchi : Maven metadata inferer + A module allowing as much informations as possible to be read + from Maven POM + + + raw.githubusercontent.com/Riduidel/aadarchi-technology-detector/reports_mvnrepository/mvnrepository/artifacts.json + + testing,jackson,commons,io + + + + com.fasterxml.jackson.core + jackson-databind + 2.15.2 + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + org.apache.maven + maven-project + 2.2.1 + + + org.assertj + assertj-core + + + org.jboss.weld + weld-junit5 + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + ${project.groupId} + aadarchi-test-utils + ${project.version} + test + + + + + + true + ${project.basedir}/src/main/resources + + + ${project.build.directory}/generated/resources + + + + + + Download popular artifacts + + + + + + + + + com.googlecode.maven-download-plugin + download-maven-plugin + + + Download mvnrepository popular artifacts + + wget + + generate-resources + + + https://${aadarchi-technologies-url} + false + true + true + + mvnrepository.json + + 10000 + + 10 + + + + + + + + + diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenEnhancer.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenEnhancer.java index 879f014b..28877b2b 100644 --- a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenEnhancer.java +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenEnhancer.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.core.type.TypeReference; public interface MavenEnhancer { + String PREFIX = ModelElementKeys.PREFIX+"maven."; /** * URL of the maven pom the model element represents. * This URL can be @@ -18,22 +19,33 @@ public interface MavenEnhancer { * This property is only written by this enhancer, never read. * YOu can use it to identify the element as a maven module. */ - String AGILE_ARCHITECTURE_MAVEN_POM = ModelElementKeys.PREFIX+"maven.pom"; + String AGILE_ARCHITECTURE_MAVEN_POM = PREFIX+"pom"; /** * Name of a class we want to load the Maven POM for. */ - String AGILE_ARCHITECTURE_MAVEN_CLASS = ModelElementKeys.PREFIX+"maven.class"; + String AGILE_ARCHITECTURE_MAVEN_CLASS = PREFIX+"class"; /** * Maven coordinates for an element linked to a maven module. * This allows dependency inference */ - String AGILE_ARCHITECTURE_MAVEN_COORDINATES = ModelElementKeys.PREFIX+"maven.coordinates"; + String AGILE_ARCHITECTURE_MAVEN_COORDINATES = PREFIX+"coordinates"; /** * When set, this allows users to enter a list of profiles names separated by ";" */ - String AGILE_ARCHITECTURE_MAVEN_ADDITIONAL_PROFILES = ModelElementKeys.PREFIX+"maven.profiles"; + String AGILE_ARCHITECTURE_MAVEN_ADDITIONAL_PROFILES = PREFIX+"profiles"; - String AGILE_ARCHITECTURE_MAVEN_TECHNOLOGIES = ModelElementKeys.PREFIX+"maven.technologies"; + String AGILE_ARCHITECTURE_MAVEN_TECHNOLOGIES = PREFIX+"technologies"; TypeReference> AGILE_ARCHITECTURE_MAVEN_TECHNOLOGIES_TYPE = new TypeReference>() {}; + /** + * List of ignored submodules. Allows to hide architecture documentation from production-like code + */ + String IGNORED_SUBMODULES = PREFIX+"ignored.submodules"; + /** + * When set, dependencies tagged with one of the tags in this list will be filtered out from signifiant dependencies + */ + public interface FilterDpendenciesTagged { + String NAME = PREFIX+"filter.dependencies.tagged"; + String VALUE = "testing"; + } } diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenPomDecorator.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenPomDecorator.java index 211af614..8b7f8f46 100644 --- a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenPomDecorator.java +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenPomDecorator.java @@ -30,7 +30,8 @@ @Default @ApplicationScoped public class MavenPomDecorator { - private static final Logger logger = Logger.getLogger(MavenPomDecorator.class.getName()); + @Inject + Logger logger; @Inject FileSystemManager fileSystemManager; @@ -56,6 +57,7 @@ public static void decorateRecursively(MavenProject project, List * @param mavenProject */ public void decorate(Element element, MavenProject mavenProject) { + decorateMavenProperties(element, mavenProject); // I use optional to avoid writing endless if(...!=null) lines. // It may be ugly, but I'm trying a /style/ here decorateCoordinates(element, mavenProject); @@ -63,7 +65,6 @@ public void decorate(Element element, MavenProject mavenProject) { decorateIssueManager(element, mavenProject); decorateJavaSource(element, mavenProject); decorateJavaPackage(element, mavenProject); - decorateMavenProperties(element, mavenProject); technologyDecorator.decorateTechnology(element, mavenProject); Optional.ofNullable(mavenProject.getDescription()).stream() .forEach(description -> element.setDescription(description.replaceAll("\n", " "))); @@ -120,7 +121,7 @@ public void decorateJavaSource(Element element, MavenProject mavenProject) { /** * Extract all properties having the good prefix from maven pom and copy them - * into model element properties. THis copy may overwrite properties defined + * into model element properties. This copy will not overwrite properties defined * elsewhen * * @param element element to copy properties into @@ -130,6 +131,7 @@ public void decorateMavenProperties(Element element, MavenProject mavenProject) mavenProject.getProperties().entrySet().stream() .map(entry -> Map.entry(entry.getKey().toString(), entry.getValue().toString())) .filter(entry -> entry.getKey().startsWith(ModelElementKeys.PREFIX)) + .filter(entry -> !element.getProperties().containsKey(entry.getKey())) .forEach(entry -> element.addProperty(entry.getKey(), entry.getValue())); } diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancer.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancer.java index 9426a257..cc1bdb40 100644 --- a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancer.java +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancer.java @@ -1,6 +1,8 @@ package org.ndx.aadarchi.inferer.maven; +import java.util.Comparator; import java.util.Map; +import java.util.Map.Entry; import java.util.stream.Collectors; import javax.enterprise.context.ApplicationScoped; @@ -10,7 +12,6 @@ import org.ndx.aadarchi.base.AgileArchitectureSection; import org.ndx.aadarchi.base.OutputBuilder; -import org.ndx.aadarchi.base.OutputBuilder.HandledFormat; import org.ndx.aadarchi.base.enhancers.ModelElementAdapter; import org.ndx.aadarchi.inferer.maven.technologies.MvnRepositoryArtifact; import org.ndx.aadarchi.inferer.maven.technologies.MvnRepositoryArtifactsProducer; @@ -49,11 +50,23 @@ protected void processElement(StaticStructureElement element, OutputBuilder buil } } } + + private Comparator> comparator() { + return new Comparator>() { + + @Override + public int compare(Entry o1, Entry o2) { + return o1.getKey().compareTo(o2.getKey()); + } + + }; + } private void writeDependenciesArtifacts(StaticStructureElement element, Map dependenciesVersions, OutputBuilder builder) { String text = dependenciesVersions.entrySet().stream() .map(entry -> Map.entry(mvnRepositoryArtifacts.get(entry.getKey()), entry.getValue())) + .sorted(this.comparator()) .map(entry -> this.toTableRow(entry.getKey(), entry.getValue())) .collect(Collectors.joining("\n", "[%autowidth.stretch, cols=\"1a,1a,1a,1a\"]\n|===" @@ -71,8 +84,13 @@ private String toTableRow(MvnRepositoryArtifact key, String version) { .append("|").append(version==null || version.isBlank() ? "{nbsp}" : version); if(key.versions.containsKey(version)) returned.append(" (released ").append(key.versions.get(version)).append(")"); + returned.append("|"); + if(key.categories==null || key.categories.isEmpty()) { + returned.append("{nbsp}"); + } else { + returned.append(key.categoriesText); + } returned - .append("|").append(key.categories.isEmpty() ? "{nbsp}" : key.categories.stream().collect(Collectors.joining())) .append("|").append(key.description) ; return returned.toString(); diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/enhancers/AbstractContainerEnhancer.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/enhancers/AbstractContainerEnhancer.java index 2a2c792c..859c719d 100644 --- a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/enhancers/AbstractContainerEnhancer.java +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/enhancers/AbstractContainerEnhancer.java @@ -1,6 +1,7 @@ package org.ndx.aadarchi.inferer.maven.enhancers; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -182,6 +183,11 @@ private Stream loadAllSubElements(MavenProject mavenProject, Maven "Maven module %s profile %s declares the modules %s, which will not be handled here. Is it normal?\n" + "If it is not normal, add the profile in the maven property \"AGILE_ARCHITECTURE_MAVEN_ADDITIONAL_PROFILES\"", mavenProject, profile.getId(), profile.getModules()))); + // Now remove ignored modules + if(enhanced.getProperties().containsKey(MavenEnhancer.IGNORED_SUBMODULES)) { + String[] ignored = enhanced.getProperties().get(MavenEnhancer.IGNORED_SUBMODULES).split(","); + modules.removeAll(Arrays.asList(ignored)); + } return modules.stream().map(module -> readSubModulePom(mavenPomReader, parentScmDir, pomDir, module)) .flatMap(module -> module.getPackaging().equals("pom") ? loadAllSubElements(module, mavenPomReader) : Optional.of(module).stream()); diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifact.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifact.java index d961280a..34b3072d 100644 --- a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifact.java +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifact.java @@ -2,27 +2,36 @@ import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.builder.CompareToBuilder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -public class MvnRepositoryArtifact { +public class MvnRepositoryArtifact implements Comparable { public final String name; public final String coordinates; - public String description; - public List categories; - public List tags; - public Map versions; - public String page; + public final String description; + public final List categories; + public final List tags; + public final Map versions; + public final String page; + public final int ranking; + public final int users; + public final String categoriesText; @JsonCreator public MvnRepositoryArtifact(@JsonProperty("name") String name, @JsonProperty("coordinates") String coordinates, @JsonProperty("description") String description, @JsonProperty("page") String page, + @JsonProperty("ranking") int ranking, + @JsonProperty("users") int users, @JsonProperty("categories") List categories, @JsonProperty("tags") List tags, - @JsonProperty("versions") Map versions + @JsonProperty("versions") Map versions ) { super(); this.name = name; @@ -30,7 +39,35 @@ public MvnRepositoryArtifact(@JsonProperty("name") String name, this.page = page; this.description = description; this.categories = categories; + this.categoriesText = categories==null ? "" : categories.stream().sorted().collect(Collectors.joining()); + this.users = users; + this.ranking = ranking; this.tags = tags; this.versions = versions; } + + @Override + public int compareTo(MvnRepositoryArtifact o) { + return new CompareToBuilder() + .append(categoriesText, o.categoriesText) + .append(name, o.name) + .toComparison(); + } + + @Override + public int hashCode() { + return Objects.hash(coordinates, name); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + MvnRepositoryArtifact other = (MvnRepositoryArtifact) obj; + return Objects.equals(coordinates, other.coordinates) && Objects.equals(name, other.name); + } } diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducer.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducer.java index cbd20ab0..354e031f 100644 --- a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducer.java +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducer.java @@ -2,16 +2,25 @@ import java.io.IOException; import java.io.InputStream; +import java.util.List; import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Level; import java.util.logging.Logger; +import java.util.stream.Collectors; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; +import javax.inject.Inject; import javax.inject.Named; -import org.apache.commons.io.IOUtils; +import org.apache.commons.vfs2.FileObject; +import org.apache.deltaspike.core.api.config.ConfigProperty; +import org.ndx.aadarchi.base.utils.FileContentCache; +import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -19,20 +28,46 @@ public class MvnRepositoryArtifactsProducer { private static final Logger logger = Logger.getLogger(MvnRepositoryArtifactsProducer.class.getName()); public static final String MVNREPOSITORY_ARTIFACTS = "mvnRepositoryArtifactsMap"; + @Inject @ConfigProperty( + name = "aadarchi.technologies.default", + defaultValue = "res://mvnrepository.json") FileObject defaultAadarchiTechnlogies; + + @Inject @ConfigProperty(name="aadarchi.technologies.up-to-date.url") FileObject upToDateAadarchiTechnologies; + + @Inject FileContentCache cache; + /** * @see https://stleary.github.io/JSON-java/index.html * @return a JSONObject containing all popular artifacts * @throws IOException */ - @Produces @ApplicationScoped @Named(MVNREPOSITORY_ARTIFACTS) Map createMvnRepositoryArtifacts() throws IOException { + @Produces @ApplicationScoped @Named(MVNREPOSITORY_ARTIFACTS) Map + createMvnRepositoryArtifacts() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - logger.info( - String.format("Loading mvnrepository popular artifacts from %s", - getClass().getClassLoader().getResource("mvnrepository.json"))); - try(InputStream input = getClass().getClassLoader().getResourceAsStream("mvnrepository.json")) { - return objectMapper.readValue(input, new TypeReference>() {}); + List artifacts = readMvnRepositoryArtifacts(objectMapper); + return artifacts.stream() + .collect(Collectors.toMap(a -> a.coordinates, + a -> a, + (a, b) -> a, + () -> new TreeMap())); + } + + private List readMvnRepositoryArtifacts(ObjectMapper objectMapper) + throws IOException, StreamReadException, DatabindException { + List artifacts = null; + // First, ensure the cached file has some content + try { + try(InputStream input = cache.openStreamFor(upToDateAadarchiTechnologies)) { + artifacts = objectMapper.readValue(input, new TypeReference>() {}); + } + } catch(Exception e) { + logger.log(Level.WARNING, "Unable to read remote mvnrepository.json file", e); + try(InputStream input = cache.openStreamFor(defaultAadarchiTechnlogies)) { + artifacts = objectMapper.readValue(input, new TypeReference>() {}); + } } + return artifacts; } } diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/TechnologyDecorator.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/TechnologyDecorator.java index 69527e74..5afa0052 100644 --- a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/TechnologyDecorator.java +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/TechnologyDecorator.java @@ -1,16 +1,18 @@ package org.ndx.aadarchi.inferer.maven.technologies; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import java.util.logging.Logger; import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Default; @@ -28,6 +30,8 @@ import com.structurizr.model.Container; import com.structurizr.model.Element; +import edu.emory.mathcs.backport.java.util.Arrays; + /** * Component dedicated to technology decoration. * Given a maven pom and an element, it will detect interesting technologies, @@ -37,6 +41,8 @@ @Default @ApplicationScoped public class TechnologyDecorator { + @Inject + Logger logger; @Inject @Named(MvnRepositoryArtifactsProducer.MVNREPOSITORY_ARTIFACTS) Map mvnRepositoryArtifacts; ObjectMapper objectMapper = new ObjectMapper(); @@ -63,7 +69,11 @@ public void decorateTechnology(Element element, MavenProject project) { } } } - dependencies.putAll(doDecorateTechnologies(mavenProject, element)); + List popularDependencies = ((List) mavenProject.getDependencies()).stream() + .filter(d -> mvnRepositoryArtifacts.containsKey(d.getGroupId()+"."+d.getArtifactId())) + .collect(Collectors.toList()); + dependencies.putAll(popularDependencies.stream().collect(Collectors.toMap(d -> d.getGroupId()+"."+d.getArtifactId(), d -> d.getVersion()==null ? "":d.getVersion()))); + doDecorateTechnologies(popularDependencies, element); // We should explore all parent poms return true; }); @@ -98,6 +108,12 @@ private void updateManagedDependencies(Map managedDependenciesVe } } } + + private int compareArtifacts(T t1, T t2) { + Entry first = (Entry) t1; + Entry second = (Entry) t2; + return Integer.compare(first.getValue().ranking, second.getValue().ranking); + } /** * Decorate the given element with the given technologies by applying the following steps @@ -110,15 +126,28 @@ private void updateManagedDependencies(Map managedDependenciesVe * @param element * @return */ - private Map doDecorateTechnologies(MavenProject mavenProject, Element element) { - Map dependenciesToArtifacts = ((List) mavenProject.getDependencies()).stream() - .filter(d -> mvnRepositoryArtifacts.containsKey(d.getGroupId()+"."+d.getArtifactId())) - .collect(Collectors.toMap(Function.identity(), - d -> mvnRepositoryArtifacts.get(d.getGroupId()+"."+d.getArtifactId()))); + private void doDecorateTechnologies(List popularDependencies, Element element) { + String[] splitted = element.getProperties() + .getOrDefault(MavenEnhancer.FilterDpendenciesTagged.NAME, + MavenEnhancer.FilterDpendenciesTagged.VALUE) + .split(","); + List filteredTags = + Stream.of(splitted) + .map(String::trim) + .collect(Collectors.toList()) + ; + Map dependenciesToArtifacts = popularDependencies.stream() + .map(d -> Map.entry(d, mvnRepositoryArtifacts.get(d.getGroupId()+"."+d.getArtifactId()))) + .filter(entry ->!isAnyTagFiltered(filteredTags, entry.getValue())) + .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); + // We want to have that list filtered to keep, for each group id, the most popular dependency + Map>> dependenciesToArtifactsByGroup = dependenciesToArtifacts.entrySet().stream() + .collect(Collectors.groupingBy(entry -> entry.getKey().getGroupId(), + Collectors.minBy(this::compareArtifacts))); // Now we can map dependencies to artifacts, first put the list of artifact names into technologies - List technologies = dependenciesToArtifacts.values().stream() - // We filter out all technologies tagged with "testing" to simplify things a little in technologies - .filter(a -> !a.tags.contains("testing")) + List technologies = dependenciesToArtifactsByGroup.values().stream() + .flatMap(optional -> optional.stream()) + .map(entry -> entry.getValue()) .map(a -> a.name) .collect(Collectors.toList()); if(!dependenciesToArtifacts.values().stream() @@ -129,7 +158,22 @@ private Map doDecorateTechnologies(MavenProject mavenProject, El technologies.add("Java"); } injectTechnologiesInElement(element, technologies); - return dependenciesToArtifacts.keySet().stream().collect(Collectors.toMap(d -> d.getGroupId()+"."+d.getArtifactId(), d -> d.getVersion()==null ? "":d.getVersion())); + } + + /** + * Check if any of the artifact tags is in the filtered list + * @param filteredTags + * @param artifact + * @return true if any of the artifact tags appears in the filtered list + */ + private boolean isAnyTagFiltered(List filteredTags, MvnRepositoryArtifact artifact) { + boolean returned = artifact.tags.stream() + .filter(tag -> filteredTags.contains(tag)) + .findAny() + .isPresent(); + logger.info(String.format("artifact %s has tags %s. Filtered? %s", + artifact.coordinates, artifact.tags, returned)); + return returned; } private void injectTechnologiesInElement(Element element, List technologies) { diff --git a/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/VersionDetails.java b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/VersionDetails.java new file mode 100644 index 00000000..229b956e --- /dev/null +++ b/maven-metadata-inferer/src/main/java/org/ndx/aadarchi/inferer/maven/technologies/VersionDetails.java @@ -0,0 +1,26 @@ +package org.ndx.aadarchi.inferer.maven.technologies; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonFormat.Shape; + +public class VersionDetails { + private String usages; + private Date date; + private long users; + @JsonCreator + public VersionDetails( + @JsonProperty("usages") String usages, + @JsonFormat(locale = "en-US", + pattern = "MMM dd, yyyy", + shape = Shape.STRING) + @JsonProperty("date") Date date, + @JsonProperty("users") long users) { + this.usages = usages; + this.date = date; + this.users = users; + } +} diff --git a/maven-metadata-inferer/src/main/resources/META-INF/apache-deltaspike.properties b/maven-metadata-inferer/src/main/resources/META-INF/apache-deltaspike.properties new file mode 100644 index 00000000..5b1101e9 --- /dev/null +++ b/maven-metadata-inferer/src/main/resources/META-INF/apache-deltaspike.properties @@ -0,0 +1,2 @@ +# We use this file name for deltaspike to automatically find the file +aadarchi.technologies.up-to-date.url=http5s://${aadarchi-technologies-url} \ No newline at end of file diff --git a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenDetailsInfererEnhancerTest.java b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenDetailsInfererEnhancerTest.java index 696f3f69..604e8069 100644 --- a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenDetailsInfererEnhancerTest.java +++ b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenDetailsInfererEnhancerTest.java @@ -38,10 +38,10 @@ public class MavenDetailsInfererEnhancerTest { system.addProperty(ModelElementKeys.ConfigProperties.BasePath.NAME, basePath.getName().getPath()); // When // We emulate in-depth visit (but do not really perform it) - enhancer.enhance(w, Arrays.asList(tested)); + enhancer.enhance(w, tested); // Then Assertions.assertThat(system.getProperties()) - .containsOnlyKeys( + .containsKeys( ModelElementKeys.ConfigProperties.BasePath.NAME, MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_COORDINATES, MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_TECHNOLOGIES, @@ -60,7 +60,7 @@ public class MavenDetailsInfererEnhancerTest { .isNotNull() .extracting(container -> container.getProperties()) .asInstanceOf(InstanceOfAssertFactories.MAP) - .containsOnlyKeys( + .containsKeys( ModelElementKeys.ConfigProperties.BasePath.NAME, ModelElementKeys.Scm.PATH, MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_COORDINATES, @@ -86,7 +86,7 @@ public class MavenDetailsInfererEnhancerTest { SoftwareSystem system = w.getModel().addSoftwareSystem("The system to decorate with maven informations"); system.addProperty(ModelElementKeys.ConfigProperties.BasePath.NAME, basePath.getName().getPath()); // When - enhancer.enhance(w, Arrays.asList(tested)); + enhancer.enhance(w, tested); // Then // There are containers in system Assertions.assertThat(system.getContainers()).isNotEmpty(); @@ -97,7 +97,7 @@ public class MavenDetailsInfererEnhancerTest { ; Assertions.assertThat(sipocDiagramGenerator.getTechnology()) .isNotBlank() - .isEqualTo("Java"); + .contains("Java"); Container springComponentDetector = system.getContainerWithName("spring-components-detector"); Assertions.assertThat(springComponentDetector) .isNotNull() diff --git a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenPomDecoratorTest.java b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenPomDecoratorTest.java index 4fd68336..1c06a6c0 100644 --- a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenPomDecoratorTest.java +++ b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenPomDecoratorTest.java @@ -35,7 +35,7 @@ public void can_decorate_software_system() { decorator.decorate(system, project); // Then Assertions.assertThat(system.getProperties()) - .containsOnlyKeys( + .containsKeys( MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_COORDINATES, MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_TECHNOLOGIES, ModelElementKeys.Scm.PROJECT, @@ -48,8 +48,8 @@ public void can_decorate_container() { // Given var w = new Workspace(getClass().getName(), "a test workspace"); var system = w.getModel().addSoftwareSystem("The system to decorate with maven informations"); - var container = system.addContainer("maven-metadata-inferer"); - MavenProject project = reader.readMavenProject(new File("pom.xml").toURI().toString()); + var container = system.addContainer("aadarchi-maven-plugin"); + MavenProject project = reader.readMavenProject(new File("../aadarchi-maven-plugin/pom.xml").toURI().toString()); Assertions.assertThat(project).isNotNull(); // When decorator.decorate(container, project); @@ -57,9 +57,12 @@ public void can_decorate_container() { Assertions.assertThat(container.getDescription()).isNotNull(); Assertions.assertThat(container.getTechnology()) .isNotNull() - .containsIgnoringCase("maven"); + .containsIgnoringCase("Java") + // Should be present *because* we use some maven plugin typical dependencies + .containsIgnoringCase("Maven") + ; Assertions.assertThat(container.getProperties()) - .containsOnlyKeys( + .containsKeys( MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_COORDINATES, MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_TECHNOLOGIES, ModelElementKeys.Scm.PROJECT, @@ -67,4 +70,22 @@ public void can_decorate_container() { ModelElementKeys.JAVA_PACKAGES, ModelElementKeys.ISSUE_MANAGER); } + + @Test + public void test_for_394_filter_jackson_out() { + // Given + var w = new Workspace(getClass().getName(), "a test workspace"); + var system = w.getModel().addSoftwareSystem("The system to decorate with maven informations"); + var container = system.addContainer("maven-metadata-inferer"); + MavenProject project = reader.readMavenProject(new File("pom.xml").toURI().toString()); + Assertions.assertThat(project).isNotNull(); + // When + decorator.decorate(container, project); + // Then + Assertions.assertThat(container.getProperties()) + .containsKey(MavenEnhancer.FilterDpendenciesTagged.NAME) + ; + Assertions.assertThat(container.getTechnology()) + .isNotNull().doesNotContainIgnoringCase("jackson"); + } } diff --git a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancerTest.java b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancerTest.java index 76f32594..af0a1057 100644 --- a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancerTest.java +++ b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/MavenTechnologiesDocumentationEnhancerTest.java @@ -45,7 +45,7 @@ public class MavenTechnologiesDocumentationEnhancerTest { system.addProperty(ModelElementKeys.ConfigProperties.BasePath.NAME, basePath.getName().getPath()); // When // We emulate in-depth visit (but do not really perform it) - enhancer.enhance(w, Arrays.asList(mavenReader, tested)); + enhancer.enhance(w, mavenReader, tested); // Then // There are containers in system Assertions.assertThat(system.getContainers()).isNotEmpty(); diff --git a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducerTest.java b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducerTest.java index 1125e96c..0b39a900 100644 --- a/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducerTest.java +++ b/maven-metadata-inferer/src/test/java/org/ndx/aadarchi/inferer/maven/technologies/MvnRepositoryArtifactsProducerTest.java @@ -10,6 +10,7 @@ import org.jboss.weld.junit5.WeldInitiator; import org.jboss.weld.junit5.WeldSetup; import org.junit.jupiter.api.Test; +import org.ndx.aadarchi.base.utils.FileContentCache; @EnableWeld class MvnRepositoryArtifactsProducerTest { @@ -18,6 +19,8 @@ class MvnRepositoryArtifactsProducerTest { public WeldInitiator weld = WeldInitiator.performDefaultDiscovery(); @Inject @Named(MvnRepositoryArtifactsProducer.MVNREPOSITORY_ARTIFACTS) Map data; + + @Inject FileContentCache cache; @Test void mvnrepository_has_some_artifacts_in() { diff --git a/model-linter/pom.xml b/model-linter/pom.xml index 4f8c8a96..ca38b74a 100644 --- a/model-linter/pom.xml +++ b/model-linter/pom.xml @@ -1,42 +1,43 @@ - - -4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - -model-linter -Aadarchi : Model linter -A model linter that verify if some useful things are present in an element. - - - io.github.Riduidel.aadarchi - base - ${project.version} - compile - - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - - - org.assertj - assertj-core - - - org.jboss.weld - weld-junit5 - - - io.github.Riduidel.aadarchi - aadarchi-test-utils - ${project.version} - test - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + model-linter + Aadarchi : Model linter + A model linter that verify if some useful things are present in an element. + + + io.github.Riduidel.aadarchi + base + ${project.version} + compile + + + org.assertj + assertj-core + + + org.jboss.weld + weld-junit5 + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + io.github.Riduidel.aadarchi + aadarchi-test-utils + ${project.version} + test + + + diff --git a/pom.xml b/pom.xml index bb7c8043..52779a02 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,12 @@ - - 4.0.0 - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - pom - Base module of a set of tools created to allow easy + + 4.0.0 + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + pom + Base module of a set of tools created to allow easy architecture documentation based upon Simon Brown work. Aadarchi : root POM https://riduidel.github.io/aadarchi/ @@ -16,8 +17,8 @@ UTF-8 - 1.19.0 - 1.25.0 1.8.4 @@ -25,6 +26,7 @@ 1.3.5 1.15.3 5.9.1 + 2.16 + + org.apache.maven.plugins @@ -317,324 +341,381 @@ - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-versions - - enforce - - - - - 3.6 - - - 11 - - - - - - - - - - - coverage - - - - org.jacoco - jacoco-maven-plugin - 0.8.10 - - - Jacoco - prepare agent - - prepare-agent - - - - Jacoco - generate report - test - - report - - - - - - - - - release - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - A release configuration is present - - enforce - - - - - gpg.passphrase - You must set a + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-versions + + enforce + + + + + 3.6 + + + 11 + + + + + + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + + + UTF-8 + + true + custom_1 + scope,groupId,artifactId + 4 + + + + + + + apply + + prepare-package + + + + + + https://riduidel.github.io/aadarchi/ + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + Riduidel + Nicolas Delsaux + nicolas.delsaux@gmx.fr + + Tech Lead + + + + + + scm:git:https://git@github.com/Riduidel/aadarchi.git + scm:git:https://git@github.com/Riduidel/aadarchi.git + https://github.com/Riduidel/aadarchi.git + HEAD + + + GitHub + https://github.com/Riduidel/aadarchi/issues + + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + coverage + + + + org.jacoco + jacoco-maven-plugin + 0.8.10 + + + Jacoco - prepare agent + + prepare-agent + + + + Jacoco - generate report + + report + + test + + + + + + + + release + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + A release configuration is present + + enforce + + + + + gpg.passphrase + You must set a gpg.passphrase property to be able to sign maven release! - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.5.0 - - - attach-javadocs - - jar - - - false - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 3.1.0 - - - sign-artifacts - verify - - sign - - - - - - --pinentry-mode - loopback - - - - - - - org.apache.maven.plugins - maven-release-plugin - 3.0.1 - - - install - - @{version} - + @{version} + - release - - -Daadarchi.github.token=${aadarchi.github.token} - true - false - deploy - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - - - - update_version_in_files - - - - io.github.floverfelt - find-and-replace-maven-plugin - - - change-version-in-readme - process-resources - - find-and-replace - - - file-contents - ${project.basedir} - [0-9]+.[0-9]+.[0-9]+(-SNAPSHOT)? - ${project.version} - false - README.md - - - - - change-version-in-on-release-perform-maven-release - process-resources - - find-and-replace - - - file-contents - .github/workflows - - (default:\s+)('\d+\.\d+\.\d+')(-SNAPSHOT)? - $1${project.version} - false - - on_release_perform_maven_release.yml - - - - - - - - - build_github_modules - - - aadarchi.github.token - - - - github-scm-handler - github-vfs - - architecture-documentation - - - - fail_when_not_building_github_modules - - - !aadarchi.github.token - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-github-token - - enforce - - - - - aadarchi.github.token - - - - - - false - - - - - - - - - build_gitlab_modules - - - aadarchi.gitlab.token - - - - gitlab-scm-handler - gitlab-vfs - - - - signal_when_not_building_gitlab_modules - - - !aadarchi.gitlab.token - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-gitlab-token - - enforce - - - - - aadarchi.gitlab.token - - - - - - false - - - - - - - - - \ No newline at end of file + architecture-documentation + + + + fail_when_not_building_github_modules + + + !aadarchi.github.token + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-github-token + + enforce + + + + + aadarchi.github.token + + + + false + + + + + + + + + build_gitlab_modules + + + aadarchi.gitlab.token + + + + gitlab-scm-handler + gitlab-vfs + + + + signal_when_not_building_gitlab_modules + + + !aadarchi.gitlab.token + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-gitlab-token + + enforce + + + + + aadarchi.gitlab.token + + + + false + + + + + + + + + diff --git a/sequence-diagram-generator/pom.xml b/sequence-diagram-generator/pom.xml index 94922446..fe821fd6 100644 --- a/sequence-diagram-generator/pom.xml +++ b/sequence-diagram-generator/pom.xml @@ -1,48 +1,50 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - sequence-diagram-generator - Aadarchi : Sequence diagram generator - Generates sequence diagrams for components in the containers opting in for it. Model elements in those sequence diagrams should also be indicated by containers. - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - - com.github.javaparser - javaparser-symbol-solver-core - 3.16.2 - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.assertj - assertj-core - - - org.jboss.weld - weld-junit5 - - - ${project.groupId} - aadarchi-test-utils - ${project.version} - test - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + sequence-diagram-generator + Aadarchi : Sequence diagram generator + Generates sequence diagrams for components in the containers opting in for it. Model elements in those sequence diagrams should also be indicated by containers. + + + + com.github.javaparser + javaparser-symbol-solver-core + 3.16.2 + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + org.assertj + assertj-core + + + org.jboss.weld + weld-junit5 + + + ${project.groupId} + aadarchi-test-utils + ${project.version} + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/sequence-diagram-generator/src/test/java/org/ndx/aadarchi/sequence/generator/javaparser/SequenceDiagramVisitorTest.java b/sequence-diagram-generator/src/test/java/org/ndx/aadarchi/sequence/generator/javaparser/SequenceDiagramVisitorTest.java index 2535aec1..18273063 100644 --- a/sequence-diagram-generator/src/test/java/org/ndx/aadarchi/sequence/generator/javaparser/SequenceDiagramVisitorTest.java +++ b/sequence-diagram-generator/src/test/java/org/ndx/aadarchi/sequence/generator/javaparser/SequenceDiagramVisitorTest.java @@ -52,7 +52,7 @@ void can_read_a_model() { generator.addSupportingType(SequenceDiagramGenerator.class.getName()); // Let's build a sequence diagram visitor // Emulate the standard visit - enhancer.enhance(workspace, Arrays.asList(tested)); + enhancer.enhance(workspace, tested); assertThat(tested.allContainers).hasSize(1); assertThat(tested.codeToComponents).hasSize(3); assertThat(tested.callGraphModel).isNull(); diff --git a/sipoc-diagram-generator/pom.xml b/sipoc-diagram-generator/pom.xml index 0656152f..807a2f55 100644 --- a/sipoc-diagram-generator/pom.xml +++ b/sipoc-diagram-generator/pom.xml @@ -1,42 +1,43 @@ - - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - sipoc-diagram-generator - Aadarchi : SIPOC diagram generator - Generates SIPOC (suppliers/inputs/process/outputs/consumers) diagrams in an asciidoc table, for each element. - - - io.github.Riduidel.aadarchi - base - ${project.version} - compile - - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - - - org.assertj - assertj-core - - - org.jboss.weld - weld-junit5 - - - io.github.Riduidel.aadarchi - aadarchi-test-utils - ${project.version} - test - - - + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + sipoc-diagram-generator + Aadarchi : SIPOC diagram generator + Generates SIPOC (suppliers/inputs/process/outputs/consumers) diagrams in an asciidoc table, for each element. + + + io.github.Riduidel.aadarchi + base + ${project.version} + compile + + + org.assertj + assertj-core + + + org.jboss.weld + weld-junit5 + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + io.github.Riduidel.aadarchi + aadarchi-test-utils + ${project.version} + test + + + diff --git a/sipoc-diagram-generator/src/test/java/org/ndx/aadarchi/sipoc/diagram/generator/SipocEnhancerTest.java b/sipoc-diagram-generator/src/test/java/org/ndx/aadarchi/sipoc/diagram/generator/SipocEnhancerTest.java index 1bcd8e70..b4375ea9 100644 --- a/sipoc-diagram-generator/src/test/java/org/ndx/aadarchi/sipoc/diagram/generator/SipocEnhancerTest.java +++ b/sipoc-diagram-generator/src/test/java/org/ndx/aadarchi/sipoc/diagram/generator/SipocEnhancerTest.java @@ -26,7 +26,7 @@ class SipocEnhancerTest extends AbstractSipocTest { void test() { // Given // When - enhancer.enhance(workspace, List.of(sipocEnhancer)); + enhancer.enhance(workspace, sipocEnhancer); // Then FileObject outputFolderForSystem = enhancer.getOutputBuilder() .outputFor(AgileArchitectureSection.code, centerContainer, sipocEnhancer, OutputBuilder.Format.adoc); diff --git a/spring-components-detector/pom.xml b/spring-components-detector/pom.xml index aa793ab9..99ef589d 100644 --- a/spring-components-detector/pom.xml +++ b/spring-components-detector/pom.xml @@ -1,26 +1,28 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - spring-components-detector - Aadarchi : Spring components detector - Component allowing detection of Spring components in a Spring technology based container. - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - - com.structurizr - structurizr-spring - 1.3.5 - - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + spring-components-detector + Aadarchi : Spring components detector + Component allowing detection of Spring components in a Spring technology based container. + + + + com.structurizr + structurizr-spring + 1.3.5 + + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + diff --git a/structurizr-components-detector/pom.xml b/structurizr-components-detector/pom.xml index 4922283a..0d7933d2 100644 --- a/structurizr-components-detector/pom.xml +++ b/structurizr-components-detector/pom.xml @@ -1,40 +1,42 @@ - - 4.0.0 - - io.github.Riduidel.aadarchi - system - 0.1.12-SNAPSHOT - - structurizr-components-detector - Aadarchi : Structurizr components detector - A component detector that uses Structurizr annotations to find existing components and their relationship. - - - com.structurizr - structurizr-analysis - - - io.github.Riduidel.aadarchi - base - ${project.version} - - - org.junit.jupiter - junit-jupiter-api - - - org.assertj - assertj-core - test - - - org.mockito - mockito-junit-jupiter - test - - - org.jboss.weld - weld-junit5 - - - \ No newline at end of file + + + 4.0.0 + + io.github.Riduidel.aadarchi + system + 0.1.15-SNAPSHOT + + structurizr-components-detector + Aadarchi : Structurizr components detector + A component detector that uses Structurizr annotations to find existing components and their relationship. + + + com.structurizr + structurizr-analysis + + + io.github.Riduidel.aadarchi + base + ${project.version} + + + org.jboss.weld + weld-junit5 + + + org.junit.jupiter + junit-jupiter-api + + + org.assertj + assertj-core + test + + + org.mockito + mockito-junit-jupiter + test + + +