Browse Source
Boo.Microsoft.Build.Tasks now can embed .resource files. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@620 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
20 changed files with 876 additions and 39 deletions
@ -0,0 +1,41 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>Boo.Microsoft.Build.Tasks</RootNamespace> |
||||||
|
<AssemblyName>Boo.Microsoft.Build.Tasks</AssemblyName> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<ProjectGuid>{366B4AFE-C4E9-46DF-9CFF-57C62D414D4A}</ProjectGuid> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<OutputPath>bin\Debug\</OutputPath> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<DebugSymbols>True</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<OutputPath>bin\Release\</OutputPath> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
||||||
|
<Reference Include="Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
||||||
|
<Reference Include="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Booc.boo" /> |
||||||
|
<Compile Include="Properties\AssemblyInfo.boo" /> |
||||||
|
<Compile Include="CreateBooManifestResourceName.boo" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Content Include="Project.booproj" /> |
||||||
|
<Content Include="Boo.Microsoft.Build.targets"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</Content> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(BooBinPath)\Boo.Microsoft.Build.targets" /> |
||||||
|
</Project> |
@ -0,0 +1,212 @@ |
|||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
|
||||||
|
<UsingTask |
||||||
|
TaskName="Microsoft.Build.Tasks.CreateBooManifestResourceName" |
||||||
|
AssemblyFile="Boo.Microsoft.Build.Tasks.dll" /> |
||||||
|
|
||||||
|
<UsingTask |
||||||
|
TaskName="Boo.Microsoft.Build.Tasks.Booc" |
||||||
|
AssemblyFile="Boo.Microsoft.Build.Tasks.dll"/> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<MSBuildAllProjects Condition="'$(BoocToolPath)' != ''"> |
||||||
|
$(MSBuildAllProjects);$(BoocToolPath)\Boo.Microsoft.Build.targets |
||||||
|
</MSBuildAllProjects> |
||||||
|
<MSBuildAllProjects Condition="'$(BoocToolPath)' == ''"> |
||||||
|
$(MSBuildAllProjects);$(MSBuildBinPath)\Boo.Microsoft.Build.targets |
||||||
|
</MSBuildAllProjects> |
||||||
|
<DefaultLanguageSourceExtension>.boo</DefaultLanguageSourceExtension> |
||||||
|
<Language>Boo</Language> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<!-- |
||||||
|
The CreateManifestResourceNames target create the manifest resource names |
||||||
|
from the .RESX files. |
||||||
|
|
||||||
|
[IN] |
||||||
|
@(ResxWithNoCulture) - The names the non-culture .RESX files. |
||||||
|
@(ResxWithCulture) - The names the culture .RESX files. |
||||||
|
@(NonResxWithNoCulture) - The names of the non-culture non-RESX |
||||||
|
files (like bitmaps, etc). |
||||||
|
|
||||||
|
@(NonResxWithCulture) - The names of the culture non-RESX |
||||||
|
files (like bitmaps, etc). |
||||||
|
|
||||||
|
[OUT] |
||||||
|
@(ManifestResourceWithNoCultureName) - The corresponding manifest |
||||||
|
resource name (.RESOURCE) |
||||||
|
|
||||||
|
@(ManifestResourceWithCultureName) - The corresponding manifest |
||||||
|
resource name (.RESOURCE) |
||||||
|
|
||||||
|
@(ManifestNonResxWithNoCulture) - The corresponding manifest |
||||||
|
resource name. |
||||||
|
|
||||||
|
@(ManifestNonResxWithCulture) - The corresponding manifest |
||||||
|
resource name. |
||||||
|
|
||||||
|
For Boo applications the transformation is like: |
||||||
|
|
||||||
|
Resources1.resx => RootNamespace.Resources1 => Build into main assembly |
||||||
|
|
||||||
|
SubFolder\Resources1.resx => |
||||||
|
RootNamespace.SubFolder.Resources1 => |
||||||
|
Build into main assembly |
||||||
|
|
||||||
|
Resources1.fr.resx => |
||||||
|
RootNamespace.Resources1.fr => |
||||||
|
Build into satellite assembly |
||||||
|
|
||||||
|
Resources1.notaculture.resx => |
||||||
|
RootNamespace.Resources1.notaculture => |
||||||
|
Build into main assembly |
||||||
|
|
||||||
|
For other project systems, this transformation may be different. |
||||||
|
--> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<CreateManifestResourceNamesDependsOn> |
||||||
|
</CreateManifestResourceNamesDependsOn> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<Target |
||||||
|
Name="CreateManifestResourceNames" |
||||||
|
Condition="' |
||||||
|
@(ResxWithNoCulture) |
||||||
|
@(ResxWithCulture) |
||||||
|
@(NonResxWithNoCulture) |
||||||
|
@(NonResxWithCulture)'!=''" |
||||||
|
|
||||||
|
DependsOnTargets="$(CreateManifestResourceNamesDependsOn)" |
||||||
|
> |
||||||
|
|
||||||
|
<!-- Create the target resource names for non-culture resx files --> |
||||||
|
<CreateBooManifestResourceName |
||||||
|
Condition="'@(ResxWithNoCulture)'!=''" |
||||||
|
ResourceFiles="@(ResxWithNoCulture)" |
||||||
|
RootNamespace="$(RootNamespace)"> |
||||||
|
|
||||||
|
<Output |
||||||
|
TaskParameter="ManifestResourceNames" |
||||||
|
ItemName="ManifestResourceWithNoCultureName"/> |
||||||
|
|
||||||
|
</CreateBooManifestResourceName> |
||||||
|
|
||||||
|
<!-- Create the target resource names for culture resx files. --> |
||||||
|
<CreateBooManifestResourceName |
||||||
|
Condition="'@(ResxWithCulture)'!=''" |
||||||
|
ResourceFiles="@(ResxWithCulture)" |
||||||
|
RootNamespace="$(RootNamespace)"> |
||||||
|
|
||||||
|
<Output |
||||||
|
TaskParameter="ManifestResourceNames" |
||||||
|
ItemName="ManifestResourceWithCultureName"/> |
||||||
|
|
||||||
|
</CreateBooManifestResourceName> |
||||||
|
|
||||||
|
<!-- Create the target resource names for non-culture non-resx files. --> |
||||||
|
<CreateBooManifestResourceName |
||||||
|
Condition="'@(NonResxWithNoCulture)'!=''" |
||||||
|
ResourceFiles="@(NonResxWithNoCulture)" |
||||||
|
RootNamespace="$(RootNamespace)"> |
||||||
|
|
||||||
|
<Output |
||||||
|
TaskParameter="ManifestResourceNames" |
||||||
|
ItemName="ManifestNonResxWithNoCulture"/> |
||||||
|
|
||||||
|
</CreateBooManifestResourceName> |
||||||
|
|
||||||
|
<!-- Create the target resource names for culture non-resx files. --> |
||||||
|
<CreateBooManifestResourceName |
||||||
|
Condition="'@(NonResxWithCulture)'!=''" |
||||||
|
ResourceFiles="@(NonResxWithCulture)" |
||||||
|
RootNamespace="$(RootNamespace)"> |
||||||
|
|
||||||
|
<Output |
||||||
|
TaskParameter="ManifestResourceNames" |
||||||
|
ItemName="ManifestNonResxWithCulture"/> |
||||||
|
|
||||||
|
</CreateBooManifestResourceName> |
||||||
|
</Target> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
|
||||||
|
<!-- |
||||||
|
"None" is not technically a valid DebugType, so we can't pass it |
||||||
|
in as such to the compiler. So here, we modify the properties so |
||||||
|
they make sense. |
||||||
|
--> |
||||||
|
<DebugSymbols Condition="'$(DebugType)' == 'none'">false</DebugSymbols> |
||||||
|
<DebugType Condition="'$(DebugType)' == 'none'"></DebugType> |
||||||
|
|
||||||
|
<!-- Provide a facility to override UseHostCompilerIfAvailable--> |
||||||
|
<UseHostCompilerIfAvailable |
||||||
|
Condition="'$(UseHostCompilerIfAvailable)' == ''"> |
||||||
|
true |
||||||
|
</UseHostCompilerIfAvailable> |
||||||
|
|
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<!-- |
||||||
|
These two compiler warnings are raised when a reference is bound to |
||||||
|
a different version than specified in the assembly reference version |
||||||
|
number. MSBuild raises the same warning in this case, so the compiler |
||||||
|
warning would be redundant. |
||||||
|
--> |
||||||
|
<PropertyGroup Condition="'$(TargetFrameworkVersion)' != 'v1.0'"> |
||||||
|
<NoWarn Condition="'$(NoWarn)' != ''">$(NoWarn);</NoWarn> |
||||||
|
<NoWarn>$(NoWarn)1701;1702</NoWarn> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<DocFileItem |
||||||
|
Include="$(DocumentationFile)" |
||||||
|
Condition="'$(DocumentationFile)'!=''"> |
||||||
|
|
||||||
|
<InProject>false</InProject> |
||||||
|
</DocFileItem> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<CoreCompileDependsOn> |
||||||
|
_ComputeNonExistentFileProperty |
||||||
|
</CoreCompileDependsOn> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<Target |
||||||
|
Name="CoreCompile" |
||||||
|
Inputs="$(MSBuildAllProjects); |
||||||
|
@(Compile); |
||||||
|
@(ManifestResourceWithNoCulture); |
||||||
|
$(ApplicationIcon); |
||||||
|
$(AssemblyOriginatorKeyFile); |
||||||
|
@(ManifestNonResxWithNoCultureOnDisk); |
||||||
|
@(ReferencePath); |
||||||
|
@(CompiledLicenseFile)" |
||||||
|
Outputs="@(DocFileItem); |
||||||
|
@(IntermediateAssembly); |
||||||
|
$(NonExistentFile)" |
||||||
|
DependsOnTargets="$(CoreCompileDependsOn)" |
||||||
|
> |
||||||
|
|
||||||
|
<Booc |
||||||
|
OutputAssembly="@(IntermediateAssembly)" |
||||||
|
References="@(ReferencePath)" |
||||||
|
Resources= " |
||||||
|
@(ManifestResourceWithNoCulture); |
||||||
|
@(ManifestNonResxWithNoCultureOnDisk); |
||||||
|
@(CompiledLicenseFile)" |
||||||
|
ResponseFiles="$(CompilerResponseFile)" |
||||||
|
Sources="@(Compile)" |
||||||
|
TargetType="$(OutputType)" |
||||||
|
ToolPath="$(BoocToolPath)" |
||||||
|
Pipelines="@(Pipeline)" |
||||||
|
Verbosity="$(BoocVerbosity)" |
||||||
|
Culture="$(AssemblyCulture)" |
||||||
|
SourceDirectory="$(SourceDirectory)" |
||||||
|
/> |
||||||
|
|
||||||
|
</Target> |
||||||
|
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" /> |
||||||
|
</Project> |
@ -0,0 +1,354 @@ |
|||||||
|
#region license |
||||||
|
// Copyright (c) 2003, 2004, 2005 Rodrigo B. de Oliveira (rbo@acm.org) |
||||||
|
// All rights reserved. |
||||||
|
// |
||||||
|
// Redistribution and use in source and binary forms, with or without modification, |
||||||
|
// are permitted provided that the following conditions are met: |
||||||
|
// |
||||||
|
// * Redistributions of source code must retain the above copyright notice, |
||||||
|
// this list of conditions and the following disclaimer. |
||||||
|
// * Redistributions in binary form must reproduce the above copyright notice, |
||||||
|
// this list of conditions and the following disclaimer in the documentation |
||||||
|
// and/or other materials provided with the distribution. |
||||||
|
// * Neither the name of Rodrigo B. de Oliveira nor the names of its |
||||||
|
// contributors may be used to endorse or promote products derived from this |
||||||
|
// software without specific prior written permission. |
||||||
|
// |
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
||||||
|
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||||
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||||
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||||||
|
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
#endregion |
||||||
|
|
||||||
|
namespace Boo.Microsoft.Build.Tasks |
||||||
|
|
||||||
|
import Microsoft.Build.Framework |
||||||
|
import Microsoft.Build.Tasks |
||||||
|
import Microsoft.Build.Utilities |
||||||
|
import System |
||||||
|
import System.Diagnostics |
||||||
|
import System.IO |
||||||
|
import System.Globalization |
||||||
|
import System.Text.RegularExpressions |
||||||
|
import System.Threading |
||||||
|
|
||||||
|
class Booc(ManagedCompiler): |
||||||
|
""" |
||||||
|
Represents the Boo compiler MSBuild task. |
||||||
|
|
||||||
|
Authors: |
||||||
|
Sorin Ionescu (sorin.ionescu@gmail.com) |
||||||
|
""" |
||||||
|
Pipelines: |
||||||
|
""" |
||||||
|
Gets/sets the aditional pipelines to add to the compiler process. |
||||||
|
""" |
||||||
|
get: |
||||||
|
return Bag['Pipelines'] as (string) |
||||||
|
set: |
||||||
|
Bag['Pipelines'] = value |
||||||
|
|
||||||
|
Verbosity: |
||||||
|
""" |
||||||
|
Gets/sets the verbosity level. |
||||||
|
""" |
||||||
|
get: |
||||||
|
return Bag['Verbosity'] as string |
||||||
|
set: |
||||||
|
Bag['Verbosity'] = value |
||||||
|
|
||||||
|
Culture: |
||||||
|
""" |
||||||
|
Gets/sets the culture. |
||||||
|
""" |
||||||
|
get: |
||||||
|
return Bag['Culture'] as string |
||||||
|
set: |
||||||
|
Bag['Culture'] = value |
||||||
|
|
||||||
|
SourceDirectory: |
||||||
|
""" |
||||||
|
Gets/sets the source directory. |
||||||
|
""" |
||||||
|
get: |
||||||
|
return Bag['Source Directory'] as string |
||||||
|
set: |
||||||
|
Bag['Source Directory'] = value |
||||||
|
|
||||||
|
ToolName: |
||||||
|
""" |
||||||
|
Gets the tool name. |
||||||
|
""" |
||||||
|
get: |
||||||
|
return "Booc.exe" |
||||||
|
|
||||||
|
override def Execute(): |
||||||
|
""" |
||||||
|
Executes the task. |
||||||
|
|
||||||
|
Returns: |
||||||
|
true if the task completed successfully; otherwise, false. |
||||||
|
""" |
||||||
|
boocCommandLine = CommandLineBuilderExtension() |
||||||
|
AddResponseFileCommands(boocCommandLine) |
||||||
|
|
||||||
|
warningPattern = regex( |
||||||
|
'^(?<file>.*?)\\((?<line>\\d+),(?<column>\\d+)\\):' + |
||||||
|
' (?<code>BCW\\d{4}): WARNING: (?<message>.*)$', |
||||||
|
RegexOptions.Compiled) |
||||||
|
# Captures the file, line, column, code, and message from a BOO warning |
||||||
|
# in the form of: Program.boo(1,1): BCW0000: WARNING: This is a warning. |
||||||
|
|
||||||
|
errorPattern = regex( |
||||||
|
'^(((?<file>.*?)\\((?<line>\\d+),(?<column>\\d+)\\): )?' + |
||||||
|
'(?<code>BCE\\d{4})|(?<errorType>Fatal) error):' + |
||||||
|
'( Boo.Lang.Compiler.CompilerError:)?' + |
||||||
|
' (?<message>.*?)($| --->)', |
||||||
|
RegexOptions.Compiled | |
||||||
|
RegexOptions.ExplicitCapture | |
||||||
|
RegexOptions.Multiline) |
||||||
|
/* |
||||||
|
* Captures the file, line, column, code, error type, and message from a |
||||||
|
* BOO error of the form of: |
||||||
|
* 1. Program.boo(1,1): BCE0000: This is an error. |
||||||
|
* 2. Program.boo(1,1): BCE0000: Boo.Lang.Compiler.CompilerError: |
||||||
|
* This is an error. ---> Program.boo:4:19: This is an error |
||||||
|
* 3. BCE0000: This is an error. |
||||||
|
* 4. Fatal error: This is an error. |
||||||
|
* |
||||||
|
* The second line of the following error format is not cought because |
||||||
|
* .NET does not support if|then|else in regular expressions, |
||||||
|
* and the regex will be horrible complicated. |
||||||
|
* The second line is as worthless as the first line. |
||||||
|
* Therefore, it is not worth implementing it. |
||||||
|
* |
||||||
|
* Fatal error: This is an error. |
||||||
|
* Parameter name: format. |
||||||
|
*/ |
||||||
|
|
||||||
|
buildSuccess = true |
||||||
|
outputLine = String.Empty |
||||||
|
errorLine = String.Empty |
||||||
|
readingDoneEvents = (ManualResetEvent(false), ManualResetEvent(false)) |
||||||
|
|
||||||
|
boocProcessStartInfo = ProcessStartInfo( |
||||||
|
FileName: GenerateFullPathToTool(), |
||||||
|
Arguments: boocCommandLine.ToString(), |
||||||
|
ErrorDialog: false, |
||||||
|
CreateNoWindow: true, |
||||||
|
RedirectStandardError: true, |
||||||
|
RedirectStandardInput: false, |
||||||
|
RedirectStandardOutput: true, |
||||||
|
UseShellExecute: false) |
||||||
|
|
||||||
|
boocProcess = Process(StartInfo: boocProcessStartInfo) |
||||||
|
|
||||||
|
parseOutput = def(line as string): |
||||||
|
warningPatternMatch = warningPattern.Match(line) |
||||||
|
errorPatternMatch = errorPattern.Match(line) |
||||||
|
|
||||||
|
if warningPatternMatch.Success: |
||||||
|
Log.LogWarning( |
||||||
|
null, |
||||||
|
warningPatternMatch.Groups['code'].Value, |
||||||
|
null, |
||||||
|
warningPatternMatch.Groups['file'].Value, |
||||||
|
int.Parse(warningPatternMatch.Groups['line'].Value), |
||||||
|
int.Parse(warningPatternMatch.Groups['column'].Value), |
||||||
|
0, |
||||||
|
0, |
||||||
|
warningPatternMatch.Groups['message'].Value) |
||||||
|
|
||||||
|
elif errorPatternMatch.Success: |
||||||
|
code = errorPatternMatch.Groups['code'].Value |
||||||
|
code = 'BCE0000' if string.IsNullOrEmpty(code) |
||||||
|
file = errorPatternMatch.Groups['file'].Value |
||||||
|
file = 'BOOC' if string.IsNullOrEmpty(file) |
||||||
|
|
||||||
|
try: |
||||||
|
lineNumber = int.Parse( |
||||||
|
errorPatternMatch.Groups['line'].Value, |
||||||
|
NumberStyles.Integer) |
||||||
|
|
||||||
|
except FormatException: |
||||||
|
lineNumber = 0 |
||||||
|
|
||||||
|
try: |
||||||
|
columnNumber = int.Parse( |
||||||
|
errorPatternMatch.Groups['column'].Value, |
||||||
|
NumberStyles.Integer) |
||||||
|
|
||||||
|
except FormatException: |
||||||
|
columnNumber = 0 |
||||||
|
|
||||||
|
Log.LogError( |
||||||
|
errorPatternMatch.Groups['errorType'].Value.ToLower(), |
||||||
|
code, |
||||||
|
null, |
||||||
|
file, |
||||||
|
lineNumber, |
||||||
|
columnNumber, |
||||||
|
0, |
||||||
|
0, |
||||||
|
errorPatternMatch.Groups['message'].Value) |
||||||
|
|
||||||
|
buildSuccess = false |
||||||
|
|
||||||
|
else: |
||||||
|
Log.LogMessage(MessageImportance.Low, line) |
||||||
|
|
||||||
|
readStandardOutput = def(): |
||||||
|
while true: |
||||||
|
outputLine = boocProcess.StandardOutput.ReadLine() |
||||||
|
|
||||||
|
if outputLine: |
||||||
|
parseOutput(outputLine) |
||||||
|
|
||||||
|
else: |
||||||
|
readingDoneEvents[0].Set() |
||||||
|
break |
||||||
|
|
||||||
|
readStandardError = def(): |
||||||
|
while true: |
||||||
|
errorLine = boocProcess.StandardError.ReadLine() |
||||||
|
|
||||||
|
if errorLine: |
||||||
|
parseOutput(errorLine) |
||||||
|
|
||||||
|
else: |
||||||
|
readingDoneEvents[1].Set() |
||||||
|
break |
||||||
|
|
||||||
|
standardOutputReadingThread = Thread(readStandardOutput as ThreadStart) |
||||||
|
standardErrorReadingThread = Thread(readStandardError as ThreadStart) |
||||||
|
# Two threads are required (MSDN); otherwise, a deadlock WILL occur. |
||||||
|
|
||||||
|
try: |
||||||
|
boocProcess.Start() |
||||||
|
|
||||||
|
Log.LogMessage( |
||||||
|
MessageImportance.High, |
||||||
|
"${ToolName} ${boocProcess.StartInfo.Arguments}", |
||||||
|
null) |
||||||
|
|
||||||
|
standardOutputReadingThread.Start() |
||||||
|
standardErrorReadingThread.Start() |
||||||
|
|
||||||
|
WaitHandle.WaitAny((readingDoneEvents[0],)) |
||||||
|
WaitHandle.WaitAny((readingDoneEvents[1],)) |
||||||
|
# MSBuild runs on an STA thread, and WaitHandle.WaitAll() |
||||||
|
# is not supported. |
||||||
|
|
||||||
|
except e as Exception: |
||||||
|
Log.LogErrorFromException(e) |
||||||
|
buildSuccess = false |
||||||
|
|
||||||
|
ensure: |
||||||
|
boocProcess.Close() |
||||||
|
|
||||||
|
return buildSuccess |
||||||
|
|
||||||
|
protected override def AddCommandLineCommands( |
||||||
|
commandLine as CommandLineBuilderExtension): |
||||||
|
""" |
||||||
|
Adds command line commands. |
||||||
|
|
||||||
|
Remarks: |
||||||
|
It prevents <ManagedCompiler> from adding the standard commands. |
||||||
|
""" |
||||||
|
pass |
||||||
|
|
||||||
|
protected override def AddResponseFileCommands( |
||||||
|
commandLine as CommandLineBuilderExtension): |
||||||
|
""" |
||||||
|
Generates the Boo compiler command line. |
||||||
|
|
||||||
|
Returns: |
||||||
|
The Boo compiler command line. |
||||||
|
""" |
||||||
|
commandLine.AppendSwitchIfNotNull('-t:', TargetType) |
||||||
|
commandLine.AppendSwitchIfNotNull('-o:', OutputAssembly) |
||||||
|
commandLine.AppendSwitchIfNotNull('-c:', Culture) |
||||||
|
commandLine.AppendSwitchIfNotNull('-srcdir:', SourceDirectory) |
||||||
|
|
||||||
|
if Pipelines: |
||||||
|
for pipeline in Pipelines: |
||||||
|
commandLine.AppendSwitchIfNotNull('-p:', pipeline) |
||||||
|
|
||||||
|
if References: |
||||||
|
for reference in References: |
||||||
|
commandLine.AppendSwitchIfNotNull('-r:', reference) |
||||||
|
|
||||||
|
if Resources: |
||||||
|
for resource in Resources: |
||||||
|
commandLine.AppendSwitchIfNotNull('-resource:', resource) |
||||||
|
|
||||||
|
if Verbosity: |
||||||
|
if string.Compare( |
||||||
|
Verbosity, |
||||||
|
'Normal', |
||||||
|
StringComparison.InvariantCultureIgnoreCase) == 0: |
||||||
|
pass |
||||||
|
|
||||||
|
elif string.Compare( |
||||||
|
Verbosity, |
||||||
|
'Warning', |
||||||
|
StringComparison.InvariantCultureIgnoreCase) == 0: |
||||||
|
|
||||||
|
commandLine.AppendSwitch('-v') |
||||||
|
|
||||||
|
elif string.Compare( |
||||||
|
Verbosity, |
||||||
|
'Info', |
||||||
|
StringComparison.InvariantCultureIgnoreCase) == 0: |
||||||
|
|
||||||
|
commandLine.AppendSwitch('-vv') |
||||||
|
|
||||||
|
elif string.Compare( |
||||||
|
Verbosity, |
||||||
|
'Verbose', |
||||||
|
StringComparison.InvariantCultureIgnoreCase) == 0: |
||||||
|
|
||||||
|
commandLine.AppendSwitch('-vvv') |
||||||
|
|
||||||
|
else: |
||||||
|
Log.LogErrorWithCodeFromResources( |
||||||
|
'Vbc.EnumParameterHasInvalidValue', |
||||||
|
'Verbosity', |
||||||
|
Verbosity, |
||||||
|
'Normal, Warning, Info, Verbose') |
||||||
|
|
||||||
|
commandLine.AppendFileNamesIfNotNull(Sources, ' ') |
||||||
|
|
||||||
|
protected override def GenerateFullPathToTool(): |
||||||
|
""" |
||||||
|
Generats the full path to booc.exe. |
||||||
|
""" |
||||||
|
toolPath as string = ToolPath |
||||||
|
if toolPath is not null: |
||||||
|
path = Path.Combine(toolPath, ToolName) |
||||||
|
|
||||||
|
if path is null or not File.Exists(path): |
||||||
|
path = Path.Combine( |
||||||
|
Path.GetDirectoryName(typeof(Booc).Assembly.Location), |
||||||
|
ToolName) |
||||||
|
|
||||||
|
unless File.Exists(path): |
||||||
|
path = ToolLocationHelper.GetPathToDotNetFrameworkFile( |
||||||
|
ToolName, |
||||||
|
TargetDotNetFrameworkVersion.Version20) |
||||||
|
|
||||||
|
unless File.Exists(path): |
||||||
|
Log.LogErrorWithCodeFromResources( |
||||||
|
"General.FrameworksFileNotFound", |
||||||
|
ToolName, |
||||||
|
ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix( |
||||||
|
TargetDotNetFrameworkVersion.Version20)) |
||||||
|
|
||||||
|
return path |
@ -0,0 +1,42 @@ |
|||||||
|
#region license |
||||||
|
// Copyright (c) 2003, 2004, 2005 Rodrigo B. de Oliveira (rbo@acm.org) |
||||||
|
// All rights reserved. |
||||||
|
// |
||||||
|
// Redistribution and use in source and binary forms, with or without modification, |
||||||
|
// are permitted provided that the following conditions are met: |
||||||
|
// |
||||||
|
// * Redistributions of source code must retain the above copyright notice, |
||||||
|
// this list of conditions and the following disclaimer. |
||||||
|
// * Redistributions in binary form must reproduce the above copyright notice, |
||||||
|
// this list of conditions and the following disclaimer in the documentation |
||||||
|
// and/or other materials provided with the distribution. |
||||||
|
// * Neither the name of Rodrigo B. de Oliveira nor the names of its |
||||||
|
// contributors may be used to endorse or promote products derived from this |
||||||
|
// software without specific prior written permission. |
||||||
|
// |
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
||||||
|
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||||
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||||
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||||||
|
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
#endregion |
||||||
|
|
||||||
|
namespace Boo.Microsoft.Build.Tasks |
||||||
|
|
||||||
|
import Microsoft.Build.Tasks |
||||||
|
|
||||||
|
class CreateBooManifestResourceName(CreateCSharpManifestResourceName): |
||||||
|
""" |
||||||
|
Creates the manifest resource name. |
||||||
|
|
||||||
|
Authors: |
||||||
|
Sorin Ionescu (sorin.ionescu@gmail.com) |
||||||
|
""" |
||||||
|
def constructor(): |
||||||
|
super() |
||||||
|
|
@ -0,0 +1,67 @@ |
|||||||
|
<Project |
||||||
|
DefaultTargets="Build" |
||||||
|
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<SchemaVersion>2.0</SchemaVersion> |
||||||
|
<ProjectGuid></ProjectGuid> |
||||||
|
|
||||||
|
<!-- OutputType: Exe|WinExe|Library --> |
||||||
|
<OutputType>Exe</OutputType> |
||||||
|
|
||||||
|
<AssemblyName>Company.Project</AssemblyName> |
||||||
|
<RootNamespace>Company.Project</RootNamespace> |
||||||
|
|
||||||
|
<!-- BoocVerbosity: Normal|Warning|Info|Verbose --> |
||||||
|
<BoocVerbosity>Normal</BoocVerbosity> |
||||||
|
|
||||||
|
<!-- Assembly culture. --> |
||||||
|
<AssemblyCulture></AssemblyCulture> |
||||||
|
|
||||||
|
<!-- Source directory. --> |
||||||
|
<SourceDirectory></SourceDirectory> |
||||||
|
|
||||||
|
<!-- |
||||||
|
Set this property if Boo is not installed in the |
||||||
|
.NET Framework directory. |
||||||
|
BoocToolPath: C:\Program Files\Boo\bin |
||||||
|
--> |
||||||
|
<BoocToolPath></BoocToolPath> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<!-- Only debug builds are currently supported. --> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> |
||||||
|
<OutputPath>bin\Debug\</OutputPath> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<!-- FOR FUTURE USE |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> |
||||||
|
<OutputPath>bin\Relase\</OutputPath> |
||||||
|
</PropertyGroup> |
||||||
|
--> |
||||||
|
|
||||||
|
<!-- Additional pipelines to use. --> |
||||||
|
<ItemGroup> |
||||||
|
<Pipeline Include="Pipeline.boo" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<!-- Assembly references. --> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<!-- Files to compile. --> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Program.boo" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<!-- Resources to embed. --> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Resources.resx" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<Import Project="$(BoocToolPath)\Boo.Microsoft.Build.targets" Condition="$(BoocToolPath) != ''" /> |
||||||
|
<Import Project="$(MSBuildBinPath)\Boo.Microsoft.Build.targets" Condition="'$(BoocToolPath)' == ''"/> |
||||||
|
</Project> |
@ -0,0 +1,70 @@ |
|||||||
|
#region license |
||||||
|
// Copyright (c) 2003, 2004, 2005 Rodrigo B. de Oliveira (rbo@acm.org) |
||||||
|
// All rights reserved. |
||||||
|
// |
||||||
|
// Redistribution and use in source and binary forms, with or without modification, |
||||||
|
// are permitted provided that the following conditions are met: |
||||||
|
// |
||||||
|
// * Redistributions of source code must retain the above copyright notice, |
||||||
|
// this list of conditions and the following disclaimer. |
||||||
|
// * Redistributions in binary form must reproduce the above copyright notice, |
||||||
|
// this list of conditions and the following disclaimer in the documentation |
||||||
|
// and/or other materials provided with the distribution. |
||||||
|
// * Neither the name of Rodrigo B. de Oliveira nor the names of its |
||||||
|
// contributors may be used to endorse or promote products derived from this |
||||||
|
// software without specific prior written permission. |
||||||
|
// |
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
||||||
|
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||||
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||||
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||||||
|
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
#endregion |
||||||
|
|
||||||
|
namespace Boo.Microsoft.Build.Tasks.Properties |
||||||
|
""" |
||||||
|
Author: |
||||||
|
Sorin Ionescu (sorin.ionescu@gmail.com) |
||||||
|
""" |
||||||
|
|
||||||
|
import System.Reflection |
||||||
|
import System.Runtime.CompilerServices |
||||||
|
import System.Runtime.InteropServices |
||||||
|
|
||||||
|
# General Information about an assembly is controlled through the following |
||||||
|
# set of attributes. Change these attribute values to modify the information |
||||||
|
# associated with an assembly. |
||||||
|
[assembly: AssemblyTitle('Boo.Microsoft.Build.Tasks')] |
||||||
|
[assembly: AssemblyDescription('Contains Microsoft Build tasks for BOO code.')] |
||||||
|
[assembly: AssemblyConfiguration('')] |
||||||
|
[assembly: AssemblyCompany('')] |
||||||
|
[assembly: AssemblyProduct('Boo.Microsoft.Build.Tasks')] |
||||||
|
[assembly: AssemblyCopyright('Copyright (C) 2005')] |
||||||
|
[assembly: AssemblyTrademark('')] |
||||||
|
[assembly: AssemblyCulture('')] |
||||||
|
|
||||||
|
# Setting ComVisible to false makes the types in this assembly not visible |
||||||
|
# to COM componenets. If you need to access a type in this assembly from |
||||||
|
# COM, set the ComVisible attribute to true on that type. |
||||||
|
[assembly: ComVisible(false)] |
||||||
|
|
||||||
|
# The following GUID is for the ID of the typelib if this project is exposed |
||||||
|
# to COM. |
||||||
|
# [assembly: Guid('')] |
||||||
|
|
||||||
|
# Version information for an assembly consists of the following four values: |
||||||
|
# |
||||||
|
# Major Version |
||||||
|
# Minor Version |
||||||
|
# Build Number |
||||||
|
# Revision |
||||||
|
# |
||||||
|
# You can specify all the values or you can default the Revision and |
||||||
|
# Build Numbers by using the '*' as shown below: |
||||||
|
[assembly: AssemblyVersion('1.0.0.0')] |
||||||
|
[assembly: AssemblyFileVersion('1.0.0.0')] |
Binary file not shown.
Loading…
Reference in new issue