Package org.gradle.tooling

Examples of org.gradle.tooling.BuildCancelledException


            handler.onFailure(new UnsupportedOperationConfigurationException(connectionFailureMessage(failure)
                    + "\n" + failure.getMessage(), failure.getCause()));
        } else if (failure instanceof GradleConnectionException) {
            handler.onFailure((GradleConnectionException) failure);
        } else if (failure instanceof InternalBuildCancelledException) {
            handler.onFailure(new BuildCancelledException(connectionFailureMessage(failure), failure.getCause()));
        } else if (failure instanceof BuildExceptionVersion1) {
            handler.onFailure(new BuildException(connectionFailureMessage(failure), failure.getCause()));
        } else {
            handler.onFailure(new GradleConnectionException(connectionFailureMessage(failure), failure));
        }
View Full Code Here


                            Install install = new Install(new ProgressReportingDownload(progressLoggerFactory), new PathAssembler(realUserHomeDir));
                            installDir = install.createDist(wrapperConfiguration);
                        } catch (FileNotFoundException e) {
                            throw new IllegalArgumentException(String.format("The specified %s does not exist.", getDisplayName()), e);
                        } catch (CancellationException e) {
                            throw new BuildCancelledException(String.format("Distribution download cancelled. Using distribution from '%s'.", wrapperConfiguration.getDistribution()), e);
                        } catch (Exception e) {
                            throw new GradleConnectionException(String.format("Could not install Gradle distribution from '%s'.", wrapperConfiguration.getDistribution()), e);
                        }
                        return installDir;
                    }
                };
                File installDir;
                ExecutorService executor = null;
                try {
                    executor = executorFactory.create();
                    final Future<File> installDirFuture = executor.submit(installDistroTask);
                    cancellationToken.addCallback(new Runnable() {
                        public void run() {
                            // TODO(radim): better to close the connection too to allow quick finish of the task
                            installDirFuture.cancel(true);
                        }
                    });
                    installDir = installDirFuture.get();
                } catch (CancellationException e) {
                    throw new BuildCancelledException(String.format("Distribution download cancelled. Using distribution from '%s'.", wrapperConfiguration.getDistribution()), e);
                } catch (InterruptedException e) {
                    throw new GradleConnectionException(String.format("Could not install Gradle distribution from '%s'.", wrapperConfiguration.getDistribution()), e);
                } catch (ExecutionException e) {
                    if (e.getCause() != null) {
                        UncheckedException.throwAsUncheckedException(e.getCause());
View Full Code Here

    public <T> T run(ConsumerAction<T> action) throws UnsupportedOperationException, IllegalStateException {
        try {
            BuildCancellationToken cancellationToken = action.getParameters().getCancellationToken();
            if (cancellationToken.isCancellationRequested()) {
                throw new BuildCancelledException("Build cancelled");
            }
            ConsumerConnection connection = onStartAction(cancellationToken);
            return action.run(connection);
        } finally {
            onEndAction();
View Full Code Here

TOP

Related Classes of org.gradle.tooling.BuildCancelledException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.