1 | /* |
---|
2 | * Copyright (c) 2008 |
---|
3 | * Embedded Brains GmbH |
---|
4 | * Obere Lagerstr. 30 |
---|
5 | * D-82178 Puchheim |
---|
6 | * Germany |
---|
7 | * rtems@embedded-brains.de |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be found in the file |
---|
10 | * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. |
---|
11 | */ |
---|
12 | |
---|
13 | package org.rtems.cdt; |
---|
14 | |
---|
15 | import java.util.Map; |
---|
16 | import org.eclipse.core.resources.IProject; |
---|
17 | import org.eclipse.core.runtime.CoreException; |
---|
18 | import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext; |
---|
19 | import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set; |
---|
20 | import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager; |
---|
21 | import org.eclipse.cdt.core.model.CoreModel; |
---|
22 | import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; |
---|
23 | import org.eclipse.cdt.core.settings.model.ICProjectDescription; |
---|
24 | import org.eclipse.cdt.make.core.MakeCorePlugin; |
---|
25 | import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2; |
---|
26 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; |
---|
27 | import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; |
---|
28 | |
---|
29 | public class PropertyExpander { |
---|
30 | private static final String BUILD_INFO_PROVIDER_ID = "specsFile"; |
---|
31 | |
---|
32 | public static void expand( IProject project) { |
---|
33 | String basePath = Storage.getProperty( project, Constants.BASE_PATH_KEY); |
---|
34 | String version = Storage.getProperty( project, Constants.VERSION_KEY); |
---|
35 | String target = Storage.getProperty( project, Constants.TARGET_KEY); |
---|
36 | String bspPath = Storage.getProperty( project, Constants.BSP_PATH_KEY); |
---|
37 | |
---|
38 | |
---|
39 | ICProjectDescription pd = CoreModel.getDefault().getProjectDescription( project); |
---|
40 | ICConfigurationDescription cd = pd.getActiveConfiguration(); |
---|
41 | IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cd); |
---|
42 | |
---|
43 | // Scanner configuration discovery. |
---|
44 | ICfgScannerConfigBuilderInfo2Set cbi = |
---|
45 | CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg); |
---|
46 | Map<CfgInfoContext, IScannerConfigBuilderInfo2> infoMap = cbi.getInfoMap(); |
---|
47 | for (CfgInfoContext infoContext : infoMap.keySet()) { |
---|
48 | IScannerConfigBuilderInfo2 buildInfo = cbi.getInfo(infoContext); |
---|
49 | buildInfo.setProviderRunCommand(BUILD_INFO_PROVIDER_ID, target + "-rtems" + version + "-gcc"); |
---|
50 | try { |
---|
51 | buildInfo.save(); |
---|
52 | } catch (CoreException e) { |
---|
53 | // TODO Auto-generated catch block |
---|
54 | e.printStackTrace(); |
---|
55 | } |
---|
56 | } |
---|
57 | MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(project); |
---|
58 | } |
---|
59 | |
---|
60 | private PropertyExpander() { |
---|
61 | // Do nothing |
---|
62 | } |
---|
63 | } |
---|