[tasque/transition: 133/213] Add bin script generation to build
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/transition: 133/213] Add bin script generation to build
- Date: Wed, 29 Aug 2012 18:45:12 +0000 (UTC)
commit e76916efd1ebed3f1c56f3177f75571a62c6e690
Author: Antonius Riha <antoniusriha gmail com>
Date: Fri Aug 17 22:10:08 2012 +0200
Add bin script generation to build
build/BuildBinScript.cs | 60 ++++++++++++++++++++++++++++++++++++++++++++++
build/build.csproj | 8 ++++++
build/tasque.in | 3 ++
src/Tasque.Gtk/tasque | 3 --
src/Tasque.Gtk/tasque.in | 3 --
5 files changed, 71 insertions(+), 6 deletions(-)
---
diff --git a/build/BuildBinScript.cs b/build/BuildBinScript.cs
new file mode 100644
index 0000000..7d27e60
--- /dev/null
+++ b/build/BuildBinScript.cs
@@ -0,0 +1,60 @@
+//
+// BuildBinScript.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.IO;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Tasque.Build
+{
+ public class BuildBinScript : Task
+ {
+ [Required]
+ public ITaskItem Prefix { get; set; }
+
+ [Required]
+ public ITaskItem BinScriptIn { get; set; }
+
+ public override bool Execute ()
+ {
+ try {
+ var text = File.ReadAllText (BinScriptIn.GetMetadata ("FullPath"));
+ text = text.Replace ("@prefix@", Prefix.ItemSpec);
+
+ var dirPath = Path.Combine (Prefix.ItemSpec, "bin");
+ if (!Directory.Exists (dirPath))
+ Directory.CreateDirectory (dirPath);
+
+ var path = Path.Combine (dirPath, "tasque");
+ File.WriteAllText (path, text);
+ } catch (Exception ex) {
+ Log.LogErrorFromException (ex, true);
+ return false;
+ }
+ return true;
+ }
+ }
+}
diff --git a/build/build.csproj b/build/build.csproj
index 5801f13..3ed870f 100644
--- a/build/build.csproj
+++ b/build/build.csproj
@@ -31,6 +31,7 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<UsingTask AssemblyFile="bin\Tasque.Build.dll" TaskName="Tasque.Build.SetDataAtBuildTime" />
<UsingTask AssemblyFile="bin\Tasque.Build.dll" TaskName="Tasque.Build.LoadGitSubmodules" />
+ <UsingTask AssemblyFile="bin\Tasque.Build.dll" TaskName="Tasque.Build.BuildBinScript" />
<UsingTask AssemblyFile="bin\Tasque.Build.dll" TaskName="Tasque.Build.CheckPrefix" />
<ItemGroup>
<None Include="build.csproj" />
@@ -97,6 +98,7 @@
<ItemGroup>
<Compile Include="SetDataAtBuildTime.cs" />
<Compile Include="LoadGitSubmodules.cs" />
+ <Compile Include="BuildBinScript.cs" />
<Compile Include="CheckPrefix.cs" />
</ItemGroup>
<ItemGroup>
@@ -112,6 +114,9 @@
</Authors>
</ItemGroup>
<ItemGroup>
+ <BinScriptIn Include="tasque.in" />
+ </ItemGroup>
+ <ItemGroup>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="System" />
@@ -126,6 +131,9 @@
<Message Text="Load submodules..." />
<LoadGitSubmodules SolutionDirectory="$(MSBuildProjectDirectory)\.." />
<Message Text="Finished loading submodules." />
+ <Message Text="Installing bin script..." />
+ <BuildBinScript Prefix="$(Prefix)" BinScriptIn="@(BinScriptIn)" />
+ <Message Text="Finished installing bin script." />
</Target>
<ProjectExtensions>
<MonoDevelop>
diff --git a/build/tasque.in b/build/tasque.in
new file mode 100644
index 0000000..cfc62e4
--- /dev/null
+++ b/build/tasque.in
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exec -a "Tasque" mono "@prefix@/lib/tasque/tasque.exe" "$@"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]