Bug 975622 - Part 2: Add post builder. r=bnicholson
authorNick Alexander <nalexander@mozilla.com>
Mon, 24 Feb 2014 18:14:04 -0800
changeset 170436 c092d3402ba6163445c2c2126e73f3a6f56cc3b7
parent 170435 3e9a671c4b59b7cf2a6fa4961a51757c760d24de
child 170437 d5ac8e460f2e3431d96803ad97c837830fe884df
push id26288
push userryanvm@gmail.com
push dateTue, 25 Feb 2014 20:20:43 +0000
treeherdermozilla-central@22650589a724 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs975622
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 975622 - Part 2: Add post builder. r=bnicholson
python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/PostBuilder.launch
python/mozbuild/mozbuild/backend/templates/android_eclipse/.project
python/mozbuild/mozbuild/backend/templates/android_eclipse/post_build.xml
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/PostBuilder.launch
@@ -0,0 +1,18 @@
+#filter substitution
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="post_build,"/>
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.capture_output" value="true"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="true"/>
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@IDE_PROJECT_NAME@"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/@IDE_PROJECT_NAME@/post_build.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="clean"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dbuild_type=&quot;${build_type}&quot;&#10;-Dbuild_files=&quot;DUMMY ${build_files}&quot;"/>
+</launchConfiguration>
--- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.project
+++ b/python/mozbuild/mozbuild/backend/templates/android_eclipse/.project
@@ -30,14 +30,23 @@
 			<arguments>
 			</arguments>
 		</buildCommand>
 		<buildCommand>
 			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
 			<arguments>
 			</arguments>
 		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+			<arguments>
+				<dictionary>
+					<key>LaunchConfigHandle</key>
+					<value>&lt;project&gt;/.externalToolBuilders/PostBuilder.launch</value>
+				</dictionary>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
 </projectDescription>
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/backend/templates/android_eclipse/post_build.xml
@@ -0,0 +1,45 @@
+#filter substitution
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+    <property name="topsrcdir" value="@IDE_TOPSRCDIR@"/>
+    <property name="topobjdir" value="@IDE_TOPOBJDIR@"/>
+    <property name="objdir" value="@IDE_OBJDIR@"/>
+    <property name="project_name" value="@IDE_PROJECT_NAME@"/>
+
+    <!-- This file can get large (!), but for a short time we want to
+         log as much information for debugging build loops as possible. -->
+    <record name="${topobjdir}/android_eclipse/build.log" append="yes" />
+
+    <target name="build_needed" >
+
+        <script language="javascript" >
+<![CDATA[
+  importClass(java.io.File);
+
+  var build_files = project.getProperty("build_files").split(" ");
+  var after = [];
+
+  var echo = project.createTask("echo");
+  var info = Packages.org.apache.tools.ant.taskdefs.Echo.EchoLevel();
+  info.setValue("info");
+  echo.setLevel(info);
+
+  // Timestamp.
+  echo.addText(project.getProperty("project_name") + " build type " + project.getProperty("build_type") + " started at: " + new Date());
+  echo.addText(project.getProperty("line.separator"));
+
+  echo.perform();
+
+  // The if below checks for the property being defined, not its value.
+  project.setProperty("build_needed", build_needed);
+]]>
+        </script>
+    </target>
+
+    <target name="post_build" depends="build_needed" if="build_needed">
+        <exec executable="${topsrcdir}/mach" dir="${topobjdir}" failonerror="true">
+            <arg value="build"/>
+            <arg value="${objdir}/ANDROID_ECLIPSE_PROJECT_${project_name}"/>
+        </exec>
+    </target>
+</project>