# HG changeset patch # User timkelly # Date 1279927378 18000 # Node ID 336352c21056c548e853d9707f7b7ef01dedc684 # Parent 75bd74aedcb6ae9294bc25bf7b871de36efc9c7f C:\c3_dev\hg\carbidecpp>First round of implementing variant build support and properly building projects that contain mi xed FEATUREVARIANT keywork in some MMPs and not others (see bug 11592) diff -r 75bd74aedcb6 -r 336352c21056 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Fri Jul 23 14:21:59 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Fri Jul 23 18:22:58 2010 -0500 @@ -922,7 +922,8 @@ // adapt the exe filename to the variant, if any IPath tempPath = null; - if (isVariantBldInf(cpi.getAbsoluteBldInfPath()) || isFeatureVariantMMP(mmpData, cpi.getProject())) { + if ((isVariantBldInf(cpi.getAbsoluteBldInfPath()) || isFeatureVariantMMP(mmpData, cpi.getProject())) + && !CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())) { tempPath = getBinaryVariantTargetName(mmpData, PathUtils.createPath(exePath), cpi.getProject()); if (tempPath == null){ return null; @@ -930,21 +931,46 @@ exePath = tempPath.lastSegment(); } - IPath path = buildConfig.getTargetOutputDirectory(); - - // if targetpath is non-null and this is an EKA1 emulator config then add it - if (buildConfig.getPlatformString().toUpperCase().equals(ISBSv1BuildContext.EMULATOR_PLATFORM)) { - if (buildConfig.getSDK().getOSVersion().getMajor() < 9) { - String targetPath = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETPATH); - if (targetPath != null) { - path = path.append("z").append(targetPath); //$NON-NLS-1$ - } + IPath path = null; + if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject()) && + isFeatureVariantMMP(mmpData, cpi.getProject())){ + + path = buildConfig.getTargetOutputDirectory(); + + } else { + // Not a variant + path = buildConfig.getTargetOutputDirectory(); + if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject())){ + // For SBSv2, it's not a variant, so it goes under the standard output dir + path = stripVariationFolder(path); } + } path = path.append(exePath); return path; } + + private IPath stripVariationFolder(IPath path) { + if (!path.toOSString().contains(".")){ + return path; + } + String[] segments = path.segments(); + int segmentCount = path.segmentCount(); + path = path.removeFirstSegments(segmentCount); + int count = 0; + path = path.addTrailingSeparator(); + for (String segment : segments){ + if (count == segmentCount - 2 && segment.contains(".")){ + path = path.append(segment.split("\\.")[0]); + } else { + path = path.append(segment); + } + count ++; + } + return path; + + } }); } @@ -978,9 +1004,7 @@ // if the target path is not set then by default it will usually // be left blank. for EKA2 though binaries need to go in \sys\bin\ exePath = Path.ROOT.setDevice("C:"); //$NON-NLS-1$ - if (buildConfig.getSDK().getOSVersion().getMajor() > 8) { - exePath = exePath.append("sys/bin/"); //$NON-NLS-1$ - } + exePath = exePath.append("sys/bin/"); //$NON-NLS-1$ String targetName = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGET); if (targetName != null) { exePath = exePath.append(targetName); @@ -2226,7 +2250,9 @@ if (defaultConfig != null){ if (defaultConfig.getBuildVariationName().length() > 0 && mmpData.getFlags().contains(EMMPStatement.FEATUREVARIANT)) { - + isFeatureVariant = true; + } else if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project) && + mmpData.getFlags().contains(EMMPStatement.FEATUREVARIANT)){ isFeatureVariant = true; } } @@ -2312,7 +2338,7 @@ } /** - * Get the MD5 hash for a configuration if it is a true binary variation. + * Get the MD5 hash for a configuration if it is a true binary variation. This is for abld buidler only. * @param config - The Carbide build configuration to check against * @param mmpFullPath - The path to the MMP file that builds the binary * @return A string of the MD5 hash. Returns an empty string if the configuration is not a binary variant or cannot be determined. @@ -2337,7 +2363,12 @@ }); } - + /** + * NOTE: This only works for ABLD. Not SBSv2/Raptor! + * @param mmpData + * @param config + * @return + */ private static File getMakeFileForSymbianBinaryVariant(IMMPData mmpData, ICarbideBuildConfiguration config){ IPath makefileDir = CarbideCPPBuilder.getBuilderMakefileDir(config); diff -r 75bd74aedcb6 -r 336352c21056 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Fri Jul 23 14:21:59 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Fri Jul 23 18:22:58 2010 -0500 @@ -28,6 +28,7 @@ import org.eclipse.core.runtime.SubMonitor; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; @@ -88,12 +89,20 @@ } /** Get the build-able configuration from the command line (i.e. build alias). This is passed after the sbs -c parameter */ - protected String getConfigName(ICarbideBuildConfiguration buildConfig) { + protected String getConfigName(ICarbideBuildConfiguration buildConfig, IPath componentPath) { String buildAlias = ((ISBSv2BuildContext)buildConfig.getBuildContext()).getSBSv2Alias(); if (buildAlias == null){ // Just get the default target. This is a SBSv1 style configuration name... buildAlias = buildConfig.getPlatformString().toLowerCase() + "_" + buildConfig.getTargetString().toLowerCase(); } + + if (buildAlias.contains(".") && componentPath != null && + !EpocEngineHelper.hasFeatureVariantKeyword(buildConfig.getCarbideProject(), componentPath)){ + + // This is a variant build, but the MMP is not a variant so just take the base alias. + buildAlias = buildAlias.split("\\.")[0]; + } + ISBSv2BuildConfigInfo sbsv2Info = ((CarbideBuildConfiguration)buildConfig).getSBSv2BuildConfigInfo(); if (sbsv2Info != null){ String variant = sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT); @@ -117,7 +126,7 @@ List argsList = new ArrayList(); argsList.add(COMPONENT_ARG); - argsList.add(componentName); + argsList.add(componentPath.toOSString()); if (!invokeSBSCommand(buildConfig, launcher, argsList, isTest)) { return false; @@ -258,7 +267,7 @@ List argsList = new ArrayList(); argsList.add(cleanCmd); argsList.add(COMPONENT_ARG); - argsList.add(componentName); + argsList.add(componentPath.toOSString()); if (!invokeSBSCommand(buildConfig, launcher, argsList, isTest)) { return false; @@ -391,7 +400,7 @@ List argsList = new ArrayList(); argsList.add(FREEZE_CMD); argsList.add(COMPONENT_ARG); - argsList.add(componentPath.lastSegment()); + argsList.add(componentPath.toOSString()); if (!invokeSBSCommand(buildConfig, launcher, argsList, isTest)) { return false; @@ -509,7 +518,13 @@ args.add("-b"); //$NON-NLS-1$ args.add(cpi.getAbsoluteBldInfPath().toOSString()); args.add("-c"); //$NON-NLS-1$ - String configName = getConfigName(buildConfig); + IPath componentPath = null; + if (sbsArgs.size() >= 2){ + componentPath = new Path(sbsArgs.get(sbsArgs.indexOf("-p")+ 1)); + sbsArgs.remove(1); + sbsArgs.add(componentPath.lastSegment()); + } + String configName = getConfigName(buildConfig, componentPath); if (isTest) { configName = configName + ".test"; //$NON-NLS-1$ @@ -517,6 +532,12 @@ args.add(configName); + if (!sbsArgs.contains("-p") && configName.contains(".")){ + // normal build, we also need to add an extra -c param for non-variation build + args.add("-c"); + args.add(configName.split("\\.")[0]); + } + //TODO this causes output to go to stdout, but only at the end of the build. should we specify a logfile name and tail the file? args.add("-f"); //$NON-NLS-1$ args.add("-"); //$NON-NLS-1$ @@ -591,7 +612,7 @@ ICarbideProjectInfo cpi = buildConfig.getCarbideProject(); IPath workingDirectory = cpi.getINFWorkingDirectory(); - String configName = getConfigName(buildConfig); + String configName = getConfigName(buildConfig, fullMMPPath); String[] sbsArgs = new String[] {"--source-target=" + file.toOSString(), COMPILE_ARG, configName, COMPONENT_ARG, fullMMPPath.toFile().getName()}; launcher.setErrorParserManager(buildConfig.getCarbideProject().getINFWorkingDirectory(), buildConfig.getErrorParserList());