saker.build Documentation TaskDoc JavaDoc Packages
public interface ScriptModellingEnvironment extends AutoCloseable
Configureable environment for script modelling.

The script modelling environment is responsible for discovering the script file subjects for modelling, and serving as a common container for build script models.

The currently discovered script file paths can be retrieved by calling getTrackedScriptPaths(). The discovery mechanism is implementation dependent for the build scripts. (E.g. it can be implemented by file system watchers, or can require manual handling)

The behaviour for creating models by the environment is implementation dependent. It can use lazy or eager instantiation as it sees fit.

The configuration of the modelling environment can change during its lifetime, and clients should handle that gracefully according to the recommended behaviour suggested by getConfiguration().

Methods
public void
Closes this modelling environment.
public ScriptModellingEnvironmentConfiguration
Gets the configuration for this modelling environment.
public ScriptSyntaxModel
getModel(SakerPath scriptpath)
Gets a script model for the file at the given path.
public NavigableSet<SakerPath>
Gets a snapshot of tracked script paths by this environment.
public abstract void close() throws IOException
Closes this modelling environment.

Closing will release all resources of this modelling environment. Further calls to this environment are to return empty collections and null when appropriate.

Subsequent calls to this method are no-op. I.e. this method is idempotent.

IOExceptionIn case of closing error.
Gets the configuration for this modelling environment.

The configuration can change during the lifetime of the modelling environment without any notification to the callers. Clients should not retain reference to the returned configuration instance, but query it every time from the modelling environment if access to related data is required.

The configuration.
Gets a script model for the file at the given path.

This method doesn't always return non-null, some possible scenarios are the following:

  • No script configuration was defined for the file at the given path.
  • The path is configured to be excluded.
  • The environment failed to load the scripting language for the file.
  • The path is not a valid path for the current path configuration.
This method will return non-null if the file doesn't exist, but the creation of the model might fail due to the file not being found.
scriptpathThe path of the file.
The model for the file at the given path or null if not applicable.
InvalidPathFormatExceptionIf the script path is not absolute.
Gets a snapshot of tracked script paths by this environment.

The returned collection is a snapshot, after calling this method the environment might have discovered new script files.

A snapshot of the tracked script paths. Might be unmodifiable. If not, then modifications do not propagate back.