mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
external build: report problematic file when JPS model cannot be loaded (IDEA-96471, ZD-48285)
This commit is contained in:
@@ -39,6 +39,7 @@ import org.jetbrains.jps.incremental.fs.BuildFSState;
|
||||
import org.jetbrains.jps.incremental.messages.*;
|
||||
import org.jetbrains.jps.incremental.storage.Timestamps;
|
||||
import org.jetbrains.jps.model.module.JpsModule;
|
||||
import org.jetbrains.jps.model.serialization.CannotLoadJpsModelException;
|
||||
import org.jetbrains.jps.service.SharedThreadPool;
|
||||
|
||||
import java.io.*;
|
||||
@@ -565,7 +566,13 @@ final class BuildSession implements Runnable, CanceledStatus {
|
||||
private void finishBuild(Throwable error, boolean hadBuildErrors, boolean doneSomething) {
|
||||
CmdlineRemoteProto.Message lastMessage = null;
|
||||
try {
|
||||
if (error != null) {
|
||||
if (error instanceof CannotLoadJpsModelException) {
|
||||
String text = "Failed to load project configuration: " + StringUtil.decapitalize(error.getMessage());
|
||||
String path = ((CannotLoadJpsModelException)error).getFile().getAbsolutePath();
|
||||
lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createCompileMessage(BuildMessage.Kind.ERROR, text, path,
|
||||
-1, -1, -1, -1, -1, -1.0f));
|
||||
}
|
||||
else if (error != null) {
|
||||
Throwable cause = error.getCause();
|
||||
if (cause == null) {
|
||||
cause = error;
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.jps.model.serialization;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class CannotLoadJpsModelException extends RuntimeException {
|
||||
@NotNull private final File myFile;
|
||||
|
||||
public CannotLoadJpsModelException(@NotNull File file, @NotNull String message, @Nullable Throwable cause) {
|
||||
super(message, cause);
|
||||
myFile = file;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public File getFile() {
|
||||
return myFile;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -74,10 +74,10 @@ public abstract class JpsLoaderBase {
|
||||
return element;
|
||||
}
|
||||
catch (JDOMException e) {
|
||||
throw new RuntimeException("Cannot parse xml file " + file.getAbsolutePath() + ": " + e.getMessage(), e);
|
||||
throw new CannotLoadJpsModelException(file, "Cannot parse xml file " + file.getAbsolutePath() + ": " + e.getMessage(), e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException("Cannot read file " + file.getAbsolutePath() + ": " + e.getMessage(), e);
|
||||
throw new CannotLoadJpsModelException(file, "Cannot read file " + file.getAbsolutePath() + ": " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user