B4A.UTIL.DOCU.BODY-DEPENDENCY-DEFINITION-VERIFY

Summary

%{XML2ATTR,PREFIX=xml,KEY=::}

%{SCRIPT:groovy: def deps = $attributes.xml.best4Automic.pm.package.dependencies instanceof String ? [] : $attributes.xml.best4Automic.pm.package.dependencies.dependency

def status = [
   OK : 0,
   UNNECESSARY : 0,
   NOT_INSTALLED : 0,
   WRONG_VERSION : 0,
   MISSING : 0
]

if ( deps instanceof HashMap )
   deps = [ deps ]
for ( dep in deps ) {
   status[ dep.status ] += 1
}
def errors = status.UNNECESSARY + status.NOT_INSTALLED + status.WRONG_VERSION + status.MISSING > 0

$output.append( """\

Summary

StatusCount
Correct$status.OK
Unnecessary$status.UNNECESSARY
Wrong Version$status.WRONG_VERSION
Missing$status.MISSING
Not Installed$status.NOT_INSTALLED
""" )
$output.append( "<h1>Errors in Dependencies</h1>" )

def filteredDeps = deps.findAll{ it.status.equals( "MISSING" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Missing Dependencies</h2><table><tr><th>Package</th><th>Installed Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td><td>$dep.installed.version</td></tr>" )
   }
}
$output.append( "</table>" )

filteredDeps = deps.findAll{ it.status.equals( "NOT_INSTALLED" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Not Installed Dependencies</h2><table><tr><th>Package</th><th>Operator</th><th>Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td>$dep.operator<td><td>$dep.version</td></tr>" )
   }
}
$output.append( "</table>" )

filteredDeps = deps.findAll{ it.status.equals( "UNNECESSARY" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Unnecessary Dependencies</h2><table><tr><th>Package</th><th>Operator</th><th>Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td>$dep.operator<td><td>$dep.version</td></tr>" )
   }
}
$output.append( "</table>" )

filteredDeps = deps.findAll{ it.status.equals( "WRONG_VERSION" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Wrong Version in Dependencies</h2><table><tr><th>Package</th><th>Operator</th><th>Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td>$dep.operator<td><td>$dep.version</td></tr>" )
   }
}
$output.append( "</table>" )

$output.append( "<h1>References</h1>" )

def refs = $attributes.xml.best4Automic.pm.package.references instanceof String ? [] : $attributes.xml.best4Automic.pm.package.references.object

$output.append( "<table><tr><th>Source Object</th><th>Referenced Objects</th></tr>" )

if ( !( refs instanceof List ) ) {
   refs = [ refs ]
}     
for ( ref in refs ) {
   def reflist = ""
   if ( ref.reference instanceof List )
      reflist = ref.reference.inject([]) { result, entry -> result << "$entry.name" }.join( ", " )
   else
      reflist = ref.reference.name
   $output.append( "<tr><td>$ref.name</td><td>$reflist</td></tr>" )
}
$output.append( "</table>" )

}

Object type
DOCU
Object Folder
PACKAGES/BEST4AUTOMIC/B4A.UTIL/CONFIG
Title
mail body for pm.DependencyDefinitionVerify
Archive Key 1
-
Archive Key 2
-
Created
WRITER/B4A am: 2022-03-29 08:21:47
Last Modified
WRITER/B4A am: 2024-01-09 10:32:28 12 x
Last Used
-

Text Documentation

%{XML2ATTR,PREFIX=xml,KEY=%(custom.key):%(custom.variable):}

%{SCRIPT:groovy: def deps = $attributes.xml.best4Automic.pm.package.dependencies instanceof String ? [] : $attributes.xml.best4Automic.pm.package.dependencies.dependency

def status = [
   OK : 0,
   UNNECESSARY : 0,
   NOT_INSTALLED : 0,
   WRONG_VERSION : 0,
   MISSING : 0
]

if ( deps instanceof HashMap )
   deps = [ deps ]
for ( dep in deps ) {
   status[ dep.status ] += 1
}
def errors = status.UNNECESSARY + status.NOT_INSTALLED + status.WRONG_VERSION + status.MISSING > 0

$output.append( """\

Summary

StatusCount
Correct$status.OK
Unnecessary$status.UNNECESSARY
Wrong Version$status.WRONG_VERSION
Missing$status.MISSING
Not Installed$status.NOT_INSTALLED
""" )
$output.append( "<h1>Errors in Dependencies</h1>" )

def filteredDeps = deps.findAll{ it.status.equals( "MISSING" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Missing Dependencies</h2><table><tr><th>Package</th><th>Installed Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td><td>$dep.installed.version</td></tr>" )
   }
}
$output.append( "</table>" )

filteredDeps = deps.findAll{ it.status.equals( "NOT_INSTALLED" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Not Installed Dependencies</h2><table><tr><th>Package</th><th>Operator</th><th>Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td>$dep.operator<td><td>$dep.version</td></tr>" )
   }
}
$output.append( "</table>" )

filteredDeps = deps.findAll{ it.status.equals( "UNNECESSARY" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Unnecessary Dependencies</h2><table><tr><th>Package</th><th>Operator</th><th>Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td>$dep.operator<td><td>$dep.version</td></tr>" )
   }
}
$output.append( "</table>" )

filteredDeps = deps.findAll{ it.status.equals( "WRONG_VERSION" ) }
if ( filteredDeps.size() > 0 ) {
   $output.append( "<h2>Wrong Version in Dependencies</h2><table><tr><th>Package</th><th>Operator</th><th>Version</th></tr>" )
   for ( dep in filteredDeps ) {
      $output.append( "<tr><td>$dep.package</td>$dep.operator<td><td>$dep.version</td></tr>" )
   }
}
$output.append( "</table>" )

$output.append( "<h1>References</h1>" )

def refs = $attributes.xml.best4Automic.pm.package.references instanceof String ? [] : $attributes.xml.best4Automic.pm.package.references.object

$output.append( "<table><tr><th>Source Object</th><th>Referenced Objects</th></tr>" )

if ( !( refs instanceof List ) ) {
   refs = [ refs ]
}     
for ( ref in refs ) {
   def reflist = ""
   if ( ref.reference instanceof List )
      reflist = ref.reference.inject([]) { result, entry -> result << "$entry.name" }.join( ", " )
   else
      reflist = ref.reference.name
   $output.append( "<tr><td>$ref.name</td><td>$reflist</td></tr>" )
}
$output.append( "</table>" )

}

XML Documentation