public BuildRequestConfiguration GetMatchingConfiguration(BuildRequestConfiguration config) { var overrideConfig = _override.GetMatchingConfiguration(config); if (overrideConfig != null) { #if DEBUG ErrorUtilities.VerifyThrow(CurrentCache.GetMatchingConfiguration(config) == null, "caches should not overlap"); #endif return(overrideConfig); } else { return(CurrentCache.GetMatchingConfiguration(config)); } }
/// <summary> /// Adds a new definition to the cache. Returns the key associated with this definition so that it can be /// used as the configuration id also. /// </summary> public int AddDefinition(RequestDefinition definition) { int newKey; if (_configurationCache.GetMatchingConfiguration(definition.UnresolvedConfiguration) != null) { throw new InvalidOperationException("Multiple request definition with the same configuration cannot be added"); } else { lock (_definitions) { newKey = _key++; _definitions.Add(newKey, definition); } } return(newKey); }
private void NewBuildRequestsCallback(BuildRequestEntry entry, FullyQualifiedBuildRequest[] requests) { _newBuildRequests_FQRequests = requests; _newBuildRequests_BuildRequests = new BuildRequest[requests.Length]; _newBuildRequests_Entry = entry; int index = 0; foreach (FullyQualifiedBuildRequest request in requests) { IConfigCache configCache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache); BuildRequestConfiguration matchingConfig = configCache.GetMatchingConfiguration(request.Config); BuildRequest newRequest = CreateNewBuildRequest(matchingConfig.ConfigurationId, request.Targets); entry.WaitForResult(newRequest); _newBuildRequests_BuildRequests[index++] = newRequest; } _newBuildRequestsEvent.Set(); }