[
https://issues.apache.org/jira/browse/SLING-7925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16615023#comment-16615023
]
Simone Tripodi commented on SLING-7925:
---------------------------------------
Hi there [~cziegeler] [~bosschaert],
please have a look at the latest attached patch - it is implemented in order to
have the previous Maven check being an {{AnalyserTask}} implementation (with
related {{ExtensionScanner}}).
I used the three attached JSON files to test it (despite the fact that I wrote
a small script to launch the app):
* A feature which does not declare an {{api-region}} extension:
{noformat}
$ ./sling-feature-analyzer -f emptyApiRegions.json -p
org.apache.sling.feature.analyser.task.impl.CheckApiRegions
[INFO] Apache Sling Application Analyser
[INFO]
[INFO] Starting feature analyzer...
[INFO] - Executing CheckApiRegions...
[INFO] Provisioning model analyzer finished
{noformat}
* A feature which declares a valid {{api-region}} extension:
{noformat}
$ ./sling-feature-analyzer -f noErrorsDetected.json -p
org.apache.sling.feature.analyser.task.impl.CheckApiRegions
[INFO] Apache Sling Application Analyser
[INFO]
[INFO] Starting feature analyzer...
[INFO] - Executing CheckApiRegions...
[INFO] Provisioning model analyzer finished
{noformat}
* A feature which declares a not-valid {{api-region}} extension:
{noformat}
$ ./sling-feature-analyzer -f errorsDetected.json -p
org.apache.sling.feature.analyser.task.impl.CheckApiRegions
[INFO] Apache Sling Application Analyser
[INFO]
[INFO] Starting feature analyzer...
[INFO] - Executing CheckApiRegions...
[ERROR] Region 'asf' defined in feature 'testing:test:slingfeature:testa:1.0.1'
declares 1 package which is not exported by any bundle:
* org.osgi.util.function.doesnotexist
[ERROR] Region 'global' defined in feature
'testing:test:slingfeature:testa:1.0.1' declares 1 package which is not
exported by any bundle:
* org.osgi.util.function.doesnotexist
[ERROR] Unable to analyse feature: errorsDetected.json
java.lang.Exception: Analyser detected errors. See log output for error
messages.
at org.apache.sling.feature.analyser.Analyser.analyse(Analyser.java:144)
at org.apache.sling.feature.analyser.Analyser.analyse(Analyser.java:87)
at org.apache.sling.feature.analyser.main.Main.main(Main.java:99)
{noformat}
Please let me know what you think - I should have enough rights to push
modifications by myself, but feel free to check them in.
> Donating a new Mojo which is able to validate APIs/Regions
> -----------------------------------------------------------
>
> Key: SLING-7925
> URL: https://issues.apache.org/jira/browse/SLING-7925
> Project: Sling
> Issue Type: New Feature
> Components: Feature Model, Maven Plugins and Archetypes
> Reporter: Simone Tripodi
> Assignee: David Bosschaert
> Priority: Major
> Attachments: SLING-7925.1.patch, SLING-7925.2.patch,
> SLING-7925.patch, emptyApiRegions.json, errorsDetected.json,
> noErrorsDetected.json
>
>
> According to open discussion on SLING-7779, I started using a subset of the
> features described, then in order to produce valid results I had the need to
> implement a validator which detects discrepancies between what is declared in
> the {{export}} section of each region and what is really exported by bundles
> enlisted in the feature itself.
> The verification works in order to accept a feature files directory as a
> input, supports the typical {{(in|ex)cludes}} Maven pattern, validation works
> locally per-featurefile and doesn't support the global validation.
> Patch, including integration tests, is coming!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)