Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3652 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
9 changed files with 0 additions and 771 deletions
@ -1,25 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Robert Pickering" email="robert@strangelights.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System.Reflection; |
|
||||||
|
|
||||||
// Information about this assembly is defined by the following
|
|
||||||
// attributes.
|
|
||||||
//
|
|
||||||
// change them to the information which is associated with the assembly
|
|
||||||
// you compile.
|
|
||||||
|
|
||||||
[assembly: System.Runtime.InteropServices.ComVisible(false)] |
|
||||||
[assembly: AssemblyTitle("FSharp.Build.Tasks")] |
|
||||||
[assembly: AssemblyDescription("Provides F# build tasks for the F# addin.")] |
|
||||||
[assembly: AssemblyConfiguration("")] |
|
||||||
[assembly: AssemblyTrademark("")] |
|
||||||
[assembly: AssemblyCulture("")] |
|
||||||
[assembly: AssemblyCompany("ic#code")] |
|
||||||
[assembly: AssemblyProduct("SharpDevelop")] |
|
||||||
[assembly: AssemblyCopyright("2000-2008 AlphaSierraPapa")] |
|
||||||
[assembly: AssemblyVersion("1.0")] |
|
||||||
@ -1,67 +0,0 @@ |
|||||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
||||||
<PropertyGroup> |
|
||||||
<ProjectGuid>{674D485B-8340-498D-B91F-BE51543386C8}</ProjectGuid> |
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
||||||
<OutputType>Library</OutputType> |
|
||||||
<RootNamespace>FSharp.Build.Tasks</RootNamespace> |
|
||||||
<AssemblyName>FSharp.Build.Tasks</AssemblyName> |
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
|
||||||
<NoStdLib>False</NoStdLib> |
|
||||||
<WarningLevel>4</WarningLevel> |
|
||||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
|
||||||
<OutputPath>..\..\RequiredLibraries</OutputPath> |
|
||||||
<DebugSymbols>true</DebugSymbols> |
|
||||||
<DebugType>Full</DebugType> |
|
||||||
<Optimize>False</Optimize> |
|
||||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|
||||||
<OutputPath>..\..\RequiredLibraries</OutputPath> |
|
||||||
<DebugSymbols>false</DebugSymbols> |
|
||||||
<DebugType>None</DebugType> |
|
||||||
<Optimize>True</Optimize> |
|
||||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
|
||||||
<DefineConstants>TRACE</DefineConstants> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
|
||||||
<RegisterForComInterop>False</RegisterForComInterop> |
|
||||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
|
||||||
<BaseAddress>4194304</BaseAddress> |
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||||
<FileAlignment>4096</FileAlignment> |
|
||||||
</PropertyGroup> |
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
|
||||||
<ItemGroup> |
|
||||||
<Reference Include="Microsoft.Build.Framework"> |
|
||||||
<Private>False</Private> |
|
||||||
</Reference> |
|
||||||
<Reference Include="Microsoft.Build.Tasks"> |
|
||||||
<Private>False</Private> |
|
||||||
</Reference> |
|
||||||
<Reference Include="Microsoft.Build.Utilities" /> |
|
||||||
<Reference Include="System"> |
|
||||||
<Private>False</Private> |
|
||||||
</Reference> |
|
||||||
<Reference Include="System.Configuration"> |
|
||||||
<Private>False</Private> |
|
||||||
</Reference> |
|
||||||
<Reference Include="System.Xml"> |
|
||||||
<Private>False</Private> |
|
||||||
</Reference> |
|
||||||
</ItemGroup> |
|
||||||
<ItemGroup> |
|
||||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
|
||||||
<Compile Include="Src\CompilerCommandLineBuilder.cs" /> |
|
||||||
<Compile Include="Src\Fsc.cs" /> |
|
||||||
<Compile Include="Src\FscToolLocationHelper.cs" /> |
|
||||||
<Compile Include="Src\IsFscInstalled.cs" /> |
|
||||||
<None Include="SharpDevelop.Build.Fsc.targets"> |
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|
||||||
</None> |
|
||||||
</ItemGroup> |
|
||||||
</Project> |
|
||||||
@ -1,161 +0,0 @@ |
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
||||||
<UsingTask TaskName="FSharp.Build.Tasks.Fsc" AssemblyFile="FSharp.Build.Tasks.dll" /> |
|
||||||
<UsingTask TaskName="FSharp.Build.Tasks.IsFscInstalled" AssemblyFile="FSharp.Build.Tasks.dll" /> |
|
||||||
<UsingTask TaskName="CreateCSharpManifestResourceName" AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
|
||||||
<UsingTask TaskName="Copy" AssemblyName="Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> |
|
||||||
|
|
||||||
<PropertyGroup> |
|
||||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(FSharpBuildTasksPath)\SharpDevelop.Build.Fsc.targets</MSBuildAllProjects> |
|
||||||
<DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension> |
|
||||||
<Language>F#</Language> |
|
||||||
<CheckIfFscNotInstalled Condition=" '$(CheckIfFscNotInstalled)' == '' ">False</CheckIfFscNotInstalled> |
|
||||||
<FscInstalled>True</FscInstalled> |
|
||||||
</PropertyGroup> |
|
||||||
|
|
||||||
<PropertyGroup> |
|
||||||
<CreateManifestResourceNamesDependsOn> |
|
||||||
</CreateManifestResourceNamesDependsOn> |
|
||||||
</PropertyGroup> |
|
||||||
<Target Name="CreateManifestResourceNames" Condition="'@(ResxWithNoCulture)@(ResxWithCulture)@(NonResxWithNoCulture)@(NonResxWithCulture)'!=''" DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"> |
|
||||||
<!-- Create the target resource names for non-culture resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(ResxWithNoCulture)'!=''" ResourceFiles="@(ResxWithNoCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestResourceWithNoCultureName" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
|
|
||||||
<!-- Create the target resource names for culture resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(ResxWithCulture)'!=''" ResourceFiles="@(ResxWithCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestResourceWithCultureName" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
|
|
||||||
<!-- Create the target resource names for non-culture non-resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(NonResxWithNoCulture)'!=''" ResourceFiles="@(NonResxWithNoCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestNonResxWithNoCulture" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
|
|
||||||
<!-- Create the target resource names for culture non-resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(NonResxWithCulture)'!=''" ResourceFiles="@(NonResxWithCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestNonResxWithCulture" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="CoreCompile" Inputs="$(MSBuildAllProjects); |
|
||||||
@(Compile); |
|
||||||
@(ReferencePath); |
|
||||||
@(ManifestResourceWithNoCulture); |
|
||||||
$(ApplicationIcon); |
|
||||||
$(AssemblyOriginatorKeyFile); |
|
||||||
@(ManifestNonResxWithNoCultureOnDisk); |
|
||||||
@(ReferencePath); |
|
||||||
@(CompiledLicenseFile); |
|
||||||
$(Standalone); |
|
||||||
$(NoMLLib)" |
|
||||||
Outputs="@(DocFileItem); |
|
||||||
@(IntermediateAssembly); |
|
||||||
$(NonExistentFile)" |
|
||||||
DependsOnTargets="$(CoreCompileDependsOn)"> |
|
||||||
<Fsc |
|
||||||
Condition=" '$(FscInstalled)' == 'True' " |
|
||||||
DebugType="$(DebugType)" |
|
||||||
EmitDebugInformation="$(DebugSymbols)" |
|
||||||
FileAlignment="$(FileAlignment)" |
|
||||||
KeyContainer="$(KeyContainerName)" |
|
||||||
KeyFile="$(KeyOriginatorFile)" |
|
||||||
Optimize="$(Optimize)" |
|
||||||
OutputAssembly="@(IntermediateAssembly)" |
|
||||||
Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile)" |
|
||||||
Sources="@(Compile)" |
|
||||||
References="@(ReferencePath)" |
|
||||||
TargetType="$(OutputType)" |
|
||||||
Standalone="$(Standalone)" |
|
||||||
NoMLLib="$(NoMLLib)" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" /> |
|
||||||
|
|
||||||
<!-- |
|
||||||
Check if F# is installed. |
|
||||||
--> |
|
||||||
<Target Name="BeforeBuild"> |
|
||||||
<CallTarget Targets="IfFscInstalled" /> |
|
||||||
</Target> |
|
||||||
<Target Name="BeforeClean"> |
|
||||||
<CallTarget Targets="IfFscInstalled" /> |
|
||||||
</Target> |
|
||||||
<Target Name="BeforeRebuild"> |
|
||||||
<CallTarget Targets="IfFscInstalled" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="IfFscInstalled"> |
|
||||||
<Message Text="Checking if F# is installed." Condition=" '$(CheckIfFscNotInstalled)' == 'True' "/> |
|
||||||
|
|
||||||
<!-- Check if F# is installed --> |
|
||||||
<IsFscInstalled Condition=" '$(CheckIfFscNotInstalled)' == 'True' "> |
|
||||||
<Output TaskParameter="IsInstalled" PropertyName="FscInstalled"/> |
|
||||||
</IsFscInstalled> |
|
||||||
|
|
||||||
<Warning Code="FSC1001" Text="Unable to find the F# compiler (fsi.exe). The F# addin will not be compiled." Condition=" '$(FscInstalled)' == 'False' and '$(CheckIfFscNotInstalled)' == 'True' " /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<!-- Override CopyFilesToOutputDirectory so if the F# compiler is not installed there are |
|
||||||
no errors when trying to copy non-existent files. --> |
|
||||||
<Target |
|
||||||
Name="CopyFilesToOutputDirectory" |
|
||||||
DependsOnTargets=" |
|
||||||
ComputeIntermediateSatelliteAssemblies; |
|
||||||
_CopyFilesMarkedCopyLocal; |
|
||||||
_CopySourceItemsToOutputDirectory; |
|
||||||
_CopyAppConfigFile; |
|
||||||
_CopyManifestFiles; |
|
||||||
_CheckForCompileOutputs; |
|
||||||
_SGenCheckForOutputs"> |
|
||||||
|
|
||||||
<!-- Copy the build product (.dll or .exe). --> |
|
||||||
<Copy Condition=" '$(FscInstalled)' == 'True' " |
|
||||||
SourceFiles="@(IntermediateAssembly)" |
|
||||||
DestinationFolder="$(OutDir)" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/> |
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
|
|
||||||
<Message Importance="High" Text="$(MSBuildProjectName) -> @(MainAssembly->'%(FullPath)')" /> |
|
||||||
|
|
||||||
<!-- Copy the debug information file (.pdb), if any --> |
|
||||||
<Copy |
|
||||||
SourceFiles="@(_DebugSymbolsIntermediatePath)" |
|
||||||
DestinationFiles="@(_DebugSymbolsOutputPath)" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" |
|
||||||
Condition="'$(FscInstalled)' == 'True' and '$(_DebugSymbolsProduced)'=='true' and '$(SkipCopyingSymbolsToOutputDirectory)' != 'true'"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
|
|
||||||
<!-- Copy the resulting XML documentation file, if any. --> |
|
||||||
<Copy |
|
||||||
SourceFiles="@(DocFileItem)" |
|
||||||
DestinationFiles="@(FinalDocFile)" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" |
|
||||||
Condition="'$(FscInstalled)' == 'True' and '$(_DocumentationFileProduced)'=='true'"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
|
|
||||||
<!-- Copy satellite assemblies. --> |
|
||||||
<Copy Condition=" '$(FscInstalled)' == 'True' " |
|
||||||
SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)" |
|
||||||
DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(OutDir)%(Culture)\$(TargetName).resources.dll')" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
</Target> |
|
||||||
</Project> |
|
||||||
@ -1,41 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Globalization; |
|
||||||
using System.IO; |
|
||||||
|
|
||||||
using Microsoft.Build.Framework; |
|
||||||
using Microsoft.Build.Utilities; |
|
||||||
using Microsoft.Build.Tasks; |
|
||||||
|
|
||||||
namespace FSharp.Build.Tasks |
|
||||||
{ |
|
||||||
public class CompilerCommandLineBuilder : CommandLineBuilder |
|
||||||
{ |
|
||||||
public void AppendIntegerSwitch(string switchName, int value) |
|
||||||
{ |
|
||||||
AppendSwitchUnquotedIfNotNull(switchName, value.ToString(NumberFormatInfo.InvariantInfo)); |
|
||||||
} |
|
||||||
|
|
||||||
public void AppendFileNameIfNotNull(string switchName, ITaskItem fileItem) |
|
||||||
{ |
|
||||||
if (fileItem != null) { |
|
||||||
AppendFileNameIfNotNull(switchName, fileItem.ItemSpec); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void AppendFileNameIfNotNull(string switchName, string fileName) |
|
||||||
{ |
|
||||||
if (fileName != null) { |
|
||||||
AppendSpaceIfNotEmpty(); |
|
||||||
AppendTextUnquoted(switchName); |
|
||||||
AppendFileNameWithQuoting(fileName); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,220 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Robert Pickering" email="robert@strangelights.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.IO; |
|
||||||
using System.CodeDom.Compiler; |
|
||||||
using System.Globalization; |
|
||||||
using Microsoft.Build.Framework; |
|
||||||
using Microsoft.Build.Utilities; |
|
||||||
using Microsoft.Build.Tasks; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Text.RegularExpressions; |
|
||||||
|
|
||||||
namespace FSharp.Build.Tasks |
|
||||||
{ |
|
||||||
public sealed class Fsc : ToolTask |
|
||||||
{ |
|
||||||
string keyContainer; |
|
||||||
string keyFile; |
|
||||||
int fileAlignment; |
|
||||||
bool standalone; |
|
||||||
bool noMLLib; |
|
||||||
ITaskItem[] sources; |
|
||||||
ITaskItem[] resources; |
|
||||||
ITaskItem[] references; |
|
||||||
ITaskItem outputAssembly; |
|
||||||
string debugType; |
|
||||||
bool emitDebugInformation; |
|
||||||
string targetType; |
|
||||||
bool optimize; |
|
||||||
|
|
||||||
public int FileAlignment { |
|
||||||
get { return fileAlignment; } |
|
||||||
set { fileAlignment = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public string KeyContainer { |
|
||||||
get { return keyContainer; } |
|
||||||
set { keyContainer = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public string KeyFile { |
|
||||||
get { return keyFile; } |
|
||||||
set { keyFile = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public bool Standalone { |
|
||||||
get { return standalone; } |
|
||||||
set { standalone = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public bool NoMLLib { |
|
||||||
get { return noMLLib; } |
|
||||||
set { noMLLib = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public string DebugType { |
|
||||||
get { return debugType; } |
|
||||||
set { debugType = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public bool EmitDebugInformation { |
|
||||||
get { return emitDebugInformation; } |
|
||||||
set { emitDebugInformation = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public ITaskItem[] Sources { |
|
||||||
get { return sources; } |
|
||||||
set { sources = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public ITaskItem[] References { |
|
||||||
get { return references; } |
|
||||||
set { references = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public ITaskItem[] Resources { |
|
||||||
get { return resources; } |
|
||||||
set { resources = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public bool Optimize { |
|
||||||
get { return optimize; } |
|
||||||
set { optimize = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public ITaskItem OutputAssembly { |
|
||||||
get { return outputAssembly; } |
|
||||||
set { outputAssembly = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public string TargetType { |
|
||||||
get { return targetType; } |
|
||||||
set { targetType = value; } |
|
||||||
} |
|
||||||
|
|
||||||
protected override string ToolName { |
|
||||||
get { return "fsc.exe"; } |
|
||||||
} |
|
||||||
|
|
||||||
protected override string GenerateFullPathToTool() |
|
||||||
{ |
|
||||||
return FscToolLocationHelper.GetPathToTool(); |
|
||||||
} |
|
||||||
|
|
||||||
protected override string GenerateCommandLineCommands() |
|
||||||
{ |
|
||||||
CompilerCommandLineBuilder commandLine = new CompilerCommandLineBuilder(); |
|
||||||
if (((OutputAssembly == null) && (Sources != null)) && ((Sources.Length > 0))) { |
|
||||||
OutputAssembly = new TaskItem(Path.GetFileNameWithoutExtension(this.Sources[0].ItemSpec)); |
|
||||||
if (string.Equals(this.TargetType, "library", StringComparison.InvariantCultureIgnoreCase)) { |
|
||||||
OutputAssembly.ItemSpec += ".dll"; |
|
||||||
} else if (string.Equals(this.TargetType, "module", StringComparison.InvariantCultureIgnoreCase)) { |
|
||||||
OutputAssembly.ItemSpec += ".netmodule"; |
|
||||||
} else { |
|
||||||
OutputAssembly.ItemSpec += ".exe"; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
commandLine.AppendSwitch("-g"); |
|
||||||
|
|
||||||
if (Optimize) { |
|
||||||
commandLine.AppendSwitch("-O3"); |
|
||||||
} |
|
||||||
|
|
||||||
commandLine.AppendSwitchIfNotNull("--keyfile ", this.KeyFile); |
|
||||||
|
|
||||||
if (noMLLib) { |
|
||||||
commandLine.AppendSwitch("--no-mllib"); |
|
||||||
} |
|
||||||
|
|
||||||
if (standalone) { |
|
||||||
commandLine.AppendSwitch("--standalone"); |
|
||||||
} |
|
||||||
|
|
||||||
if (Resources != null) { |
|
||||||
foreach (ITaskItem item in Resources) { |
|
||||||
commandLine.AppendSwitchIfNotNull("--resource ", item); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (FileAlignment > 0) { |
|
||||||
commandLine.AppendIntegerSwitch("--base-address ", FileAlignment); |
|
||||||
} |
|
||||||
|
|
||||||
commandLine.AppendSwitchIfNotNull("-o ", this.OutputAssembly); |
|
||||||
|
|
||||||
if (string.Equals(this.TargetType, "library", StringComparison.InvariantCultureIgnoreCase)) { |
|
||||||
commandLine.AppendSwitch("--target-dll"); |
|
||||||
} else if (string.Equals(this.TargetType, "winexe", StringComparison.InvariantCultureIgnoreCase)) { |
|
||||||
commandLine.AppendSwitch("--target-winexe"); |
|
||||||
} else if (string.Equals(this.TargetType, "module", StringComparison.InvariantCultureIgnoreCase)) { |
|
||||||
commandLine.AppendSwitch("--target-module"); |
|
||||||
} |
|
||||||
|
|
||||||
if (References != null) { |
|
||||||
foreach (ITaskItem reference in References) { |
|
||||||
commandLine.AppendFileNameIfNotNull("-r ", reference); |
|
||||||
} |
|
||||||
} |
|
||||||
commandLine.AppendFileNamesIfNotNull(this.Sources, " "); |
|
||||||
return commandLine.ToString(); |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Each line of output, from either standard output or standard error
|
|
||||||
/// is parsed and any compiler errors are logged. If the line cannot
|
|
||||||
/// be parsed it is logged using the specified message importance.
|
|
||||||
/// </summary>
|
|
||||||
protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance) |
|
||||||
{ |
|
||||||
CompilerError error = ParseLine(singleLine); |
|
||||||
if (error != null) { |
|
||||||
if (error.IsWarning) { |
|
||||||
Log.LogWarning("warning", error.ErrorNumber, null, error.FileName, error.Line, error.Column, error.Line, error.Column, error.ErrorText); |
|
||||||
} else { |
|
||||||
Log.LogError("error", error.ErrorNumber, null, error.FileName, error.Line, error.Column, error.Line, error.Column, error.ErrorText); |
|
||||||
} |
|
||||||
} else { |
|
||||||
Log.LogMessage(messageImportance, singleLine); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
const string ErrorPattern = @"(?<file>[^\(]*)\((?<line>[0-9]*),(?<column>[0-9]*)\):\s(?<error>[^:]*):\s(?<number>[^:]*):\s(?<message>.*)"; |
|
||||||
static Regex ErrorRegex = new Regex(ErrorPattern, RegexOptions.Compiled); |
|
||||||
const string ErrorPatternNoLine = @"(?<file>[^\(]*)\((?<line>[0-9]*),(?<column>[0-9]*)\):\s(?<error>[^:]*):\s(?<message>.*)"; |
|
||||||
static Regex ErrorNoLineRegex = new Regex(ErrorPatternNoLine, RegexOptions.Compiled); |
|
||||||
|
|
||||||
CompilerError ParseLine(string line) |
|
||||||
{ |
|
||||||
Match match = ErrorRegex.Match(line); |
|
||||||
Match matchNoLine = ErrorNoLineRegex.Match(line); |
|
||||||
if (match.Success) { |
|
||||||
CompilerError error = new CompilerError(); |
|
||||||
error.Column = Int32.Parse(match.Result("${column}")); |
|
||||||
error.Line = Int32.Parse(match.Result("${line}")); |
|
||||||
error.FileName = Path.GetFullPath(match.Result("${file}")); |
|
||||||
error.IsWarning = match.Result("${error}") == "warning"; |
|
||||||
error.ErrorNumber = match.Result("${number}"); |
|
||||||
error.ErrorText = match.Result("${message}"); |
|
||||||
return error; |
|
||||||
} else if (matchNoLine.Success) { |
|
||||||
CompilerError error = new CompilerError(); |
|
||||||
error.Column = Int32.Parse(matchNoLine.Result("${column}")); |
|
||||||
error.Line = Int32.Parse(matchNoLine.Result("${line}")); |
|
||||||
error.FileName = Path.GetFullPath(matchNoLine.Result("${file}")); |
|
||||||
error.IsWarning = matchNoLine.Result("${error}") == "warning"; |
|
||||||
error.ErrorNumber = matchNoLine.Result("${number}"); |
|
||||||
error.ErrorText = matchNoLine.Result("${message}"); |
|
||||||
return error; |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,62 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Robert Pickering" email="robert@strangelights.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Configuration; |
|
||||||
using System.IO; |
|
||||||
|
|
||||||
namespace FSharp.Build.Tasks |
|
||||||
{ |
|
||||||
public sealed class FscToolLocationHelper |
|
||||||
{ |
|
||||||
public static readonly string ToolName = "fsc.exe"; |
|
||||||
|
|
||||||
FscToolLocationHelper() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
public static string GetPathToTool() |
|
||||||
{ |
|
||||||
string path = null; |
|
||||||
if (Array.Exists<string>(ConfigurationManager.AppSettings.AllKeys, delegate(string k) { return k == "alt_fs_bin_path"; })) { |
|
||||||
path = Path.Combine(ConfigurationManager.AppSettings["alt_fs_bin_path"], ToolName); |
|
||||||
if (!File.Exists(path)) { |
|
||||||
throw new Exception("you are trying to use the app setting alt_fs_bin_path, but fsc.exe is not localed in the given directory"); |
|
||||||
} |
|
||||||
} else { |
|
||||||
string[] paths = Environment.GetEnvironmentVariable("path").Split(';'); |
|
||||||
path = Array.Find(paths, delegate(string x) { |
|
||||||
bool res = false; |
|
||||||
try { |
|
||||||
res = File.Exists(Path.Combine(x, "fsc.exe")); |
|
||||||
} catch { |
|
||||||
res = false; |
|
||||||
} |
|
||||||
return res; |
|
||||||
}); |
|
||||||
if (path != null) { |
|
||||||
path = Path.Combine(path, ToolName); |
|
||||||
} else { |
|
||||||
string[] dirs = Directory.GetDirectories(Environment.GetEnvironmentVariable("ProgramFiles"), "FSharp*"); |
|
||||||
List<FileInfo> files = new List<FileInfo>(); |
|
||||||
foreach (string dir in dirs) { |
|
||||||
FileInfo file = new FileInfo(Path.Combine(Path.Combine(dir, "bin"), ToolName)); |
|
||||||
if (file.Exists) { |
|
||||||
files.Add(file); |
|
||||||
} |
|
||||||
} |
|
||||||
if (files.Count > 0) { |
|
||||||
files.Sort(delegate(FileInfo x, FileInfo y) { return DateTime.Compare(x.CreationTime, y.CreationTime); }); |
|
||||||
path = files[0].FullName; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return path; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,36 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using Microsoft.Build.Framework; |
|
||||||
using Microsoft.Build.Utilities; |
|
||||||
using Microsoft.Build.Tasks; |
|
||||||
|
|
||||||
namespace FSharp.Build.Tasks |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Tasks that determines if the F# compiler is installed.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class IsFscInstalled : Task |
|
||||||
{ |
|
||||||
bool installed; |
|
||||||
|
|
||||||
[Output] |
|
||||||
public bool IsInstalled { |
|
||||||
get { return installed; } |
|
||||||
set { installed = value; } |
|
||||||
} |
|
||||||
|
|
||||||
public override bool Execute() |
|
||||||
{ |
|
||||||
if (FscToolLocationHelper.GetPathToTool() != null) { |
|
||||||
installed = true; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
Binary file not shown.
@ -1,159 +0,0 @@ |
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
||||||
<UsingTask TaskName="FSharp.Build.Tasks.Fsc" AssemblyFile="FSharp.Build.Tasks.dll" /> |
|
||||||
<UsingTask TaskName="FSharp.Build.Tasks.IsFscInstalled" AssemblyFile="FSharp.Build.Tasks.dll" /> |
|
||||||
<UsingTask TaskName="CreateCSharpManifestResourceName" AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
|
||||||
<UsingTask TaskName="Copy" AssemblyName="Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> |
|
||||||
|
|
||||||
<PropertyGroup> |
|
||||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(FSharpBuildTasksPath)\SharpDevelop.Build.Fsc.targets</MSBuildAllProjects> |
|
||||||
<DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension> |
|
||||||
<Language>F#</Language> |
|
||||||
<CheckIfFscNotInstalled Condition=" '$(CheckIfFscNotInstalled)' == '' ">False</CheckIfFscNotInstalled> |
|
||||||
<FscInstalled>True</FscInstalled> |
|
||||||
</PropertyGroup> |
|
||||||
|
|
||||||
<PropertyGroup> |
|
||||||
<CreateManifestResourceNamesDependsOn> |
|
||||||
</CreateManifestResourceNamesDependsOn> |
|
||||||
</PropertyGroup> |
|
||||||
<Target Name="CreateManifestResourceNames" Condition="'@(ResxWithNoCulture)@(ResxWithCulture)@(NonResxWithNoCulture)@(NonResxWithCulture)'!=''" DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"> |
|
||||||
<!-- Create the target resource names for non-culture resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(ResxWithNoCulture)'!=''" ResourceFiles="@(ResxWithNoCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestResourceWithNoCultureName" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
|
|
||||||
<!-- Create the target resource names for culture resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(ResxWithCulture)'!=''" ResourceFiles="@(ResxWithCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestResourceWithCultureName" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
|
|
||||||
<!-- Create the target resource names for non-culture non-resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(NonResxWithNoCulture)'!=''" ResourceFiles="@(NonResxWithNoCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestNonResxWithNoCulture" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
|
|
||||||
<!-- Create the target resource names for culture non-resx files. --> |
|
||||||
<CreateCSharpManifestResourceName Condition="'@(NonResxWithCulture)'!=''" ResourceFiles="@(NonResxWithCulture)" RootNamespace="$(RootNamespace)"> |
|
||||||
<Output TaskParameter="ManifestResourceNames" ItemName="ManifestNonResxWithCulture" /> |
|
||||||
</CreateCSharpManifestResourceName> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="CoreCompile" Inputs="$(MSBuildAllProjects); |
|
||||||
@(Compile); |
|
||||||
@(ReferencePath); |
|
||||||
@(ManifestResourceWithNoCulture); |
|
||||||
$(ApplicationIcon); |
|
||||||
$(AssemblyOriginatorKeyFile); |
|
||||||
@(ManifestNonResxWithNoCultureOnDisk); |
|
||||||
@(ReferencePath); |
|
||||||
@(CompiledLicenseFile)" |
|
||||||
Outputs="@(DocFileItem); |
|
||||||
@(IntermediateAssembly); |
|
||||||
$(NonExistentFile)" |
|
||||||
DependsOnTargets="$(CoreCompileDependsOn)"> |
|
||||||
<Fsc |
|
||||||
Condition=" '$(FscInstalled)' == 'True' " |
|
||||||
DebugType="$(DebugType)" |
|
||||||
EmitDebugInformation="$(DebugSymbols)" |
|
||||||
FileAlignment="$(FileAlignment)" |
|
||||||
KeyContainer="$(KeyContainerName)" |
|
||||||
KeyFile="$(KeyOriginatorFile)" |
|
||||||
Optimize="$(Optimize)" |
|
||||||
OutputAssembly="@(IntermediateAssembly)" |
|
||||||
Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile)" |
|
||||||
Sources="@(Compile)" |
|
||||||
References="@(ReferencePath)" |
|
||||||
TargetType="$(OutputType)" |
|
||||||
Standalone="$(Standalone)" |
|
||||||
NoMLLib="$(NoMLLib)" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" /> |
|
||||||
|
|
||||||
<!-- |
|
||||||
Check if F# is installed. |
|
||||||
--> |
|
||||||
<Target Name="BeforeBuild"> |
|
||||||
<CallTarget Targets="IfFscInstalled" /> |
|
||||||
</Target> |
|
||||||
<Target Name="BeforeClean"> |
|
||||||
<CallTarget Targets="IfFscInstalled" /> |
|
||||||
</Target> |
|
||||||
<Target Name="BeforeRebuild"> |
|
||||||
<CallTarget Targets="IfFscInstalled" /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<Target Name="IfFscInstalled"> |
|
||||||
<Message Text="Checking if F# is installed." Condition=" '$(CheckIfFscNotInstalled)' == 'True' "/> |
|
||||||
|
|
||||||
<!-- Check if F# is installed --> |
|
||||||
<IsFscInstalled Condition=" '$(CheckIfFscNotInstalled)' == 'True' "> |
|
||||||
<Output TaskParameter="IsInstalled" PropertyName="FscInstalled"/> |
|
||||||
</IsFscInstalled> |
|
||||||
|
|
||||||
<Warning Code="FSC1001" Text="Unable to find the F# compiler (fsi.exe). The F# addin will not be compiled." Condition=" '$(FscInstalled)' == 'False' and '$(CheckIfFscNotInstalled)' == 'True' " /> |
|
||||||
</Target> |
|
||||||
|
|
||||||
<!-- Override CopyFilesToOutputDirectory so if the F# compiler is not installed there are |
|
||||||
no errors when trying to copy non-existent files. --> |
|
||||||
<Target |
|
||||||
Name="CopyFilesToOutputDirectory" |
|
||||||
DependsOnTargets=" |
|
||||||
ComputeIntermediateSatelliteAssemblies; |
|
||||||
_CopyFilesMarkedCopyLocal; |
|
||||||
_CopySourceItemsToOutputDirectory; |
|
||||||
_CopyAppConfigFile; |
|
||||||
_CopyManifestFiles; |
|
||||||
_CheckForCompileOutputs; |
|
||||||
_SGenCheckForOutputs"> |
|
||||||
|
|
||||||
<!-- Copy the build product (.dll or .exe). --> |
|
||||||
<Copy Condition=" '$(FscInstalled)' == 'True' " |
|
||||||
SourceFiles="@(IntermediateAssembly)" |
|
||||||
DestinationFolder="$(OutDir)" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/> |
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
|
|
||||||
<Message Importance="High" Text="$(MSBuildProjectName) -> @(MainAssembly->'%(FullPath)')" /> |
|
||||||
|
|
||||||
<!-- Copy the debug information file (.pdb), if any --> |
|
||||||
<Copy |
|
||||||
SourceFiles="@(_DebugSymbolsIntermediatePath)" |
|
||||||
DestinationFiles="@(_DebugSymbolsOutputPath)" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" |
|
||||||
Condition="'$(FscInstalled)' == 'True' and '$(_DebugSymbolsProduced)'=='true' and '$(SkipCopyingSymbolsToOutputDirectory)' != 'true'"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
|
|
||||||
<!-- Copy the resulting XML documentation file, if any. --> |
|
||||||
<Copy |
|
||||||
SourceFiles="@(DocFileItem)" |
|
||||||
DestinationFiles="@(FinalDocFile)" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" |
|
||||||
Condition="'$(FscInstalled)' == 'True' and '$(_DocumentationFileProduced)'=='true'"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
|
|
||||||
<!-- Copy satellite assemblies. --> |
|
||||||
<Copy Condition=" '$(FscInstalled)' == 'True' " |
|
||||||
SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)" |
|
||||||
DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(OutDir)%(Culture)\$(TargetName).resources.dll')" |
|
||||||
SkipUnchangedFiles="true" |
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"> |
|
||||||
|
|
||||||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/> |
|
||||||
|
|
||||||
</Copy> |
|
||||||
</Target> |
|
||||||
</Project> |
|
||||||
Loading…
Reference in new issue