21 import org.eclipse.core.runtime.IProgressMonitor; |
21 import org.eclipse.core.runtime.IProgressMonitor; |
22 import org.eclipse.jface.preference.IPreferenceStore; |
22 import org.eclipse.jface.preference.IPreferenceStore; |
23 |
23 |
24 //import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; |
24 //import com.nokia.carbide.cdt.builder.BuildArgumentsInfo; |
25 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
25 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
26 import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; |
26 import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; //import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; |
27 //import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; |
|
28 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; |
27 import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; |
29 import com.nokia.s60tools.analyzetool.Activator; |
28 import com.nokia.s60tools.analyzetool.Activator; |
30 import com.nokia.s60tools.analyzetool.global.Constants; |
29 import com.nokia.s60tools.analyzetool.global.Constants; |
31 import com.nokia.s60tools.analyzetool.global.Util; |
30 import com.nokia.s60tools.analyzetool.global.Util; |
32 |
31 |
33 |
|
34 /** |
32 /** |
35 * Class to execute custom post-build actions. |
33 * Class to execute custom post-build actions. |
36 * |
34 * |
37 * @author kihe |
35 * @author kihe |
38 * |
36 * |
39 */ |
37 */ |
40 public class CustomPostBuilder extends AnalyzeToolBuilder { |
38 public class CustomPostBuilder extends AnalyzeToolBuilder { |
41 |
39 |
42 /** Post-builder id. */ |
40 /** Post-builder id. */ |
43 public static final String POST_BUILDER_ID = "com.nokia.s60tools.analyzetool.analyzeToolPostBuilder"; |
41 public static final String POST_BUILDER_ID = "com.nokia.s60tools.analyzetool.analyzeToolPostBuilder"; |
44 |
42 |
45 /** |
43 /** |
46 * Executes AnalyzeTool post actions when user builds projects. |
44 * Executes AnalyzeTool post actions when user builds projects. |
47 * |
45 * |
48 * |
46 * |
49 * @see com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder#build(int, |
47 * @see com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder#build(int, |
50 * java.util.Map, org.eclipse.core.runtime.IProgressMonitor) |
48 * java.util.Map, org.eclipse.core.runtime.IProgressMonitor) |
51 */ |
49 */ |
52 @Override |
50 @Override |
53 @SuppressWarnings("unchecked") |
51 @SuppressWarnings("unchecked") |
59 |
57 |
60 // get project info |
58 // get project info |
61 ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager() |
59 ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager() |
62 .getProjectInfo(project); |
60 .getProjectInfo(project); |
63 |
61 |
64 |
|
65 IPreferenceStore store = Activator.getPreferences(); |
62 IPreferenceStore store = Activator.getPreferences(); |
66 boolean buildCanceled = store.getBoolean(Constants.PREFS_BUILD_CANCELLED); |
63 boolean buildCanceled = store |
|
64 .getBoolean(Constants.PREFS_BUILD_CANCELLED); |
67 // if the AnalyzeTool is canceled |
65 // if the AnalyzeTool is canceled |
68 if (buildCanceled) { |
66 if (buildCanceled) { |
69 getCarbideCommandLauncher().writeToConsole( |
67 getCarbideCommandLauncher().writeToConsole( |
70 Constants.BUILD_CANCELLED); |
68 Constants.BUILD_CANCELLED); |
71 buildCanceled = false; |
69 buildCanceled = false; |
77 super.forgetLastBuiltState(); |
75 super.forgetLastBuiltState(); |
78 runPostSteps(cpi); |
76 runPostSteps(cpi); |
79 return null; |
77 return null; |
80 } |
78 } |
81 |
79 |
82 |
80 // execute atool.exe |
83 //execute atool.exe |
|
84 if (CarbideCPPBuilder.projectHasBuildErrors(cpi.getProject())) { |
81 if (CarbideCPPBuilder.projectHasBuildErrors(cpi.getProject())) { |
85 runUninstrument(Constants.ATOOL_UNINST_FAILED,cpi, monitor); |
82 runUninstrument(Constants.ATOOL_UNINST_FAILED, cpi, monitor); |
86 } else { |
83 } else { |
87 runUninstrument(Constants.ATOOL_UNINST,cpi, monitor); |
84 runUninstrument(Constants.ATOOL_UNINST, cpi, monitor); |
88 } |
85 } |
89 |
|
90 |
|
91 monitor.worked(1); |
86 monitor.worked(1); |
92 |
|
93 runPostSteps(cpi); |
87 runPostSteps(cpi); |
94 |
88 |
95 return new IProject[0]; |
89 return new IProject[0]; |
96 } |
90 } |
97 |
91 |
98 |
|
99 @Override |
92 @Override |
100 protected void clean(final IProgressMonitor arg0){ |
93 protected void clean(final IProgressMonitor arg0) { |
101 // DO nothing by design |
94 // DO nothing by design |
102 } |
95 } |
103 } |
96 } |