[tasque/xbuild] [xbuild] Outsource subst and translate targets



commit b9515c80b61e045f9d3f60e47631c39e6303afb2
Author: Antonius Riha <antoniusriha gmail com>
Date:   Sun Nov 18 15:54:41 2012 +0100

    [xbuild] Outsource subst and translate targets

 Makefile.am                |    2 ++
 build/X.Common.targets     |   28 ++++------------------------
 build/X.Substitute.targets |   16 ++++++++++++++++
 build/X.Translate.targets  |   14 ++++++++++++++
 build/build.csproj         |    5 +++++
 5 files changed, 41 insertions(+), 24 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index dc8cf24..350d4da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,6 +96,8 @@ EXTRA_DIST = \
 	build/GetAbsSrcDir.cs \
 	build/NormalizePath.cs \
 	build/X.Common.targets \
+	build/X.Substitute.targets \
+	build/X.Translate.targets \
 	build/X.CSharp.targets \
 	src/Libraries/RtmNet/RtmNet.csproj \
 	src/libtasque/libtasque.csproj \
diff --git a/build/X.Common.targets b/build/X.Common.targets
index 4ba9c70..f6cb21a 100644
--- a/build/X.Common.targets
+++ b/build/X.Common.targets
@@ -195,6 +195,7 @@
     </Otherwise>
   </Choose>
   
+  <!-- Main CSharp compile targets -->
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <UsingTask TaskName="Tasque.Build.Substitute" AssemblyFile="build.dll" />
   <UsingTask TaskName="Tasque.Build.GetRelPath" AssemblyFile="build.dll" />
@@ -203,31 +204,10 @@
   <UsingTask TaskName="Tasque.Build.NormalizePath" AssemblyFile="build.dll" />
   
   <!-- Substitute -->
-  <Target Name="Substitute" DependsOnTargets="BeforeSubstitute;CoreSubstitute;AfterSubstitute" />
-  <Target Name="BeforeSubstitute" />
-  <Target Name="AfterSubstitute" />
-  <Target Name="CoreSubstitute" Condition=" '@(Substitute)' != '' ">
-    <CreateItem Include="$(SrcDir)\%(Substitute.RelativeDir)%(FileName)%(Extension)">
-      <Output TaskParameter="Include" ItemName="_SubstSourceFiles" />
-    </CreateItem>
-    <CreateItem Include="%(Substitute.RelativeDir)%(FileName)">
-      <Output TaskParameter="Include" ItemName="_SubstDestFiles" />
-    </CreateItem>
-    <Substitute SourceFiles="@(_SubstSourceFiles)" DestinationFiles="@(_SubstDestFiles)" Substitutions="@(Substitution)" />
-  </Target>
+  <Import Project="$(MSBuildThisFileDirectory)\X.Substitute.targets" />
   
-  <!-- Translate -->
-  <Target Name="Translate" DependsOnTargets="BeforeTranslate;CoreTranslate;AfterTranslate" />
-  <Target Name="BeforeTranslate" />
-  <Target Name="AfterTranslate" />
-  <Target Name="CoreTranslate" Condition=" '@(Translate)' != '' ">
-    <Exec Command="LC_ALL=C $(IntlToolMerge) -d -u -c $(PoBuildDir)\.intltool-merge-cache $(PoSrcDir) $(SrcDir)\%(Translate.RelativeDir)%(FileName)%(Extension) %(RelativeDir)%(FileName)" />
-  </Target>
-  
-  <!-- Compile translations -->
-  <Target Name="GettextCompile" Condition=" '@(GettextCompile)' != '' ">
-    <Exec Command="$(MsgFmt) -o %(FileName).gmo $(PoSrcDir)\@(GettextCompile)" />
-  </Target>
+  <!-- Translate and Compile translations -->
+  <Import Project="$(MSBuildThisFileDirectory)\X.Translate.targets" />
   
   <!-- Build -->
   <!-- Switch between regular targets and alternative targets -->
diff --git a/build/X.Substitute.targets b/build/X.Substitute.targets
new file mode 100644
index 0000000..d27dc19
--- /dev/null
+++ b/build/X.Substitute.targets
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <Target Name="Substitute" DependsOnTargets="BeforeSubstitute;CoreSubstitute;AfterSubstitute" />
+  <Target Name="BeforeSubstitute" />
+  <Target Name="AfterSubstitute" />
+  
+  <Target Name="CoreSubstitute" Condition=" '@(Substitute)' != '' ">
+    <CreateItem Include="$(SrcDir)\%(Substitute.RelativeDir)%(FileName)%(Extension)">
+      <Output TaskParameter="Include" ItemName="_SubstSourceFiles" />
+    </CreateItem>
+    <CreateItem Include="%(Substitute.RelativeDir)%(FileName)">
+      <Output TaskParameter="Include" ItemName="_SubstDestFiles" />
+    </CreateItem>
+    <Substitute SourceFiles="@(_SubstSourceFiles)" DestinationFiles="@(_SubstDestFiles)" Substitutions="@(Substitution)" />
+  </Target>
+</Project>
diff --git a/build/X.Translate.targets b/build/X.Translate.targets
new file mode 100644
index 0000000..6f85ec0
--- /dev/null
+++ b/build/X.Translate.targets
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <Target Name="Translate" DependsOnTargets="BeforeTranslate;CoreTranslate;AfterTranslate" />
+  <Target Name="BeforeTranslate" />
+  <Target Name="AfterTranslate" />
+  
+  <Target Name="CoreTranslate" Condition=" '@(Translate)' != '' ">
+    <Exec Command="LC_ALL=C $(IntlToolMerge) -d -u -c $(PoBuildDir)\.intltool-merge-cache $(PoSrcDir) $(SrcDir)\%(Translate.RelativeDir)%(FileName)%(Extension) %(RelativeDir)%(FileName)" />
+  </Target>
+  
+  <Target Name="GettextCompile" Condition=" '@(GettextCompile)' != '' ">
+    <Exec Command="$(MsgFmt) -o %(FileName).gmo $(PoSrcDir)\@(GettextCompile)" />
+  </Target>
+</Project>
diff --git a/build/build.csproj b/build/build.csproj
index 9a39d0f..f64fc48 100644
--- a/build/build.csproj
+++ b/build/build.csproj
@@ -84,12 +84,17 @@
     </Proj>
     <Proj Include="X.CSharp.targets" />
     <Proj Include="X.Common.targets" />
+    <Proj Include="X.Substitute.targets" />
+    <Proj Include="X.Translate.targets" />
   </ItemGroup>
   <ItemGroup>
     <None Include="build.csproj" />
     <None Include="..\src\MonoMac.Tasque\MonoMac.Tasque.csproj">
       <Link>MonoMac.Tasque.csproj</Link>
     </None>
+    <None Include="..\Makefile.am">
+      <Link>Makefile.am</Link>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Addins\" />



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]