<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>
	
	<ItemGroup>
		<DocFileItem
			Include="$(DocumentationFile)"
			Condition="'$(DocumentationFile)'!=''">
			
			<InProject>false</InProject>
		</DocFileItem>
	</ItemGroup>
	
	<PropertyGroup>
		<CoreCompileDependsOn>
		_ComputeNonExistentFileProperty
		</CoreCompileDependsOn>
	</PropertyGroup>
	
	<PropertyGroup Condition=" '$(BoocToolPath)' != '' ">
		<ReferencePath>$(ReferencePath);$(BoocToolPath)</ReferencePath>
	</PropertyGroup>
	<PropertyGroup Condition=" '$(BoocToolPath)' == '' ">
		<ReferencePath>$(ReferencePath);$(BooBinPath)</ReferencePath>
	</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)"
		/>
		
		<Copy
			Condition=" '$(BoocToolPath)' == '' "
			SkipUnchangedFiles="true"
			SourceFiles="$(BooBinPath)\Boo.Lang.dll"
			DestinationFolder="$(OutputPath)"/>
		
		<Copy
			Condition=" '$(BoocToolPath)' != '' "
			SkipUnchangedFiles="true"
			SourceFiles="$(BoocToolPath)\Boo.Lang.dll"
			DestinationFolder="$(OutputPath)"/>
	</Target>
	
	<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />
</Project>
