saker.sdk.support Documentation TaskDoc JavaDoc Packages
public class SDKSupportUtils
Utility class providing functions for SDK management.
Methods
public static EnvironmentProperty<extends SDKReference>
Gets an EnvironmentProperty that computes its value using the argument EnvironmentSDKDescription.
public static TaskExecutionEnvironmentSelector
Gets a TaskExecutionEnvironmentSelector instance that selects the suitable environments for the argument SDKs with regard to cluster execution.
public static Comparator<String>
Gets a Comparator that should be used when comparing SDK names.
public static SakerPath
Gets the path for the given path reference from the specified SDKs.
public static String
Gets the property value for the given property reference from the specified SDKs.
public static <T> T
public static NavigableMap<String, SDKDescription>
pinSDKSelection(NavigableMap<String, ? extends SDKDescription> sdkdescriptions, NavigableMap<String, ? extends SDKReference> sdkreferences)
Pins the SDK descriptions of the resolved indeterminate SDK descriptions.
public static NavigableMap<String, SDKDescription>
pinSDKSelection(EnvironmentSelectionResult envselectionresult, NavigableMap<String, ? extends SDKDescription> sdkdescriptions)
Pins the SDK descriptions of the resolved indeterminate SDK descriptions.
public static SDKReference
requireSDK(Map<String, ? extends SDKReference> sdks, String name)
Retrieves an SDK from the argument SDK map or throws an exception if not found.
public static SDKReference
Resolves an SDK reference from the given SDK description.
public static SDKReference
resolveSDKReference(TaskContext taskcontext, SDKDescription sdkdescription)
Resolves an SDK reference from the given SDK description.
public static NavigableMap<String, SDKReference>
resolveSDKReferences(SakerEnvironment environment, NavigableMap<String, ? extends SDKDescription> sdkdescriptions)
Resolves the SDK references for the specified SDK descriptions.
public static NavigableMap<String, SDKReference>
resolveSDKReferences(TaskContext taskcontext, NavigableMap<String, ? extends SDKDescription> sdkdescriptions)
Resolves the SDK references for the specified SDK descriptions.
Gets an EnvironmentProperty that computes its value using the argument EnvironmentSDKDescription.

The created environment property will use EnvironmentSDKDescription.getSDK(SakerEnvironment) to compute its value. The created property is basically a wrapper.

sdkdescriptionThe SDK description.
The created environment property.
NullPointerExceptionIf the argument is null.
Gets a TaskExecutionEnvironmentSelector instance that selects the suitable environments for the argument SDKs with regard to cluster execution.

The method will check if the argument SDKs are a good candidate for remote dispatched task execution. If all SDKs are appropriate, a TaskExecutionEnvironmentSelector will be returned that can determine whether or not a given cluster build environment is suitable for execution with the given SDKs.

If this method returns non-null, then the returned environment selector may be used with the TaskFactory.CAPABILITY_REMOTE_DISPATCHABLE task capability. If the result is null, then at least one SDK description is directly associated with the local build environment.

sdkdescriptionsThe SDK descriptions.
The environment selector for cluster execution or null if the SDK descriptions are not suitable for that use-case.
NullPointerExceptionIf the argument or any of the SDK descriptions are null.
saker.sdk.support 0.8.1
Gets a Comparator that should be used when comparing SDK names.

The SDK API defines that the SDK names should be compared in an ignore-case manner. This method returns a comparator that compares the SDK name strings appropriately.

The returned Comparator is Externalizable.

The comparator.
Gets the path for the given path reference from the specified SDKs.

The function will query the path that the SDKPathReference references from the SDK with the associated name.

The argument SDK map should be ordered using getSDKNameComparator(). This function doesn't handle if the map uses case-sensitive keys.

sdkpathrefThe path reference to query.
sdksThe SDKs that is associated with the enclosing operation.
The path that was found for the given path reference.
NullPointerExceptionIf the SDKPathReference is null, or the SDK name that it contains is null.
SDKNotFoundExceptionIf the SDK for the given name wasn't found.
SDKPathNotFoundExceptionIf the SDK path wasn't found or querying the SDK path failed with an exception.
Gets the property value for the given property reference from the specified SDKs.

The function will query the property that the SDKPropertyReference references from the SDK with the associated name.

The argument SDK map should be ordered using getSDKNameComparator(). This function doesn't handle if the map uses case-sensitive keys.

sdkpropertyrefThe property reference to query.
sdksThe SDKs that is associated with the enclosing operation.
The property value that was found for the given property reference.
NullPointerExceptionIf the SDKPropertyReference is null, or the SDK name that it contains is null.
SDKNotFoundExceptionIf the SDK for the given name wasn't found.
SDKPropertyNotFoundExceptionIf the SDK property wasn't found or querying the SDK property failed with an exception.
Pins the SDK descriptions of the resolved indeterminate SDK descriptions.

This method works the same way as pinSDKSelection(EnvironmentSelectionResult, NavigableMap<String, ? extends SDKDescription>), but retrieves the resolved SDK references from the given argument rather than an environment selection result.

sdkdescriptionsThe SDK descriptions that should be pinned.
sdkreferencesThe resolved SDK references.
The pinned SDK description map.
NullPointerExceptionIf any of the arguments are null.
SDKNotFoundExceptionIf the resolved SDK reference is not found for a given description.
saker.sdk.support 0.8.3
Pins the SDK descriptions of the resolved indeterminate SDK descriptions.

The method will take the argument environment selection result and pin the SDK descriptions of the IndeterminateSDKDescriptions that are present.

This method should be used before batched tasks with common environmental requirements to avoid mistakenly using different SDKs where the same ones would be expected. The returned descriptions can be used to recreate the execution environment selector for the actual dispatching.

One example where this may matter:

 Coordinator SDKs: v1.0, v1.1, v2.0
 Cluster1 SDKs:          v1.1, v2.0
 Cluster2 SDKs:    v1.0, v1.1
 
When different SDKs are installed on the cluster machines, it may occurr that all SDK descriptions resolve to some version of a given SDK, however, this can cause issues if different versions of it is used in the same build.

Without SDK pinning, all machines in the above list would be used. With pinning, only the machines will be used that have the selected SDK.

If the environment selection chooses v2.0, then only the Coordinator and Cluster1 is used to dispatch the tasks. If v1.1 is choosen, then all machines are used, and if v1.0 is choosen, only Coordinator and Cluster2 is used.

We recommend setting up homogeneous cluster environments to avoid such issues, and occasional non-deterministic builds.

envselectionresultThe environment test selection result of the selector returned by getSDKBasedClusterExecutionEnvironmentSelector(Collection<extends SDKDescription>).
sdkdescriptionsThe SDK descriptions that should be pinned.
The pinned SDK description map.
NullPointerExceptionIf any of the arguments are null.
SDKNotFoundExceptionIf the resolved SDK reference is not found for a given description.
saker.sdk.support 0.8.1
Retrieves an SDK from the argument SDK map or throws an exception if not found.
sdksThe SDKs. The map should be ordered by the rules of getSDKNameComparator().
nameThe name to get the SDK for.
The SDK found for the given name.
SDKNotFoundExceptionIf the SDK was not present in the argument map.
NullPointerExceptionIf the name argument is null.
saker.sdk.support 0.8.3
Resolves an SDK reference from the given SDK description.

The method will examine the specified SDKDescription and create the matching SDKReference instance for it.

This method works similarly to resolveSDKReference(TaskContext, SDKDescription), but doesn't report dependencies.

environmentThe build environment.
sdkdescriptionThe SDK description to resolve.
The resolved SDK reference.
NullPointerExceptionIf any of the arguments are null.
SDKNotFoundExceptionIf the SDK cannot be resolved in the current build environment.
saker.sdk.support 0.8.2
Resolves an SDK reference from the given SDK description.

The method will examine the specified SDKDescription and create the matching SDKReference instance for it.

The method will install appropriate dependencies using the specified TaskContext. These dependencies are environment property dependencies that are associated with the SDK resolution.

taskcontextThe task context.
sdkdescriptionThe SDK description to resolve.
The resolved SDK reference.
NullPointerExceptionIf any of the arguments are null.
SDKNotFoundExceptionIf the SDK cannot be resolved in the current build environment.
saker.sdk.support 0.8.2
Resolves the SDK references for the specified SDK descriptions.

The method will examine the specified SDKDescriptions and create the matching SDKReference instances for them.

This method works similarly to resolveSDKReferences(TaskContext, NavigableMap<String, ? extends SDKDescription>), but doesn't report dependencies.

environmentThe build environment.
sdkdescriptionsThe SDK descriptions.
The resolved SDK references.
NullPointerExceptionIf any of the arguments are null.
SDKNameConflictExceptionIf there are more than one SDKs in the argument map for the same name defined by getSDKNameComparator().
SDKNotFoundExceptionIf an SDK cannot be resolved in the current build environment.
saker.sdk.support 0.8.2
Resolves the SDK references for the specified SDK descriptions.

The method will examine the specified SDKDescriptions and create the matching SDKReference instances for them.

The method will install appropriate dependencies as specified by resolveSDKReference(TaskContext, SDKDescription).

taskcontextThe task context.
sdkdescriptionsThe SDK descriptions.
The resolved SDK references.
NullPointerExceptionIf any of the arguments are null.
SDKNameConflictExceptionIf there are more than one SDKs in the argument map for the same name defined by getSDKNameComparator().
SDKNotFoundExceptionIf an SDK cannot be resolved in the current build environment.
saker.sdk.support 0.8.2