Search in sources :

Example 16 with JpsProject

use of org.jetbrains.jps.model.JpsProject in project intellij-community by JetBrains.

the class ResourceRootDescriptor method createFileFilter.

@NotNull
@Override
public FileFilter createFileFilter() {
    final JpsProject project = getTarget().getModule().getProject();
    final JpsCompilerExcludes excludes = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project).getCompilerExcludes();
    return file -> !excludes.isExcluded(file);
}
Also used : JpsProject(org.jetbrains.jps.model.JpsProject) JpsCompilerExcludes(org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes) FileFilter(java.io.FileFilter) ResourcesTarget(org.jetbrains.jps.incremental.ResourcesTarget) Set(java.util.Set) BuildRootDescriptor(org.jetbrains.jps.builders.BuildRootDescriptor) FileUtil(com.intellij.openapi.util.io.FileUtil) JpsJavaExtensionService(org.jetbrains.jps.model.java.JpsJavaExtensionService) NotNull(org.jetbrains.annotations.NotNull) File(java.io.File) JpsCompilerExcludes(org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes) JpsProject(org.jetbrains.jps.model.JpsProject) NotNull(org.jetbrains.annotations.NotNull)

Example 17 with JpsProject

use of org.jetbrains.jps.model.JpsProject in project intellij-elixir by KronicDeth.

the class ElixirBuilder method build.

@Override
public void build(@NotNull ElixirTarget target, @NotNull DirtyFilesHolder<ElixirSourceRootDescriptor, ElixirTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException {
    LOG.info(target.getPresentableName());
    final Set<File> filesToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
    holder.processDirtyFiles(new FileProcessor<ElixirSourceRootDescriptor, ElixirTarget>() {

        @Override
        public boolean apply(ElixirTarget target, File file, ElixirSourceRootDescriptor root) throws IOException {
            boolean isAcceptFile = target.isTests() ? ELIXIR_TEST_SOURCE_FILTER.accept(file) : ELIXIR_SOURCE_FILTER.accept(file);
            if (isAcceptFile && ourCompilableModuleTypes.contains(target.getModule().getModuleType())) {
                filesToCompile.add(file);
            }
            return true;
        }
    });
    if (filesToCompile.isEmpty() && !holder.hasRemovedFiles())
        return;
    JpsModule module = target.getModule();
    JpsProject project = module.getProject();
    ElixirCompilerOptions compilerOptions = JpsElixirCompilerOptionsExtension.getOrCreateExtension(project).getOptions();
    if (compilerOptions.myUseMixCompiler) {
        doBuildWithMix(target, context, module, compilerOptions);
    } else {
        // elixirc can not compile tests now.
        if (!target.isTests()) {
            doBuildWithElixirc(target, context, module, compilerOptions, filesToCompile);
        }
    }
}
Also used : JpsProject(org.jetbrains.jps.model.JpsProject) IOException(java.io.IOException) ElixirCompilerOptions(org.elixir_lang.jps.model.ElixirCompilerOptions) File(java.io.File) THashSet(gnu.trove.THashSet)

Aggregations

JpsProject (org.jetbrains.jps.model.JpsProject)17 File (java.io.File)8 IOException (java.io.IOException)4 NotNull (org.jetbrains.annotations.NotNull)4 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)4 JpsModule (org.jetbrains.jps.model.module.JpsModule)4 THashSet (gnu.trove.THashSet)3 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)3 JpsJavaExtensionService (org.jetbrains.jps.model.java.JpsJavaExtensionService)3 JpsCompilerExcludes (org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes)3 JpsJavaCompilerConfiguration (org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration)3 THashMap (gnu.trove.THashMap)2 FileFilter (java.io.FileFilter)2 ArrayList (java.util.ArrayList)2 Set (java.util.Set)2 ElixirCompilerOptions (org.elixir_lang.jps.model.ElixirCompilerOptions)2 ProjectBuildException (org.jetbrains.jps.incremental.ProjectBuildException)2 ResourcesTarget (org.jetbrains.jps.incremental.ResourcesTarget)2 OneToManyPathsMapping (org.jetbrains.jps.incremental.storage.OneToManyPathsMapping)2 JpsDummyElement (org.jetbrains.jps.model.JpsDummyElement)2