if (isDebugRunner ^ myDebugBuilder) {
return false;
}
final JpsHaxeModuleSettings moduleSettings = JpsHaxeUtil.getModuleSettings(module);
if (moduleSettings == null) {
context.processMessage(new CompilerMessage(
BUILDER_NAME, BuildMessage.Kind.ERROR, "can't find module settings for " + module.getName())
);
return false;
}
final JpsSdk<JpsHaxeSdkAdditionalData> jpsSdk = module.getSdk(JpsHaxeSdkType.INSTANCE);
if (jpsSdk == null) {
context.processMessage(new CompilerMessage(
BUILDER_NAME, BuildMessage.Kind.ERROR, "can't find module sdk for " + module.getName())
);
return false;
}
context.processMessage(new ProgressMessage(HaxeCommonBundle.message("haxe.module.compilation.progress.message", module.getName())));
boolean compiled = HaxeCommonCompilerUtil.compile(new HaxeCommonCompilerUtil.CompilationContext() {
private String myErrorRoot;
@NotNull
@Override
public HaxeModuleSettingsBase getModuleSettings() {
return moduleSettings;
}
@Override
public String getModuleName() {
return module.getName();
}
@Override
public void errorHandler(String message) {
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, message));
}
@Override
public void log(String message) {
LOG.debug(message);
}
@Override
public boolean isDebug() {
return isDebugRunner;
}
@Override
public String getSdkHomePath() {
return jpsSdk.getHomePath();
}
@Override
public String getHaxelibPath() {
return jpsSdk.getSdkProperties().getHaxelibPath();
}
@Override
public String getSdkName() {
return jpsSdk.getVersionString();
}
@Override
public List<String> getSourceRoots() {
return ContainerUtil.map(module.getSourceRoots(), new Function<JpsModuleSourceRoot, String>() {
@Override
public String fun(JpsModuleSourceRoot root) {
return JpsPathUtil.urlToPath(root.getUrl());
}
});
}
@Override
public String getCompileOutputPath() {
final String outputRootUrl = JpsJavaExtensionService.getInstance().getOutputUrl(module, false);
return JpsPathUtil.urlToPath(outputRootUrl);
}
@Override
public void setErrorRoot(String root) {
myErrorRoot = root;
}
@Override
public String getErrorRoot() {
return (myErrorRoot != null) ? myErrorRoot : getWorkingDirectoryPath();
}
@Override
public void handleOutput(String[] lines) {
/*for (String error : lines) {
final HaxeCompilerError compilerError = HaxeCompilerError.create(StringUtil.notNullize(getErrorRoot()), error);
context.processMessage(new CompilerMessage(
BUILDER_NAME,
BuildMessage.Kind.WARNING,
compilerError != null ? compilerError.getErrorMessage() : error,
compilerError != null ? compilerError.getPath() : null,
-1L, -1L, -1L,
compilerError != null ? (long)compilerError.getLine() : -1L,
compilerError != null ? (long)compilerError.getColumn() : -1L
));
}*/
}
@Override
public String getModuleDirPath() {
return getWorkingDirectoryPath();
}
@Nullable
public String getWorkingDirectoryPath() {
final File baseDirectory = JpsModelSerializationDataService.getBaseDirectory(module);
return baseDirectory != null ? baseDirectory.getPath() : null;
}
});
if (!compiled) {
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, "compilation failed"));
}
return compiled;
}