use of org.elixir_lang.jps.model.ElixirCompilerOptions in project intellij-elixir by KronicDeth.
the class MixBuilder method build.
@Override
public void build(@NotNull ElixirTarget target, @NotNull DirtyFilesHolder<ElixirSourceRootDescriptor, ElixirTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException {
if (!holder.hasDirtyFiles() && !holder.hasRemovedFiles())
return;
JpsModule module = target.getModule();
JpsProject project = module.getProject();
ElixirCompilerOptions compilerOptions = JpsElixirCompilerOptionsExtension.getOrCreateExtension(project).getOptions();
if (!compilerOptions.myUseMixCompiler)
return;
String mixPath = getMixExecutablePath(project);
if (mixPath == null) {
String errorMessage = "Mix path is not set.";
context.processMessage(new CompilerMessage(NAME, BuildMessage.Kind.ERROR, errorMessage));
throw new ProjectBuildException(errorMessage);
}
JpsSdk<JpsDummyElement> sdk = ElixirTargetBuilderUtil.getSdk(context, module);
String elixirPath = JpsElixirSdkType.getScriptInterpreterExecutable(sdk.getHomePath()).getAbsolutePath();
for (String contentRootUrl : module.getContentRootsList().getUrls()) {
String contentRootPath = new URL(contentRootUrl).getPath();
File contentRootDir = new File(contentRootPath);
File mixConfigFile = new File(contentRootDir, MIX_CONFIG_FILE_NAME);
if (!mixConfigFile.exists())
continue;
runMix(elixirPath, mixPath, contentRootPath, compilerOptions.myAttachDebugInfoEnabled, context);
}
}
use of org.elixir_lang.jps.model.ElixirCompilerOptions 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);
}
}
}
Aggregations