Name

spvmdeps - Class Dependencies Analyzer

Description

spvmdeps command is a class dependencies analyzer.

Usage

usage: spvmdeps [<options>] <script_name>
  
  spvmdeps myapp.spvm
  
  spvmdeps --with-version myapp.spvm
  
  spvmdeps --cpanm --with-version myapp.spvm
  
  spvmdeps --cpanfile --with-version myapp.spvm
  
options:
  -h, --help                      Shows this message
  -v, --version                   Shows the version
  -I, --include-dir <directory>   Adds a include directory
  --json                          Prints JSON that contains all dependent class information.
  --cpanm                         Prints cpanm commands that contains dependent cpan modules
  --cpanfile                      Prints cpanfile that contains dependent cpan modules
  --with-version                  Output(default, --cpanm, --json) contains version information.
  --exclude <class_name>          Excludes a class name. This option can be used repeatedly.
  --resource-info                 Shows config files of dependent resources

Details

spvmdeps [<options>] <script_name>

The spvmdeps command prints class dependency information.

Output Examples:

Sys
Regex
Foo
Bar

# --with-version
Sys 1.201
Regex 0.980
Foo (version_from Sys)
Bar

<options> are options.

<script_name> is a script name that contains a bootstrap method in an anon class.

class {
  static method main : void () {
    
  }
}

See Class Search Directories about default class search directories.

See SPVM::Document::EnvironmentVariables about available environment variables.

Options

--help

Outputs how to use the spvmdeps command to standard output.

-h

-h

Same as "--help".

--version

Outputs the version of the spvmdeps command to standard output. This version is the same as the version of SPVM.

-v

-v

Same as "--version".

--include-dir

--include-dir <directory>

Prepends <directory> to class search directories

This option can be specified multiple times.

--include-dir dir1 --include-dir dir2

In this case, class search directories becomes the following.

[dir1, dir2, default_dirs]

-I

-I <directory>

Same as "--include-dir".

--json

--json

Prints JSON that contains all dependent class information.

Output Examples:

[
  {"class_name":"Address"},
  {"class_name":"Bool"},
  {"class_name":"Byte"},
  {"class_name":"CommandInfo"},
  {"class_name":"Double"},
  {"class_name":"Error"},
  {"class_name":"Error::Compile"},
  {"class_name":"Error::NotSupported"},
  {"class_name":"Error::System"},
  {"class_name":"Float"},
  {"class_name":"Int"},
  {"class_name":"Long"},
  {"class_name":"SPVM"},
  {"class_name":"Short"},
  {"class_name":"TestCase::NativeAPI2"},
  {"class_name":"TestCase::Precompile"}
]

# --with-version
[
  {"class_name":"Address","version_from":"SPVM"},
  {"class_name":"Bool","version_from":"SPVM"},
  {"class_name":"Byte","version_from":"SPVM"},
  {"class_name":"CommandInfo","version_from":"SPVM"},
  {"class_name":"Double","version_from":"SPVM"},
  {"class_name":"Error","version_from":"SPVM"},
  {"class_name":"Error::Compile","version_from":"SPVM"},
  {"class_name":"Error::NotSupported","version_from":"SPVM"},
  {"class_name":"Error::System","version_from":"SPVM"},
  {"class_name":"Float","version_from":"SPVM"},
  {"class_name":"Int","version_from":"SPVM"},
  {"class_name":"Long","version_from":"SPVM"},
  {"class_name":"SPVM","version":"0.990036"},
  {"class_name":"Short","version_from":"SPVM"},
  {"class_name":"TestCase::NativeAPI2","version":"1.002"},
  {"class_name":"TestCase::Precompile","version":"2.005"}
]

--cpanm

--cpanm

Prints cpanm commands that contains dependent CPAN modules. Classes its version is specified are treated as dependent CPAN modules.

Output Examples:

cpanm SPVM
cpanm SPVM::Sys
cpanm SPVM::Regex

# --with-version
cpanm SPVM@1.001
cpanm SPVM::Sys@1.201
cpanm SPVM::Regex@0.980

--cpanfile

--cpanfile

Prints cpanfile that contains dependent CPAN modules. Classes its version is specified are treated as dependent CPAN modules.

Output Examples:

requires 'SPVM';
requires 'SPVM::Sys';
requires 'SPVM::Regex';

# --with-version
requires 'SPVM', '== 1.001';
requires 'SPVM::Sys', '== 1.201';
requires 'SPVM::Regex', '== 0.980';

--with-version

--with-version

Output(default, "--cpanm", "--cpanfile", "--json") contains version information.

--exclude

--exclude=<class_name>

Excludes a class name. This option can be used repeatedly.

Examples:

--exclude TestCase::Foo

Wildcard * can be used.

--exclude TestCase::*

--resource-info

--resource-info

Shows all config files loading resources.

lib Directive

If the source code specified by <script_name> contains lib directives, The directories specified by lib directive is prepeneded to class search directories.

#lib "$FindBin::Bin/lib"

class {

}

This directories specified by lib directive is placed after the directories specified by "--include-dir" option.

Copyright & License

Copyright 2023 Yuki Kimoto. All Rights Reserved.

MIT License.