Bug 350 RnD binary zips missing all content outside epoc32 tree
authorSimon Howkins <simonh@symbian.org>
Wed, 16 Sep 2009 10:27:29 +0100
changeset 456 1ba3c86ebec0
parent 455 bb24766fdbdc
child 457 991d89a55c87
Bug 350 RnD binary zips missing all content outside epoc32 tree Removed confusing system of *_includefiles.txt appearing in the root of the build drive Also improved generation of release zips and release_metadata.xml to reduce overheads of copying and tweaking for release
common/build.postbuild.xml
common/build.xml
common/templates/zip.cfg.xml.ftl.template
common/tools/populateziptemplate.pl
common/tools/zip_includefiles.pl
--- a/common/build.postbuild.xml	Tue Sep 15 12:26:53 2009 +0100
+++ b/common/build.postbuild.xml	Wed Sep 16 10:27:29 2009 +0100
@@ -228,19 +228,10 @@
     </target>
 
     <target name="sf-package-postbuild-rnd" depends="sf-preprocess-package-config">
-
-        <!-- zip any RnD _includefile.txt files generated during source packaging -->
-        <exec executable="perl" dir="${build.drive}/" failonerror="false" output="${build.log.dir}/zip_postbuild.log">
-            <arg value="${sf.common.config.dir}/tools/zip_includefiles.pl"/>
-        </exec>
-        <!-- cleanup my moving includefiles to logs and zips to zips\release -->
-        <move todir="${build.log.dir}">
-            <fileset dir="${build.drive}"><include name="*_includefile.txt"/></fileset>
-        </move>
-        <move todir="${build.drive}/output/zips/release">
-            <fileset dir="${build.drive}"><include name="bin*.zip"/></fileset>
-        </move>
-        <!-- TODO: merge with release_metadata.xml ? -->
+        <antcall target="sf-zip-content">
+            <param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
+            <param name="zip.target.name" value="rnd-postbuild" />
+        </antcall>
     </target>
 
     <target name="sf-package-tools" depends="sf-preprocess-package-config">
@@ -249,7 +240,6 @@
             <arg value="a"/>
             <arg value="-tzip"/>
             <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
-<!--            <arg value="-x@${build.log.dir}/*_includefile.txt"/> -->
             <arg value="${build.drive}/output/zips/release/tools_epoc.zip"/> 
             <arg value="epoc32/tools"/>
         </exec>
--- a/common/build.xml	Tue Sep 15 12:26:53 2009 +0100
+++ b/common/build.xml	Wed Sep 16 10:27:29 2009 +0100
@@ -442,7 +442,8 @@
 
     <target name="sf-preprocess-package-config">
         <mkdir dir="${sf.common.config.dir}/generated"/>
-            <if><istrue value="${sf.spec.package.src.enable}"/>
+        <if>
+            <istrue value="${sf.spec.package.src.enable}"/>
             <then>
                 <echo message="INFO Packaging Source Repos"/>
                 <property name="sf-preprocess-package-config.arg" value=""/>
@@ -451,7 +452,7 @@
                 <echo message="INFO Packaging: Ignoring Source Repos"/>
                 <property name="sf-preprocess-package-config.arg" value="--nosource"/>
             </else>
-            </if>
+        </if>
 
         <exec executable="perl" dir="${build.drive}/" failonerror="false" output="${build.log.dir}/zipconfig.log">
             <arg value="${sf.common.config.dir}/tools/populateziptemplate.pl"/>
@@ -475,6 +476,14 @@
             <param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
             <param name="zip.target.name" value="src" />
         </antcall>
+        <antcall target="sf-zip-content">
+            <param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
+            <param name="zip.target.name" value="rnd" />
+        </antcall>
+        <antcall target="sf-zip-content">
+            <param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
+            <param name="zip.target.name" value="rnd-internal" />
+        </antcall>
         <!-- Then zip up src zips by layer -->
         <antcall target="sf-zip-content">
             <param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
--- a/common/templates/zip.cfg.xml.ftl.template	Tue Sep 15 12:26:53 2009 +0100
+++ b/common/templates/zip.cfg.xml.ftl.template	Wed Sep 16 10:27:29 2009 +0100
@@ -19,7 +19,7 @@
 		<set name="grace.product" value="${grace.product.name}" />
 		<set name="grace.release" value="${grace.release.name}" />
 		
-		<!-- Specify this config to package all inputs to the build -->
+		<!-- Specify this config to package all src inputs to the build -->
 		<config name="src" abstract="true">
 			<!-- Options that apply to all src configs -->
 			<set name="exclude" value="**/.hg/**"/>
@@ -34,17 +34,16 @@
 			<config name="oss" abstract="true">
 				<set name="grace.filters" value="src" />
 			</config>
-			<config name="rnd" abstract="true">
-				<set name="grace.filters" value="rnd" />
-			</config>
 			<config name="misc" abstract="true">
 				<set name="grace.filters" value="misc" />
 			</config>
 		</config>
+		<!-- Specify this config to double-package all src inputs to the build -->
 		<config name="src-by-layer" abstract="true">
-			<set name="grace.metadata" value="false" />
 			<set name="root.dir" value="${build.output.dir}/zips"/>
 			<set name="archives.dir" value="${build.output.dir}/zips/release" />
+			<set name="grace.filters" value="src" />
+			<set name="grace.extract" value="double" />
 			<!-- Zips of zips for SFL code -->
 			<config name="sfl-adaptation">
 				<set name="name" value="src_sfl_adaptation"/>
@@ -96,6 +95,15 @@
 				<set name="include" value="src_oss_tools_*.zip"/>
 			</config>
 		</config>
+		<!-- Specify this config to package all rnd inputs to the build that should be released -->
+		<config name="rnd" abstract="true">
+			<set name="grace.filters" value="rnd" />
+			<set name="archives.dir" value="${build.output.dir}/zips/release" />
+		</config>
+		<!-- Specify this config to package all rnd inputs to the build that should be released -->
+		<config name="rnd-internal" abstract="true">
+			<set name="grace.filters" value="emu" />
+		</config>
 		<!-- Specify this config to package all outputs from the build -->
 		<config name="bin" abstract="true">
 			<!-- This config will be populated with exclusions for the rnd bins -->
@@ -106,5 +114,10 @@
 				<set name="exclude" value="epoc32/build/**"/>
 			</config>
 		</config>
+		<!-- Specify this config to re-package the internal rnd bins after the build has updates some of the files -->
+		<config name="rnd-postbuild" abstract="true">
+			<set name="grace.filters" value="emu"/>
+			<set name="archives.dir" value="${build.output.dir}/zips/release" />
+		</config>
 	</config>
 </build>
--- a/common/tools/populateziptemplate.pl	Tue Sep 15 12:26:53 2009 +0100
+++ b/common/tools/populateziptemplate.pl	Wed Sep 16 10:27:29 2009 +0100
@@ -100,14 +100,18 @@
 	elsif ($package->{source} =~ m{/rnd/([^/]+)/([^/]+)})
 	{
 		# RnD repository
+		my $licenseType = $1;
 		my $name="bin_$1_$2";
-		if ($1 eq "internal")
+		my $postbuildName = "binaries_$2";
+		my $config = "rnd";
+		if ($licenseType eq "internal")
 		{
-			$name = "binaries_$2";
+			$name = "binaries_$2_prebuild";
+			$config = "rnd-internal";
 		}
 		
 		# Create a zip object
-		push @{$zipConfig->{config}->{config}->{src}->{config}->{rnd}->{config}},
+		push @{$zipConfig->{config}->{config}->{$config}->{config}},
 		{
 			set =>
 			[
@@ -128,19 +132,33 @@
 		# Enumerate all the files on the local disk that are in this repository
 		(my $dosCompatibleDst = $package->{dst}) =~ s{/}{\\}g;
 		my @files = `dir /b/s/a-d $dosCompatibleDst 2> nul:`;
-		#print "@files\n";
 		next unless @files;
-		# Add the files to this zip object
+		# Add the files to the global list of items to be excluded in the binary zips
 		@files = grep {
+			chomp;
 			s{\\}{/}g;
 			s!^[A-Z]:/$package->{dst}/!!i;
 			m{^epoc32/}i;
 		} @files;
 		push @allRndFiles, @files;
-		
-		open FILE, ">", $name ."_includefile.txt" or die "Cannot write includefile!";
-		print FILE @files;
-		close FILE;
+
+		if ($licenseType eq "internal")
+		{
+			# Add a zip object to zip this package from the epoc tree in the postbuild phase
+			push @{$zipConfig->{config}->{config}->{"rnd-postbuild"}->{config}},
+			{
+				name => $postbuildName,
+				set =>
+				[
+					{
+						name => "name",
+						value=> $postbuildName,
+					},
+					# Turn the array of files into an array of inclusion hashes
+					(map { {name => "include", value => $_ } } @files),
+				]
+			};
+		}
 	}
 	else
 	{
--- a/common/tools/zip_includefiles.pl	Tue Sep 15 12:26:53 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!perl -w
-
-use strict;
-
-my @includefiles = glob "*_includefile.txt";
-foreach (@includefiles)
-{
-    my $includefilename=$_;
-	if (m/(.*)(_includefile.txt)/) {
-		my $zipfilename = $1.".zip";
-		system("7za a -tzip -i@".$includefilename . " " .$zipfilename);
-	}
-}
\ No newline at end of file