Search in sources :

Example 1 with ServiceCreationException

use of org.gradle.internal.service.ServiceCreationException in project gradle by gradle.

the class DefaultExceptionAnalyser method collectFailures.

@Override
public void collectFailures(Throwable exception, Collection<? super Throwable> failures) {
    if (exception instanceof ProjectConfigurationException) {
        ProjectConfigurationException projectConfigurationException = (ProjectConfigurationException) exception;
        List<Throwable> additionalFailures = new ArrayList<>();
        for (Throwable cause : projectConfigurationException.getCauses()) {
            // TODO: remove this special case
            if (cause instanceof GradleScriptException) {
                failures.add(transform(cause));
            } else {
                additionalFailures.add(cause);
            }
        }
        if (!additionalFailures.isEmpty()) {
            projectConfigurationException.initCauses(additionalFailures);
            failures.add(transform(projectConfigurationException));
        }
    } else if (exception instanceof ServiceCreationException) {
        failures.add(transform(new InitializationException(exception)));
    } else {
        failures.add(transform(exception));
    }
}
Also used : ServiceCreationException(org.gradle.internal.service.ServiceCreationException) ArrayList(java.util.ArrayList) GradleScriptException(org.gradle.api.GradleScriptException) ProjectConfigurationException(org.gradle.api.ProjectConfigurationException)

Example 2 with ServiceCreationException

use of org.gradle.internal.service.ServiceCreationException in project gradle by gradle.

the class NativeServices method initialize.

/**
 * Initializes the native services to use the given user home directory to store native libs and other resources. Does nothing if already initialized.
 *
 * @param requestedFeatures Whether to initialize additional native libraries like jansi and file-events.
 */
private void initialize(File userHomeDir, EnumSet<NativeFeatures> requestedFeatures) {
    if (!initialized) {
        try {
            initializeNativeIntegrations(userHomeDir);
            initialized = true;
            initializeFeatures(requestedFeatures);
        } catch (RuntimeException e) {
            throw new ServiceCreationException("Could not initialize native services.", e);
        }
    }
}
Also used : ServiceCreationException(org.gradle.internal.service.ServiceCreationException)

Aggregations

ServiceCreationException (org.gradle.internal.service.ServiceCreationException)2 ArrayList (java.util.ArrayList)1 GradleScriptException (org.gradle.api.GradleScriptException)1 ProjectConfigurationException (org.gradle.api.ProjectConfigurationException)1