1 # |
1 # |
2 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 # Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 # All rights reserved. |
3 # All rights reserved. |
4 # This component and the accompanying materials are made available |
4 # This component and the accompanying materials are made available |
5 # under the terms of the License "Eclipse Public License v1.0" |
5 # under the terms of the License "Eclipse Public License v1.0" |
6 # which accompanies this distribution, and is available |
6 # which accompanies this distribution, and is available |
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
2175 self.BuildVariant.AddOperation(raptor_data.Set("DEFFILE", resolvedDefFile)) |
2175 self.BuildVariant.AddOperation(raptor_data.Set("DEFFILE", resolvedDefFile)) |
2176 self.__debug("Set DEFFILE to " + resolvedDefFile) |
2176 self.__debug("Set DEFFILE to " + resolvedDefFile) |
2177 self.BuildVariant.AddOperation(raptor_data.Set("DEFFILEKEYWORD", deffile_keyword)) |
2177 self.BuildVariant.AddOperation(raptor_data.Set("DEFFILEKEYWORD", deffile_keyword)) |
2178 self.__debug("Set DEFFILEKEYWORD to '%s'",deffile_keyword) |
2178 self.__debug("Set DEFFILEKEYWORD to '%s'",deffile_keyword) |
2179 |
2179 |
|
2180 # If target type is "implib" it must have a def file |
|
2181 self.checkImplibDefFile(resolvedDefFile) |
|
2182 |
2180 # if this target type has a default TARGETPATH other than "" for |
2183 # if this target type has a default TARGETPATH other than "" for |
2181 # resources then we need to add that default to all resources which |
2184 # resources then we need to add that default to all resources which |
2182 # do not explicitly set the TARGETPATH themselves. |
2185 # do not explicitly set the TARGETPATH themselves. |
2183 tp = self.getDefaultResourceTargetPath(self.getTargetType()) |
2186 tp = self.getDefaultResourceTargetPath(self.getTargetType()) |
2184 if tp: |
2187 if tp: |
2265 " ".join(self.sources))) |
2268 " ".join(self.sources))) |
2266 |
2269 |
2267 def getTargetType(self): |
2270 def getTargetType(self): |
2268 """Target type in lower case - the standard format""" |
2271 """Target type in lower case - the standard format""" |
2269 return self.__targettype.lower() |
2272 return self.__targettype.lower() |
|
2273 |
|
2274 def checkImplibDefFile(self, defFile): |
|
2275 """Project with target type implib must have DEFFILE defined |
|
2276 explicitly or implicitly, otherwise it is an error |
|
2277 """ |
|
2278 if self.getTargetType() == 'implib' and defFile == '': |
|
2279 self.__Raptor.Error("No DEF File for IMPLIB target type in " + \ |
|
2280 self.__currentMmpFile, bldinf=self.__bldInfFilename) |
2270 |
2281 |
2271 def resolveDefFile(self, aTARGET, aBuildPlatform): |
2282 def resolveDefFile(self, aTARGET, aBuildPlatform): |
2272 """Returns a fully resolved DEFFILE entry depending on .mmp file location and TARGET, DEFFILE and NOSTRICTDEF |
2283 """Returns a fully resolved DEFFILE entry depending on .mmp file location and TARGET, DEFFILE and NOSTRICTDEF |
2273 entries in the .mmp file itself (where appropriate). |
2284 entries in the .mmp file itself (where appropriate). |
2274 Is able to deal with target names that have multiple '.' characters e.g. messageintercept.esockdebug.dll |
2285 Is able to deal with target names that have multiple '.' characters e.g. messageintercept.esockdebug.dll |
2673 bldInfFile = BldInfFile(component.bldinf_filename, self.__gnucpp, component.depfiles, self.__Raptor) |
2684 bldInfFile = BldInfFile(component.bldinf_filename, self.__gnucpp, component.depfiles, self.__Raptor) |
2674 component.bldinf = bldInfFile |
2685 component.bldinf = bldInfFile |
2675 |
2686 |
2676 specName = getSpecName(component.bldinf_filename, fullPath=True) |
2687 specName = getSpecName(component.bldinf_filename, fullPath=True) |
2677 |
2688 |
2678 if isinstance(component.bldinf, raptor_xml.SystemModelComponent): |
|
2679 # this component came from a system_definition.xml |
|
2680 layer = component.bldinf.GetContainerName("layer") |
|
2681 componentName = component.bldinf.GetContainerName("component") |
|
2682 else: |
|
2683 # this is a plain old bld.inf file from the command-line |
|
2684 layer = "" |
|
2685 componentName = "" |
|
2686 |
|
2687 # exports are independent of build platform |
2689 # exports are independent of build platform |
2688 for i,ep in enumerate(self.ExportPlatforms): |
2690 for i,ep in enumerate(self.ExportPlatforms): |
2689 specNode = raptor_data.Specification(name = specName) |
2691 specNode = raptor_data.Specification(name = specName) |
2690 |
2692 |
2691 # keep the BldInfFile object for later |
2693 # keep the BldInfFile object for later |
2692 specNode.component = component |
2694 specNode.component = component |
2693 |
2695 |
2694 # add some basic data in a component-wide variant |
2696 # add some basic data in a component-wide variant |
2695 var = raptor_data.Variant(name='component-wide') |
2697 var = raptor_data.Variant(name='component-wide') |
2696 var.AddOperation(raptor_data.Set("COMPONENT_META", str(component.bldinf_filename))) |
2698 var.AddOperation(raptor_data.Set("COMPONENT_META", str(component.bldinf_filename))) |
2697 var.AddOperation(raptor_data.Set("COMPONENT_NAME", componentName)) |
2699 var.AddOperation(raptor_data.Set("COMPONENT_NAME", component.componentname)) |
2698 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer)) |
2700 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", component.layername)) |
2699 specNode.AddVariant(var) |
2701 specNode.AddVariant(var) |
2700 |
2702 |
2701 # add this bld.inf Specification to the export platform |
2703 # add this bld.inf Specification to the export platform |
2702 exportNodes[i].AddChild(specNode) |
2704 exportNodes[i].AddChild(specNode) |
2703 component.exportspecs.append(specNode) |
2705 component.exportspecs.append(specNode) |
2724 specNode.component = component |
2726 specNode.component = component |
2725 |
2727 |
2726 # add some basic data in a component-wide variant |
2728 # add some basic data in a component-wide variant |
2727 var = raptor_data.Variant(name='component-wide-settings-' + plat) |
2729 var = raptor_data.Variant(name='component-wide-settings-' + plat) |
2728 var.AddOperation(raptor_data.Set("COMPONENT_META",str(component.bldinf_filename))) |
2730 var.AddOperation(raptor_data.Set("COMPONENT_META",str(component.bldinf_filename))) |
2729 var.AddOperation(raptor_data.Set("COMPONENT_NAME", componentName)) |
2731 var.AddOperation(raptor_data.Set("COMPONENT_NAME", component.componentname)) |
2730 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", layer)) |
2732 var.AddOperation(raptor_data.Set("COMPONENT_LAYER", component.layername)) |
2731 var.AddOperation(raptor_data.Set("MODULE", modulename)) |
2733 var.AddOperation(raptor_data.Set("MODULE", modulename)) |
2732 var.AddOperation(raptor_data.Append("OUTPUTPATHOFFSET", outputDir, '/')) |
2734 var.AddOperation(raptor_data.Append("OUTPUTPATHOFFSET", outputDir, '/')) |
2733 var.AddOperation(raptor_data.Append("OUTPUTPATH", outputDir, '/')) |
2735 var.AddOperation(raptor_data.Append("OUTPUTPATH", outputDir, '/')) |
2734 var.AddOperation(raptor_data.Append("BLDINF_OUTPUTPATH",outputDir, '/')) |
2736 var.AddOperation(raptor_data.Append("BLDINF_OUTPUTPATH",outputDir, '/')) |
2735 |
2737 |
2822 shutil.copyfile(source_str, dest_str) |
2824 shutil.copyfile(source_str, dest_str) |
2823 return exportwhatlog |
2825 return exportwhatlog |
2824 |
2826 |
2825 sourceMTime = 0 |
2827 sourceMTime = 0 |
2826 destMTime = 0 |
2828 destMTime = 0 |
|
2829 sourceStat = 0 |
2827 try: |
2830 try: |
2828 sourceMTime = os.stat(source_str)[stat.ST_MTIME] |
2831 sourceStat = os.stat(source_str) |
|
2832 sourceMTime = sourceStat[stat.ST_MTIME] |
2829 destMTime = os.stat(dest_str)[stat.ST_MTIME] |
2833 destMTime = os.stat(dest_str)[stat.ST_MTIME] |
2830 except OSError, e: |
2834 except OSError, e: |
2831 if sourceMTime == 0: |
2835 if sourceMTime == 0: |
2832 message = "Source of export does not exist: " + str(source) |
2836 message = "Source of export does not exist: " + str(source) |
2833 if not self.__Raptor.keepGoing: |
2837 if not self.__Raptor.keepGoing: |
2837 |
2841 |
2838 if destMTime == 0 or destMTime < sourceMTime: |
2842 if destMTime == 0 or destMTime < sourceMTime: |
2839 if os.path.exists(dest_str): |
2843 if os.path.exists(dest_str): |
2840 os.chmod(dest_str,stat.S_IREAD | stat.S_IWRITE) |
2844 os.chmod(dest_str,stat.S_IREAD | stat.S_IWRITE) |
2841 shutil.copyfile(source_str, dest_str) |
2845 shutil.copyfile(source_str, dest_str) |
|
2846 |
|
2847 # Ensure that the destination file remains executable if the source was also: |
|
2848 os.chmod(dest_str,sourceStat[stat.ST_MODE] | stat.S_IREAD | stat.S_IWRITE | stat.S_IWGRP ) |
2842 self.__Raptor.Info("Copied %s to %s", source_str, dest_str) |
2849 self.__Raptor.Info("Copied %s to %s", source_str, dest_str) |
2843 else: |
2850 else: |
2844 self.__Raptor.Info("Up-to-date: %s", dest_str) |
2851 self.__Raptor.Info("Up-to-date: %s", dest_str) |
2845 |
2852 |
2846 |
2853 |