Search in sources :

Example 1 with DirectoryCleaner

use of org.eclipse.emf.mwe.utils.DirectoryCleaner in project xtext-core by eclipse.

the class XtextDirectoryCleaner method clean.

public void clean() {
    if ((!this.enabled)) {
        return;
    }
    final ArrayList<String> directories = CollectionLiterals.<String>newArrayList();
    final Function1<ISubProjectConfig, IXtextGeneratorFileSystemAccess> _function = (ISubProjectConfig it) -> {
        return it.getSrcGen();
    };
    List<IXtextGeneratorFileSystemAccess> _map = ListExtensions.map(this.config.getEnabledProjects(), _function);
    IXtextGeneratorFileSystemAccess _ecoreModel = this.config.getRuntime().getEcoreModel();
    final Function1<IXtextGeneratorFileSystemAccess, String> _function_1 = (IXtextGeneratorFileSystemAccess it) -> {
        return it.getPath();
    };
    final Function1<String, Boolean> _function_2 = (String it) -> {
        return Boolean.valueOf(new File(it).isDirectory());
    };
    Iterable<String> _filter = IterableExtensions.<String>filter(IterableExtensions.<IXtextGeneratorFileSystemAccess, String>map(IterableExtensions.<IXtextGeneratorFileSystemAccess>filterNull(Iterables.<IXtextGeneratorFileSystemAccess>concat(_map, Collections.<IXtextGeneratorFileSystemAccess>unmodifiableList(CollectionLiterals.<IXtextGeneratorFileSystemAccess>newArrayList(_ecoreModel)))), _function_1), _function_2);
    Iterables.<String>addAll(directories, _filter);
    Iterables.<String>addAll(directories, this.extraDirectories);
    final DirectoryCleaner delegate = new DirectoryCleaner();
    delegate.setUseDefaultExcludes(this.useDefaultExcludes);
    final Consumer<String> _function_3 = (String it) -> {
        delegate.addExclude(it);
    };
    this.excludes.forEach(_function_3);
    final Consumer<String> _function_4 = (String it) -> {
        try {
            delegate.cleanFolder(it);
        } catch (Throwable _e) {
            throw Exceptions.sneakyThrow(_e);
        }
    };
    directories.forEach(_function_4);
}
Also used : ISubProjectConfig(org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig) IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess) DirectoryCleaner(org.eclipse.emf.mwe.utils.DirectoryCleaner) File(java.io.File)

Aggregations

File (java.io.File)1 DirectoryCleaner (org.eclipse.emf.mwe.utils.DirectoryCleaner)1 IXtextGeneratorFileSystemAccess (org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)1 ISubProjectConfig (org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig)1