/// <summary> /// Get the first build artifact value that is assignable to specified type, or create and set it if not found. /// Multiple build artifact value can be stored per build configuration. /// </summary> /// <param name="buildArtifactType">The build artifact type.</param> /// <returns>The build artifact value.</returns> public IBuildArtifact GetOrCreateBuildArtifact(Type buildArtifactType) { BuildArtifacts.ValidateBuildArtifactTypeAndThrow(buildArtifactType); var artifact = GetBuildArtifact(buildArtifactType); if (artifact == null) { artifact = TypeConstruction.Construct <IBuildArtifact>(buildArtifactType); SetBuildArtifact(artifact); } return(artifact); }
/// <summary> /// Determine if a build artifact that is assignable to the specified type is present. /// </summary> /// <param name="buildArtifactType">The build artifact type.</param> /// <returns><see langword="true"/> if a matching build artifact is found, <see langword="false"/> otherwise.</returns> public override bool HasBuildArtifact(Type buildArtifactType) { BuildArtifacts.ValidateBuildArtifactTypeAndThrow(buildArtifactType); return(m_Artifacts.Any(a => buildArtifactType.IsAssignableFrom(a.GetType()))); }
/// <summary> /// Get the first build artifact value that is assignable to specified type. /// Multiple build artifact value can be stored per build configuration. /// </summary> /// <param name="buildArtifactType">The build artifact type.</param> /// <returns>A build artifact value if found, <see langword="null"/> otherwise.</returns> public override IBuildArtifact GetBuildArtifact(Type buildArtifactType) { BuildArtifacts.ValidateBuildArtifactTypeAndThrow(buildArtifactType); return(m_Artifacts.FirstOrDefault(a => buildArtifactType.IsAssignableFrom(a.GetType()))); }
/// <summary> /// Remove all build artifact that is assignable to specified type. /// </summary> /// <param name="buildArtifactType">The build artifact type.</param> /// <returns><see langword="true"/> if one of more artifact was removed, <see langword="false"/> otherwise.</returns> public bool RemoveBuildArtifact(Type buildArtifactType) { BuildArtifacts.ValidateBuildArtifactTypeAndThrow(buildArtifactType); return(m_Artifacts.RemoveAll(a => buildArtifactType.IsAssignableFrom(a.GetType())) > 0); }