org.gradle.api.GradleScriptException Java Examples

The following examples show how to use org.gradle.api.GradleScriptException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultExceptionAnalyser.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Throwable findDeepestRootException(Throwable exception) {
    // TODO: fix the way we work out which exception is important: TaskExecutionException is not always the most helpful
    Throwable locationAware = null;
    Throwable result = null;
    Throwable contextMatch = null;
    for (Throwable current = exception; current != null; current = current.getCause()) {
        if (current instanceof LocationAwareException) {
            locationAware = current;
        } else if (current instanceof GradleScriptException || current instanceof TaskExecutionException) {
            result = current;
        } else if (contextMatch == null && current.getClass().getAnnotation(Contextual.class) != null) {
            contextMatch = current;
        }
    }
    if (locationAware != null) {
        return locationAware;
    } else if (result != null) {
        return result;
    } else if (contextMatch != null) {
        return contextMatch;
    } else {
        return exception;
    }
}
 
Example #2
Source File: DefaultExceptionAnalyser.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Throwable findDeepestRootException(Throwable exception) {
    // TODO: fix the way we work out which exception is important: TaskExecutionException is not always the most helpful
    Throwable locationAware = null;
    Throwable result = null;
    Throwable contextMatch = null;
    for (Throwable current = exception; current != null; current = current.getCause()) {
        if (current instanceof LocationAwareException) {
            locationAware = current;
        } else if (current instanceof GradleScriptException || current instanceof TaskExecutionException) {
            result = current;
        } else if (contextMatch == null && current.getClass().getAnnotation(Contextual.class) != null) {
            contextMatch = current;
        }
    }
    if (locationAware != null) {
        return locationAware;
    } else if (result != null) {
        return result;
    } else if (contextMatch != null) {
        return contextMatch;
    } else {
        return exception;
    }
}
 
Example #3
Source File: DefaultExceptionAnalyser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Throwable findDeepestRootException(Throwable exception) {
    // TODO: fix the way we work out which exception is important: TaskExecutionException is not always the most helpful
    Throwable locationAware = null;
    Throwable result = null;
    Throwable contextMatch = null;
    for (Throwable current = exception; current != null; current = current.getCause()) {
        if (current instanceof LocationAwareException) {
            locationAware = current;
        } else if (current instanceof GradleScriptException || current instanceof TaskExecutionException) {
            result = current;
        } else if (contextMatch == null && current.getClass().getAnnotation(Contextual.class) != null) {
            contextMatch = current;
        }
    }
    if (locationAware != null) {
        return locationAware;
    } else if (result != null) {
        return result;
    } else if (contextMatch != null) {
        return contextMatch;
    } else {
        return exception;
    }
}
 
Example #4
Source File: DefaultExceptionAnalyser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Throwable findDeepestRootException(Throwable exception) {
    // TODO: fix the way we work out which exception is important: TaskExecutionException is not always the most helpful
    Throwable locationAware = null;
    Throwable result = null;
    Throwable contextMatch = null;
    for (Throwable current = exception; current != null; current = current.getCause()) {
        if (current instanceof LocationAwareException) {
            locationAware = current;
        } else if (current instanceof GradleScriptException || current instanceof TaskExecutionException) {
            result = current;
        } else if (contextMatch == null && current.getClass().getAnnotation(Contextual.class) != null) {
            contextMatch = current;
        }
    }
    if (locationAware != null) {
        return locationAware;
    } else if (result != null) {
        return result;
    } else if (contextMatch != null) {
        return contextMatch;
    } else {
        return exception;
    }
}
 
Example #5
Source File: OrmGenerationTask.java    From mobi with GNU Affero General Public License v3.0 5 votes vote down vote up
@TaskAction
public void perform() {
    // Load the reference ontology data.
    final List<ReferenceOntology> referenceOntologies = gatherReferenceOntologies();
    // Generate each of the generation ontologies.
    for (final Object generate : toGenerate) {
        Ontology ontology = (Ontology) generate;
        final File file = ontology.getOntologyFile();
        // Check that the file exists!
        if (file.isFile()) {
            try {
                // Read the ontology file into our Model.
                final Model model = GraphReadingUtility.readOntology(file,
                        ontology.getOntologyFile().getAbsolutePath());
                // If the destination package already exists, remove the previous version.
                FileUtils.deleteQuietly(new File(outputLocation.getAbsolutePath()
                        + (outputLocation.getAbsolutePath().endsWith(File.separator) ? "" : File.separator)
                        + ontology.getOutputPackage().replace('.', File.separatorChar)));
                // Generate the source in the targeted output package.
                SourceGenerator.toSource(model, ontology.getOutputPackage(), ontology.getOntologyName(),
                        outputLocation.getAbsolutePath(), referenceOntologies);
            } catch (Exception e) {
                // Catch an exception during source generation and throw MojoFailureException.
                throw new GradleScriptException(String.format("Issue generating source from ontology specified: "
                                + "{%s} {%s} {%s}", ontology.getOntologyFile(), ontology.getOutputPackage(),
                        outputLocation), e);
            }
        } else {
            // Throw an exception if that ontology file doesn't exist
            String msg = "Issue generating source from ontology specified. No ontology found at specified location:"
                    + " " + ontology.getOntologyFile();
            throw new GradleException(msg);
        }
    }
}
 
Example #6
Source File: ScriptRunner.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Executes the script.
 *
 * @throws GradleScriptException On execution failure.
 */
void run() throws GradleScriptException;
 
Example #7
Source File: ScriptRunner.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Executes the script.
 *
 * @throws GradleScriptException On execution failure.
 */
void run() throws GradleScriptException;
 
Example #8
Source File: ScriptRunner.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Executes the script.
 *
 * @throws GradleScriptException On execution failure.
 */
void run() throws GradleScriptException;
 
Example #9
Source File: ScriptRunner.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Executes the script.
 *
 * @throws GradleScriptException On execution failure.
 */
void run() throws GradleScriptException;