Simone Tripodi created SLING-7929:
-------------------------------------

             Summary: Create a distribution package for the Feature Analyser
                 Key: SLING-7929
                 URL: https://issues.apache.org/jira/browse/SLING-7929
             Project: Sling
          Issue Type: Improvement
          Components: Feature Model, Tooling
            Reporter: Simone Tripodi


Packaging matters even if software distribution, I am going to submit a 
proposal where the Analyser package can be distributed as a "product" like if 
it was Apache Tomcat or Apache Maven, users will be able to download a {{.zip}} 
or a {{.tar.gz}} package including required artifacts and multi-platform 
binaries, the README with instructions of installation and usage and, of 
course, legal files including NOTICE and LICENSE with enlisted dependencies.

{noformat}
i$ unzip org.apache.sling.feature.analyser-0.1.3-SNAPSHOT.zip 
Archive:  org.apache.sling.feature.analyser-0.1.3-SNAPSHOT.zip
   creating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/
   creating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/bin/
   creating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/
  inflating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/LICENSE  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/slf4j-simple-1.7.25.jar  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.apache.sling.feature.io-0.1.3-SNAPSHOT.jar
  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.apache.felix.utils-1.11.0.jar
  
  inflating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/NOTICE  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/guava-21.0.jar  
  inflating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/README.md  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/commons-lang-2.6.jar  
  inflating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/bin/sfa  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.osgi.annotation.versioning-1.0.0.jar
  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.apache.sling.feature-0.1.3-SNAPSHOT.jar
  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.apache.sling.feature.analyser-0.1.3-SNAPSHOT.jar
  
  inflating: org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/bin/sfa.bat  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/slf4j-api-1.7.25.jar  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/geronimo-json_1.0_spec-1.0-alpha-1.jar
  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.osgi.util.function-1.0.0.jar
  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.apache.felix.configurator-1.0.4.jar
  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/airline-0.8.jar  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.apache.felix.converter-1.0.0.jar
  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/javax.inject-1.jar  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/osgi.core-6.0.0.jar  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/jsr305-3.0.0.jar  
  inflating: 
org.apache.sling.feature.analyser-0.1.3-SNAPSHOT/lib/org.apache.sling.commons.johnzon-1.0.0.jar
 
{noformat}

I am also enriching the CLI with few useful options (enable the debug log or 
reducing it to errors-only, see the product version) and a shiny {{help}} 
command that will simplify users usage, i.e.

  Open the shell and type `sfa help` to see the available commands:

{noformat}
$ ./bin/sfa help
usage: sfa <command> [<args>]

The most commonly used sfa commands are:
    analyse   Apache Sling Application Analyser
    help      Display help information

See 'sfa help <command>' for more information on a specific command.
{noformat}

  See the `analyse` options:

{noformat}
$ ./bin/sfa help analyse
NAME
        sfa analyse - Apache Sling Application Analyser

SYNOPSIS
        sfa analyse (-f <featureFile> | --feature-file <featureFile>)
                [(-p <pluginClass> | --plugin-class <pluginClass>)] [(-q | 
--quiet)]
                [(-v | --version)] [(-X | --verbose)]

OPTIONS
        -f <featureFile>, --feature-file <featureFile>
            Set feature file.

        -p <pluginClass>, --plugin-class <pluginClass>
            Explicitly specify plugin class to run, if ommitted the default
            plugins are used

        -q, --quiet
            Log errors only.

        -v, --version
            Display version information.

        -X, --verbose
            Produce execution debug output.
{noformat}

And a sample execution (please note version print and debug enabled):

{noformat}
$ ./bin/sfa analyse -X -v -f /path/to/src/main/features/emptyApiRegions.json 
[INFO] org.apache.sling.feature.analyser v0.1.3-SNAPSHOT (built on 
2018-09-15T10:28:55Z)
[INFO] Java version: 1.8.0_152, vendor: Oracle Corporation
[INFO] Java home: 
/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre
[INFO] Default locale: en_CH, platform encoding: UTF-8
[INFO] Default Time Zone: 
sun.util.calendar.ZoneInfo[id="UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
[INFO] OS name: "Mac OS X", version: "10.13.6", arch: "x86_64", family: "mac"
[INFO] +-----------------------------------------------------+
[INFO] Apache Sling Application Analyser
[INFO] 
[INFO] Starting feature analyzer...
[DEBUG] Trying to get artifact for 
mvn:org.apache.felix/org.apache.felix.converter/1.0.0
[DEBUG] Querying repositories for 
org/apache/felix/org.apache.felix.converter/1.0.0/org.apache.felix.converter-1.0.0.jar
[DEBUG] Checking DefaultArtifactHandler to get artifact from 
file:///Users/stripodi/.m2/repository/org/apache/felix/org.apache.felix.converter/1.0.0/org.apache.felix.converter-1.0.0.jar
[DEBUG] Checking url to be local file 
file:///Users/stripodi/.m2/repository/org/apache/felix/org.apache.felix.converter/1.0.0/org.apache.felix.converter-1.0.0.jar
[DEBUG] Found artifact 
file:///Users/stripodi/.m2/repository/org/apache/felix/org.apache.felix.converter/1.0.0/org.apache.felix.converter-1.0.0.jar
[INFO] - Executing Bundle Import/Export Check...
[INFO] - Executing Bundle Initial Content Check...
[INFO] - Executing Bundle Resources Check...
[INFO] - Executing CheckRequirementsCapabilities...
[ERROR] Artifact org.apache.felix.converter:1.0.0 requires 
[org.apache.felix.converter/1.0.0] osgi.ee; 
filter:="(&(osgi.ee=JavaSE)(version=1.7))" in start level 0 but no artifact is 
providing a matching capability in this start level.
[INFO] +-----------------------------------------------------+
[INFO] Apache Sling Application Analyser FAILURE
[INFO] +-----------------------------------------------------+
[ERROR] Unable to analyse feature 
/Users/stripodi/Documents/cq-workspace/sling-slingfeature-maven-plugin/src/it/empty-api-regions/src/main/features/emptyApiRegions.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.run(Main.java:106)
        at org.apache.sling.feature.analyser.main.Main.main(Main.java:188)
[INFO] 
[INFO] +-----------------------------------------------------+
[INFO] 
[INFO] Total time: 144 milliseconds
[INFO] Finished at: Sat Sep 15 10:29:38 UTC 2018
[INFO] Final Memory: 37M/245M
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to