Changeset ebe332a in rtems-eclipse-plug-in
- Timestamp:
- 02/06/09 14:21:18 (15 years ago)
- Branches:
- master
- Children:
- b9a8b46
- Parents:
- c9fa789
- Location:
- org.rtems.cdt/src/org/rtems/cdt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
org.rtems.cdt/src/org/rtems/cdt/Constants.java
rc9fa789 rebe332a 94 94 public static final String TOOL_OPTIONS_LINKER_CPP_KEY = TOOL_LINKER_CPP_KEY + TOOL_OPTIONS_KEY_POSTFIX; 95 95 96 public static final String MARKER_ID_TOOL_DISCOVERY = "tool discovery"; 97 96 98 private static String getPathVariableName() { 97 99 Map<String, String> env = System.getenv(); -
org.rtems.cdt/src/org/rtems/cdt/Storage.java
rc9fa789 rebe332a 39 39 import org.eclipse.cdt.managedbuilder.core.IConfiguration; 40 40 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; 41 import org.eclipse.core.resources.IMarker; 41 42 import org.eclipse.core.resources.IProject; 43 import org.eclipse.core.resources.IResource; 42 44 import org.eclipse.core.runtime.CoreException; 43 45 import org.eclipse.core.runtime.IPath; … … 199 201 String bspPath = getProperty( project, Constants.BSP_PATH_KEY); 200 202 IPath make = new Path( "make"); 201 203 List<String> options = new LinkedList<String>(); 204 205 // Set tools to default values 206 updateTool( project, Constants.TOOL_ARCHIVER_KEY, "ar", options); 207 updateTool( project, Constants.TOOL_ASSEMBLER_KEY, "as", options); 208 updateTool( project, Constants.TOOL_COMPILER_CPP_KEY, "g++", options); 209 updateTool( project, Constants.TOOL_COMPILER_C_KEY, "gcc", options); 210 updateTool( project, Constants.TOOL_LINKER_CPP_KEY, "g++", options); 211 updateTool( project, Constants.TOOL_LINKER_C_KEY, "gcc", options); 212 213 // Delete markers for this unit 214 deleteMarkers( project, Constants.MARKER_ID_TOOL_DISCOVERY); 215 202 216 // Translate path if necessary 203 217 if (Platform.getOS().equals( Platform.OS_WIN32)) { … … 252 266 String key = null; 253 267 String command = null; 254 List<String> options = new LinkedList<String>();255 268 int state = EXPECT_KEY; 256 269 while (line != null) { … … 269 282 state = EXPECT_OPTION; 270 283 } else { 271 throw new IOException( " Unexpected line format");284 throw new IOException( "unexpected line format"); 272 285 } 273 286 break; … … 277 290 state = EXPECT_COMMAND; 278 291 } else { 279 throw new IOException( " Unexpected line format");292 throw new IOException( "unexpected line format"); 280 293 } 281 294 break; 282 295 case TOOL_COMPLETE: 283 updateTool( project, key, command, options);296 updateTool( project, key, command, options); 284 297 options.clear(); 285 298 state = EXPECT_KEY; 286 299 continue; 287 300 default: 288 throw new IOException( " Unexpected state");301 throw new IOException( "unexpected state"); 289 302 } 290 303 line = br.readLine(); … … 294 307 } 295 308 } catch (IOException e) { 296 e.printStackTrace(); 309 createMarker( 310 project, 311 Constants.MARKER_ID_TOOL_DISCOVERY, 312 "make output parse error: " + e.getMessage() 313 ); 297 314 } finally { 298 315 while (true) { … … 305 322 } 306 323 } 324 325 // Check exit status 326 if (p.exitValue() != 0) { 327 createMarker( 328 project, 329 Constants.MARKER_ID_TOOL_DISCOVERY, 330 "make invokation `" + make.toOSString() + "' returned with error status " + p.exitValue() 331 ); 332 } 307 333 } 308 334 … … 313 339 if (toolKey.startsWith( Constants.COMPILER_KEY_PREFIX) || toolKey.startsWith( Constants.LINKER_KEY_PREFIX)) { 314 340 for (String option : options) { 315 if (!(option.length() ==0 || option.trim().matches( "^-c|-O[0123s]|-g|-W[\\w-]*$"))) {341 if (!(option.length() == 0 || option.trim().matches( "^-c|-O[0123s]|-g|-W[\\w-]*$"))) { 316 342 filteredOptions.add( option); 317 343 } … … 341 367 return optionsValue.split( OPTION_SEPARATOR); 342 368 } 369 370 public static void createMarker( IProject project, String id, String message) { 371 createMarker( project, id, message, IMarker.SEVERITY_ERROR); 372 } 373 public static void createMarker( IProject project, String id, String message, int severity) { 374 try { 375 IMarker marker = project.createMarker( IMarker.PROBLEM); 376 marker.setAttribute( IMarker.LOCATION, id); 377 marker.setAttribute( IMarker.MESSAGE, message); 378 marker.setAttribute( IMarker.SEVERITY, severity); 379 } catch (CoreException e) { 380 e.printStackTrace(); 381 } 382 383 } 384 385 public static void deleteMarkers( IProject project, String id) { 386 try { 387 IMarker[] markers = project.findMarkers( IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); 388 if (markers != null) { 389 for (IMarker m : markers) { 390 if (m.getResource().equals( project) && m.getAttribute( IMarker.LOCATION, "").equals( id)) { 391 m.delete(); 392 } 393 } 394 } 395 } catch (CoreException e) { 396 e.printStackTrace(); 397 } 398 399 } 343 400 344 401 private Storage() {
Note: See TracChangeset
for help on using the changeset viewer.