Java Code Examples for org.gradle.util.GFileUtils#deleteDirectory()

The following examples show how to use org.gradle.util.GFileUtils#deleteDirectory() . 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: DefaultScriptCompilationHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void compileToDir(ScriptSource source, ClassLoader classLoader, File classesDir,
                         Transformer transformer, Class<? extends Script> scriptBaseClass, Verifier verifier) {
    Clock clock = new Clock();
    GFileUtils.deleteDirectory(classesDir);
    GFileUtils.mkdirs(classesDir);
    CompilerConfiguration configuration = createBaseCompilerConfiguration(scriptBaseClass);
    configuration.setTargetDirectory(classesDir);
    try {
        compileScript(source, classLoader, configuration, classesDir, transformer, verifier);
    } catch (GradleException e) {
        GFileUtils.deleteDirectory(classesDir);
        throw e;
    }

    logger.debug("Timing: Writing script to cache at {} took: {}", classesDir.getAbsolutePath(),
            clock.getTime());
}
 
Example 2
Source File: DefaultScriptCompilationHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void compileToDir(ScriptSource source, ClassLoader classLoader, File classesDir,
                         Transformer transformer, Class<? extends Script> scriptBaseClass) {
    Clock clock = new Clock();
    GFileUtils.deleteDirectory(classesDir);
    GFileUtils.mkdirs(classesDir);
    CompilerConfiguration configuration = createBaseCompilerConfiguration(scriptBaseClass);
    configuration.setTargetDirectory(classesDir);
    try {
        compileScript(source, classLoader, configuration, classesDir, transformer);
    } catch (GradleException e) {
        GFileUtils.deleteDirectory(classesDir);
        throw e;
    }

    logger.debug("Timing: Writing script to cache at {} took: {}", classesDir.getAbsolutePath(),
            clock.getTime());
}
 
Example 3
Source File: DefaultScriptCompilationHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void compileToDir(ScriptSource source, ClassLoader classLoader, File classesDir,
                         Transformer transformer, Class<? extends Script> scriptBaseClass, Verifier verifier) {
    Clock clock = new Clock();
    GFileUtils.deleteDirectory(classesDir);
    GFileUtils.mkdirs(classesDir);
    CompilerConfiguration configuration = createBaseCompilerConfiguration(scriptBaseClass);
    configuration.setTargetDirectory(classesDir);
    try {
        compileScript(source, classLoader, configuration, classesDir, transformer, verifier);
    } catch (GradleException e) {
        GFileUtils.deleteDirectory(classesDir);
        throw e;
    }

    logger.debug("Timing: Writing script to cache at {} took: {}", classesDir.getAbsolutePath(),
            clock.getTime());
}
 
Example 4
Source File: DefaultScriptCompilationHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void compileToDir(ScriptSource source, ClassLoader classLoader, File classesDir,
                         Transformer transformer, Class<? extends Script> scriptBaseClass) {
    Clock clock = new Clock();
    GFileUtils.deleteDirectory(classesDir);
    GFileUtils.mkdirs(classesDir);
    CompilerConfiguration configuration = createBaseCompilerConfiguration(scriptBaseClass);
    configuration.setTargetDirectory(classesDir);
    try {
        compileScript(source, classLoader, configuration, classesDir, transformer);
    } catch (GradleException e) {
        GFileUtils.deleteDirectory(classesDir);
        throw e;
    }

    logger.debug("Timing: Writing script to cache at {} took: {}", classesDir.getAbsolutePath(),
            clock.getTime());
}
 
Example 5
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void maybeDelete(FileVisitDetails fileDetails, boolean isDir) {
    RelativePath path = fileDetails.getRelativePath();
    if (!visited.contains(path)) {
        if (isDir) {
            GFileUtils.deleteDirectory(fileDetails.getFile());
        } else {
            GFileUtils.deleteQuietly(fileDetails.getFile());
        }
        didWork = true;
    }
}
 
Example 6
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void maybeDelete(FileVisitDetails fileDetails, boolean isDir) {
    RelativePath path = fileDetails.getRelativePath();
    if (!visited.contains(path)) {
        if (isDir) {
            GFileUtils.deleteDirectory(fileDetails.getFile());
        } else {
            GFileUtils.deleteQuietly(fileDetails.getFile());
        }
        didWork = true;
    }
}
 
Example 7
Source File: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void maybeDelete(FileVisitDetails fileDetails, boolean isDir) {
    RelativePath path = fileDetails.getRelativePath();
    if (!visited.contains(path)) {
        if (isDir) {
            GFileUtils.deleteDirectory(fileDetails.getFile());
        } else {
            GFileUtils.deleteQuietly(fileDetails.getFile());
        }
        didWork = true;
    }
}
 
Example 8
Source File: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void maybeDelete(FileVisitDetails fileDetails, boolean isDir) {
    RelativePath path = fileDetails.getRelativePath();
    if (!visited.contains(path)) {
        if (isDir) {
            GFileUtils.deleteDirectory(fileDetails.getFile());
        } else {
            GFileUtils.deleteQuietly(fileDetails.getFile());
        }
        didWork = true;
    }
}
 
Example 9
Source File: UnMockTaskTest.java    From unmock-plugin with Apache License 2.0 3 votes vote down vote up
@Test
public void unMockTaskIsNotUpToDateIfOutputDirectoryIsDeleted() {
    BuildResult firstResult = newGradleRunner().build();

    assertSame(firstResult.task(":unMock").getOutcome(), TaskOutcome.SUCCESS);

    GFileUtils.deleteDirectory(new File(testProjectDir.getRoot(), "build/intermediates/unmock_work"));

    BuildResult secondResult = newGradleRunner().build();

    assertSame(secondResult.task(":unMock").getOutcome(), TaskOutcome.SUCCESS);
}
 
Example 10
Source File: UnMockTaskTest.java    From unmock-plugin with Apache License 2.0 3 votes vote down vote up
@Test
public void unMockTaskIsLoadedFromCacheWhenUsingBuildCache() {
    BuildResult firstResult = newGradleRunner().withArguments("--build-cache", "unMock").build();

    assertSame(firstResult.task(":unMock").getOutcome(), TaskOutcome.SUCCESS);

    GFileUtils.deleteDirectory(new File(testProjectDir.getRoot(), "build"));

    BuildResult secondResult = newGradleRunner().withArguments("--build-cache", "unMock").build();

    assertSame(secondResult.task(":unMock").getOutcome(), TaskOutcome.FROM_CACHE);
}