blob: 55f224a94fedc2ebe9a3019ce0731b9141285524 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Text.RegularExpressions;
using System.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.CPPTasks;
using Microsoft.Build.Utilities;
namespace NaCl.Build.CPPTasks
{
public class NaClLib : NaClToolTask
{
[Required]
public string LibrarianToolPath { get; set; }
[Required]
public string PropertiesFile { get; set; }
public NaClLib()
: base(new ResourceManager("NaCl.Build.CPPTasks.Properties.Resources", Assembly.GetExecutingAssembly()))
{
this.EnvironmentVariables = new string[] { "CYGWIN=nodosfilewarning", "LC_CTYPE=C" };
}
protected override string GenerateResponseFileCommands()
{
StringBuilder responseFileCmds = new StringBuilder(GCCUtilities.s_CommandLineLength);
responseFileCmds.Append("rcs ");
responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(OutputFile));
foreach (ITaskItem item in Sources)
{
responseFileCmds.Append(" ");
responseFileCmds.Append(GCCUtilities.ConvertPathWindowsToPosix(item.ToString()));
}
return responseFileCmds.ToString();
}
public override bool Execute()
{
if (!Setup())
return false;
return base.Execute();
}
protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
{
if (OutputCommandLine)
Log.LogMessage(MessageImportance.High, pathToTool + " " + responseFileCommands);
return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
}
protected override Encoding ResponseFileEncoding
{
get
{
return Encoding.ASCII;
}
}
protected override string ToolName
{
get
{
return LibrarianToolPath;
}
}
}
}