@Override
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
IEnvironmentVariableProvider provider) {
-
+ SmartBuildInterface sbi = SmartBuildInterface.getInstance();
if (variableName.equals("SBI_SYSROOT")) {
// set "SBI_SYSROOT" variable
String basePath = PlatformConfigurationManager.getRootstrapPath(configuration);
- String sysrootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
+ String sysrootPath = sbi.getPlatformRootstrapPath(
basePath);
if (sysrootPath == null) {
sysrootPath = "";
}
return new BuildEnvVar("BUILD_TYPE", buildtype,
IBuildEnvironmentVariable.ENVVAR_REPLACE, null);
+ } else if (variableName.equals("TOOLCHAIN_PREFIX")) {
+ String target = PlatformConfigurationManager.getBuildTargetName(configuration);
+ if (target == null) {
+ return null;
+ }
+ String toolchain = sbi.getToolchainIDFromTargetID(target);
+ String value = SmartBuildInterface.getInstance().getToolchainPropertyValue(toolchain, "TOOLCHAIN_PREFIX");
+ return new BuildEnvVar("TOOLCHAIN_PREFIX", value,
+ IBuildEnvironmentVariable.ENVVAR_REPLACE, null);
}
return null;
}
IEnvironmentVariableProvider provider) {
List<IBuildEnvironmentVariable> list = new ArrayList<IBuildEnvironmentVariable>();
- final String[] buildEnvs = { "SBI_SYSROOT", "BUILD_TYPE" };
+ final String[] buildEnvs = { "SBI_SYSROOT", "BUILD_TYPE", "TOOLCHAIN_PREFIX" };
String[] envs = buildEnvs;
for (String env : envs) {
@SuppressWarnings("restriction")
public class DefaultIncludePathImporter {
private IProject project = null;
-
- private final String DEFAULT_INCLUDES_X86_XMLFILE = "platform_includes_x86.xml";
- private final String DEFAULT_INCLUDES_ARM_XMLFILE = "platform_includes_arm.xml";
+ private final String DEFAULT_INCLUDES_XMLFILE = "platform_includes.xml";
private final Logger logger = LoggerFactory.getLogger(DefaultIncludePathImporter.class);
public boolean process() {
IPath idePath = new Path(InstallPathConfig.getSDKPath()).append("ide");
-
- IPath x86IncludeFilePath = idePath.append(DEFAULT_INCLUDES_X86_XMLFILE);
- if (!x86IncludeFilePath.toFile().exists()) {
- logger.warn(String.format("File could not be imported: %s",
- x86IncludeFilePath.toOSString()));
- return false;
- }
- String x86IncludeFile = x86IncludeFilePath.toOSString();
-
- IPath armIncludeFilePath = idePath.append(DEFAULT_INCLUDES_ARM_XMLFILE);
- if (!armIncludeFilePath.toFile().exists()) {
+ IPath includeFilePath = idePath.append(DEFAULT_INCLUDES_XMLFILE);
+ if (!includeFilePath.toFile().exists()) {
logger.warn(String.format("File could not be imported: %s",
- armIncludeFilePath.toOSString()));
+ includeFilePath.toOSString()));
return false;
}
- String armIncludeFile = armIncludeFilePath.toOSString();
+ String includeFile = includeFilePath.toOSString();
List<ISettingsProcessor> processors = getSettingProcessor();
Map<String, ISettingsProcessor> importers = new HashMap<String, ISettingsProcessor>();
importers.put(processor.getSectionName(), processor);
}
- List<ISettingsProcessor> processors2 = getSettingProcessor();
- Map<String, ISettingsProcessor> importers2 = new HashMap<String, ISettingsProcessor>();
- for (ISettingsProcessor processor : processors2) {
- importers2.put(processor.getSectionName(), processor);
- }
-
try {
- // make x86 pair list (importer, section)
- List<ImporterSectionPair> x86Pairs = setImporterSectionPair(x86IncludeFile, importers);
-
- // make arm pair list (importer, section)
- List<ImporterSectionPair> armPairs = setImporterSectionPair(armIncludeFile, importers2);
+ // make pair list (importer, section)
+ List<ImporterSectionPair> pairs = setImporterSectionPair(includeFile, importers);
// read xml and set it to project description
- ICProjectDescription writableDescription = readSectionXML(project, x86Pairs, armPairs);
+ ICProjectDescription writableDescription = readSectionXML(project, pairs);
+
// set changed project description by xml
CoreModel.getDefault().setProjectDescription(project, writableDescription);
} catch (FileNotFoundException e) {
return pairs;
}
- private ICProjectDescription readSectionXML(IProject project,
- List<ImporterSectionPair> x86Pairs, List<ImporterSectionPair> armPairs)
+ private ICProjectDescription readSectionXML(IProject project, List<ImporterSectionPair> pairs)
throws SettingsImportExportException {
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
IConfiguration defaultConfig = info.getDefaultConfiguration();
ICConfigurationDescription writableConfig = writableDescription
.getConfigurationById(config.getId());
ICFolderDescription writableProjectRoot = writableConfig.getRootFolderDescription();
- if (config.getName().endsWith("Emulator")) {
- for (ImporterSectionPair pair : x86Pairs) {
- pair.importer.readSectionXML(writableProjectRoot, pair.section);
- }
- } else if (config.getName().endsWith("Device")) {
- for (ImporterSectionPair pair : armPairs) {
- pair.importer.readSectionXML(writableProjectRoot, pair.section);
- }
+ for (ImporterSectionPair pair : pairs) {
+ pair.importer.readSectionXML(writableProjectRoot, pair.section);
}
}
return writableDescription;