RT: remove exception on eclipse Build
authorgyeongmin.ju <gyeongmin.ju@samsung.com>
Mon, 16 Oct 2017 08:31:41 +0000 (17:31 +0900)
committer박대룡/개발플랫폼팀/L4/ <bdragon.park@samsung.com>
Tue, 17 Oct 2017 01:39:56 +0000 (10:39 +0900)
Signed-off-by: gyeongmin.ju <gyeongmin.ju@samsung.com>
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/build/builder/RtBuilder.java
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/AbstractCommand.java
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/BuildCommand.java
rt-ide/tizen.rt.product.plugin/src/org/tizen/rt/ide/commands/Command.java

index ae7c105..fb950bf 100644 (file)
@@ -39,6 +39,7 @@ import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.dialogs.MessageDialogWithToggle;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -66,6 +67,7 @@ public class RtBuilder extends IncrementalProjectBuilder {
     private final Logger logger = LoggerFactory.getLogger(RtBuilder.class);
 
     public RtBuilder() {
+        forgetLastBuiltState();
     }
 
     @Override
@@ -78,7 +80,12 @@ public class RtBuilder extends IncrementalProjectBuilder {
         switch (kind) {
         case FULL_BUILD:
             BuildCommand buildCommand = new BuildCommand();
-            result = buildCommand.execute(project, consoleManager, monitor);
+            if (buildCommand.isEnable(project)) {
+                result = buildCommand.execute(project, consoleManager, monitor);
+            } else {
+                consoleManager.println(Messages.CommandMessage_KconfigError);
+                result = 1;
+            }
             break;
         }
 
@@ -110,10 +117,10 @@ public class RtBuilder extends IncrementalProjectBuilder {
         if (useDistClean) {
             cleanCommand.setProperty("distclean", "true");
         }
-        
+
         cleanCommand.execute(project, consoleManager, monitor);
     }
-    
+
     public static void addBuilderToProject(IProject fProject) throws CoreException {
         IProjectDescription desc = fProject.getDescription();
         ICommand[] commands = desc.getBuildSpec();
index 61a5546..4b1c582 100644 (file)
@@ -30,6 +30,8 @@ package org.tizen.rt.ide.commands;
 
 import java.util.Properties;
 
+import org.eclipse.core.resources.IProject;
+
 /**
  * @author Gyeongmin Ju{@literal <gyeongmin.ju>} (S-Core)
  */
@@ -37,7 +39,7 @@ public abstract class AbstractCommand implements Command {
     protected Properties properties;
 
     @Override
-    public boolean isEnable() {
+    public boolean isEnable(IProject project) {
         return true;
     }
     
index f5cf02c..d21ee47 100644 (file)
@@ -70,9 +70,17 @@ public class BuildCommand extends AbstractCommand {
     }
 
     protected String getSettingFileName() {
-        return FILENAME_BUILD_SETTING; // $NON-NLS-1$
+        return FILENAME_BUILD_SETTING;
     }
 
+    @Override
+    public boolean isEnable(IProject project) {
+        String activeProjectPath = project.getLocation().toString();
+        String osDir = activeProjectPath + File.separator + "os"; //$NON-NLS-1$
+
+        return new File(osDir, FILENAME_CONFIG).exists();
+    }
+    
     private static int doBuilding(String projectPath, String scriptFileName, String settingFileName, 
             ConsoleManager consoleManager, Logger logger) {
         String osDir = projectPath + File.separator + "os"; //$NON-NLS-1$
@@ -136,14 +144,12 @@ public class BuildCommand extends AbstractCommand {
     
     @Override
     public int execute(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor) {
-        String activeProjectPath = project.getLocation().toString();
-        String osDir = project.getLocation().toString() + File.separator + "os"; //$NON-NLS-1$
-
-        if (!new File(osDir, FILENAME_CONFIG).exists()) { // $NON-NLS-1$
+        if (!isEnable(project)) {
             MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", Messages.CommandMessage_KconfigError); //$NON-NLS-1$
             return 1;
         }
         
+        String activeProjectPath = project.getLocation().toString();
         BuildCommand.doBuilding(activeProjectPath, getScriptFileName(), getSettingFileName(), consoleManager, logger);
         
         return 0;
index c9c14f1..aa4cda6 100644 (file)
@@ -37,12 +37,12 @@ import org.tizen.rt.ide.console.ConsoleManager;
  */
 public interface Command {
     
-    public boolean isEnable();
-    
     public void setProperty(String key, String value);
     
     public String getProperty(String key);
 
+    public boolean isEnable(IProject project);
+    
     public int execute(IProject project, ConsoleManager consoleManager, IProgressMonitor monitor);
     
 }