Bug 981427 - CppEclipse - Usability improvements for b2g. r=botond
authorBenoit Girard <b56girard@gmail.com>
Mon, 10 Mar 2014 13:41:37 -0400
changeset 191086 0ed9102a0b2f4eb98b168e580cf81c1347ed5be3
parent 191085 5fbf1c06ca9beed3f41a632cfe7010cd9f6e70bd
child 191087 252e66958eff8a4adcca2eb50a26975ebc8d92f0
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs981427
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 981427 - CppEclipse - Usability improvements for b2g. r=botond
python/mozbuild/mozbuild/backend/cpp_eclipse.py
--- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py
+++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py
@@ -117,43 +117,60 @@ class CppEclipseBackend(CommonBackend):
         settings = settings.replace('@PREINCLUDE_FILE_PATH@', os.path.join(self.environment.topobjdir, 'dist/include/mozilla-config.h'))
         settings = settings.replace('@DEFINE_MOZILLA_INTERNAL_API@', self._define_entry('MOZILLA_INTERNAL_API', '1'))
         settings = settings.replace('@DEFINE_MDCPUCFG@', self._define_entry('MDCPUCFG', self.environment.substs['TARGET_NSPR_MDCPUCFG']))
         settings = settings.replace("@COMPILER_FLAGS@", self._cxx + " " + self._cppflags);
 
         fh.write(settings)
 
     def _write_launch_files(self, launch_dir):
-        main_gecko_launch = os.path.join(launch_dir, 'gecko.launch')
-        with open(main_gecko_launch, 'wb') as fh:
-            bin_dir = os.path.join(self.environment.topobjdir, 'dist')
+        bin_dir = os.path.join(self.environment.topobjdir, 'dist')
+
+        # TODO Improve binary detection
+        if self._macbundle:
+            exe_path = os.path.join(bin_dir, self._macbundle, 'Contents/MacOS')
+        else:
+            exe_path = os.path.join(bin_dir, 'bin')
+
+        exe_path = os.path.join(exe_path, self._appname + self._bin_suffix)
 
-            launch = LAUNCH_CONFIG_TEMPLATE
-            # TODO Improve binary detection
-            if self._macbundle:
-                exe_path = os.path.join(bin_dir, self._macbundle, 'Contents/MacOS')
-            else:
-                exe_path = os.path.join(bin_dir, 'bin')
+        if self.environment.substs['MOZ_WIDGET_TOOLKIT'] != 'gonk':
+            main_gecko_launch = os.path.join(launch_dir, 'gecko.launch')
+            with open(main_gecko_launch, 'wb') as fh:
+                launch = GECKO_LAUNCH_CONFIG_TEMPLATE
+                launch = launch.replace('@LAUNCH_PROGRAM@', exe_path)
+                launch = launch.replace('@LAUNCH_ARGS@', '-P -no-remote')
+                fh.write(launch)
 
-            exe_path = os.path.join(exe_path, self._appname + self._bin_suffix)
-            launch = launch.replace('@LAUNCH_PROGRAM@', exe_path)
-            launch = launch.replace('@LAUNCH_ARGS@', '-P -no-remote')
-            fh.write(launch)
+        if self.environment.substs['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+            b2g_flash = os.path.join(launch_dir, 'b2g-flash.launch')
+            with open(b2g_flash, 'wb') as fh:
+                # We assume that the srcdir is inside the b2g tree.
+                # If that's not the case the user can always adjust the path
+                # from the eclipse IDE.
+                fastxul_path = os.path.join(self.environment.topsrcdir, '..', 'scripts', 'fastxul.sh')
+                launch = B2GFLASH_LAUNCH_CONFIG_TEMPLATE
+                launch = launch.replace('@LAUNCH_PROGRAM@', fastxul_path)
+                launch = launch.replace('@OBJDIR@', self.environment.topobjdir)
+                fh.write(launch)
 
         #TODO Add more launch configs (and delegate calls to mach)
 
     def _write_project(self, fh):
         project = PROJECT_TEMPLATE;
 
         project = project.replace('@PROJECT_NAME@', 'Gecko')
         project = project.replace('@PROJECT_TOPSRCDIR@', self.environment.topsrcdir)
         fh.write(project)
 
     def _write_cproject(self, fh):
-        fh.write(CPROJECT_TEMPLATE_HEADER.replace('@PROJECT_TOPSRCDIR@', self.environment.topobjdir))
+        cproject_header = CPROJECT_TEMPLATE_HEADER
+        cproject_header = cproject_header.replace('@PROJECT_TOPSRCDIR@', self.environment.topobjdir)
+        cproject_header = cproject_header.replace('@MACH_COMMAND@', os.path.join(self.environment.topsrcdir, 'mach'))
+        fh.write(cproject_header)
 
         for path, defines in self._paths_to_defines.items():
             folderinfo = CPROJECT_TEMPLATE_FOLDER_INFO_HEADER
             folderinfo = folderinfo.replace('@FOLDER_ID@', str(random.randint(1000000, 99999999999)))
             folderinfo = folderinfo.replace('@FOLDER_NAME@', 'tree/' + path)
             fh.write(folderinfo)
             for k, v in defines.items():
                 define = ET.Element('listOptionValue')
@@ -176,19 +193,19 @@ PROJECT_TEMPLATE = """<?xml version="1.0
                 <buildCommand>
                         <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
                         <triggers>clean,full,incremental,</triggers>
                         <arguments>
                         </arguments>
                 </buildCommand>
                 <buildCommand>
                         <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-                        <triggers>full,incremental,</triggers>
-                        <arguments>
-                        </arguments>
+                        <triggers></triggers>
+			<arguments>
+			</arguments>
                 </buildCommand>
         </buildSpec>
         <natures>
                 <nature>org.eclipse.cdt.core.cnature</nature>
                 <nature>org.eclipse.cdt.core.ccnature</nature>
                 <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
                 <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
         </natures>
@@ -219,17 +236,17 @@ CPROJECT_TEMPLATE_HEADER = """<?xml vers
                                         <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                                 </extensions>
                         </storageModule>
                         <storageModule moduleId="cdtBuildSystem" version="4.0.0">
                                 <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1674256904" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
                                         <folderInfo id="0.1674256904." name="/" resourcePath="">
                                                 <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1276586933" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
                                                         <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.710759961" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
-							<builder arguments="-C @PROJECT_TOPSRCDIR@ -j8" buildPath="@PROJECT_TOPSRCDIR@" command="gmake" enableCleanBuild="false" incrementalBuildTarget="binaries" id="org.eclipse.cdt.build.core.settings.default.builder.1437267827" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+							<builder arguments="build" buildPath="@PROJECT_TOPSRCDIR@" command="@MACH_COMMAND@" enableCleanBuild="false" incrementalBuildTarget="binaries" id="org.eclipse.cdt.build.core.settings.default.builder.1437267827" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
                                                 </toolChain>
                                         </folderInfo>
 """
 CPROJECT_TEMPLATE_FOLDER_INFO_HEADER = """
 					<folderInfo id="0.1674256904.@FOLDER_ID@" name="/" resourcePath="@FOLDER_NAME@">
 						<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1022318069" name="No ToolChain" superClass="org.eclipse.cdt.build.core.prefbase.toolchain" unusedChildren="">
 							<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1259030812" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs.1800697532"/>
 							<tool id="org.eclipse.cdt.build.core.settings.holder.1407291069" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder.582514939">
@@ -321,17 +338,17 @@ LANGUAGE_SETTINGS_TEMPLATE = """<?xml ve
                              <language-scope id="org.eclipse.cdt.core.g++"/>
                         </provider>
                         <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
                 </extension>
         </configuration>
 </project>
 """
 
-LAUNCH_CONFIG_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+GECKO_LAUNCH_CONFIG_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
 <booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
 <listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
 <stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="lldb"/>
 <booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
 <stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=""/>
 <booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
 <booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
@@ -357,16 +374,53 @@ LAUNCH_CONFIG_TEMPLATE = """<?xml versio
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
 <listEntry value="4"/>
 </listAttribute>
 <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
 <stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
 </launchConfiguration>
 """
 
+B2GFLASH_LAUNCH_CONFIG_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
+<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="lldb"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=""/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
+<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
+<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
+<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
+<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="@LAUNCH_PROGRAM@"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="gecko"/>
+<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="@OBJDIR@"/>
+<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/gecko"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
+</launchConfiguration>
+"""
+
+
 EDITOR_SETTINGS = """eclipse.preferences.version=1
 lineNumberRuler=true
 overviewRuler_migration=migrated_3.1
 printMargin=true
 printMarginColumn=80
 showCarriageReturn=false
 showEnclosedSpaces=false
 showLeadingSpaces=false