Skip to content

Commit 72a0578

Browse files
authored
Merge pull request #50 from am11/feature/simplify-build
Avoid copy file when building libsass
2 parents 24931d9 + 16b8f1c commit 72a0578

File tree

5 files changed

+51
-70
lines changed

5 files changed

+51
-70
lines changed

LibSass.NET.Tests/LibSass.NET.Tests.csproj

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,26 @@
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>LibSass.Tests</RootNamespace>
1212
<AssemblyName>LibSass.NET.Tests</AssemblyName>
13-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14+
<OutputPath>bin\$(Configuration)\</OutputPath>
15+
<IntermediateOutputPath>bin\$(Configuration)\obj\</IntermediateOutputPath>
16+
<ErrorReport>prompt</ErrorReport>
17+
<WarningLevel>4</WarningLevel>
18+
<Prefer32Bit>false</Prefer32Bit>
19+
<PlatformTarget>AnyCPU</PlatformTarget>
1420
<FileAlignment>512</FileAlignment>
15-
<TargetFrameworkProfile />
21+
<LibSassPath>$(SolutionDir)\bin\$(Configuration)\</LibSassPath>
1622
</PropertyGroup>
1723
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1824
<DebugSymbols>true</DebugSymbols>
1925
<DebugType>full</DebugType>
2026
<Optimize>false</Optimize>
21-
<OutputPath>bin\Debug\</OutputPath>
2227
<DefineConstants>DEBUG;TRACE</DefineConstants>
23-
<ErrorReport>prompt</ErrorReport>
24-
<WarningLevel>4</WarningLevel>
25-
<Prefer32Bit>false</Prefer32Bit>
26-
<PlatformTarget>AnyCPU</PlatformTarget>
2728
</PropertyGroup>
2829
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2930
<DebugType>pdbonly</DebugType>
3031
<Optimize>true</Optimize>
31-
<OutputPath>bin\Release\</OutputPath>
3232
<DefineConstants>TRACE</DefineConstants>
33-
<ErrorReport>prompt</ErrorReport>
34-
<WarningLevel>4</WarningLevel>
35-
<Prefer32Bit>false</Prefer32Bit>
36-
<PlatformTarget>x64</PlatformTarget>
3733
</PropertyGroup>
3834
<ItemGroup>
3935
<Reference Include="System" />
@@ -119,13 +115,10 @@
119115
</PropertyGroup>
120116
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
121117
</Target>
122-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
123-
Other similar extension points exist, see Microsoft.Common.targets.
124-
<Target Name="BeforeBuild">
125-
</Target>
126-
-->
127118
<Target Name="AfterBuild">
128-
<Copy SourceFiles="$(SolutionDir)$(OutDir)\libsass32.dll" DestinationFolder="$(TargetDir)" />
129-
<Copy SourceFiles="$(SolutionDir)$(OutDir)\libsass64.dll" DestinationFolder="$(TargetDir)" />
119+
<Copy
120+
SourceFiles="$(LibSassPath)libsass32.dll;$(LibSassPath)libsass64.dll"
121+
DestinationFolder="$(OutputPath)"
122+
SkipUnchangedFiles="true" />
130123
</Target>
131124
</Project>

LibSass.NET/LibSass.NET.csproj

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="14.0" DefaultTargets="Build;CopyLibSass" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,27 +10,24 @@
1010
<RootNamespace>LibSass</RootNamespace>
1111
<AssemblyName>LibSass.NET</AssemblyName>
1212
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<OutputPath>$(SolutionDir)bin\$(Configuration)\</OutputPath>
14+
<IntermediateOutputPath>$(SolutionDir)bin\$(Configuration)\obj\</IntermediateOutputPath>
15+
<ErrorReport>prompt</ErrorReport>
16+
<WarningLevel>4</WarningLevel>
17+
<Prefer32Bit>false</Prefer32Bit>
18+
<PlatformTarget>AnyCPU</PlatformTarget>
1319
<FileAlignment>512</FileAlignment>
1420
</PropertyGroup>
1521
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1622
<DebugSymbols>true</DebugSymbols>
1723
<DebugType>full</DebugType>
1824
<Optimize>false</Optimize>
19-
<OutputPath>$(SolutionDir)bin\Debug\</OutputPath>
20-
<IntermediateOutputPath>$(SolutionDir)bin\Debug\obj\</IntermediateOutputPath>
2125
<DefineConstants>DEBUG;TRACE</DefineConstants>
22-
<ErrorReport>prompt</ErrorReport>
23-
<WarningLevel>4</WarningLevel>
24-
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
2526
</PropertyGroup>
2627
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2728
<DebugType>pdbonly</DebugType>
2829
<Optimize>true</Optimize>
29-
<OutputPath>$(SolutionDir)bin\Release\</OutputPath>
30-
<IntermediateOutputPath>$(SolutionDir)bin\Release\obj\</IntermediateOutputPath>
3130
<DefineConstants>TRACE</DefineConstants>
32-
<ErrorReport>prompt</ErrorReport>
33-
<WarningLevel>4</WarningLevel>
3431
</PropertyGroup>
3532
<ItemGroup>
3633
<Compile Include="Compiler\Context\FunctionHandling.cs" />
@@ -77,12 +74,8 @@
7774
</ItemGroup>
7875
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7976
<!-- Build LibSass -->
80-
<Target Name="CopyLibSass" DependsOnTargets="BuildLibSass">
81-
<Copy SourceFiles="$(OutDir)x86\libsass.dll" DestinationFiles="$(OutDir)libsass32.dll" />
82-
<Copy SourceFiles="$(OutDir)x64\libsass.dll" DestinationFiles="$(OutDir)libsass64.dll" />
83-
</Target>
84-
<Target Name="BuildLibSass">
85-
<MSBuild Targets="Build" Projects="..\LibSass\win\libsass.sln" BuildInParallel="true" Properties="Configuration=$(Configuration);Platform=Win32;OutDir=$(OutDir)x86\;IntDir=$(OutDir)x86\" />
86-
<MSBuild Targets="Build" Projects="..\LibSass\win\libsass.sln" BuildInParallel="true" Properties="Configuration=$(Configuration);Platform=Win64;OutDir=$(OutDir)x64\;IntDir=$(OutDir)x64\" />
77+
<Target Name="AfterBuild">
78+
<MSBuild Targets="Build" Projects="..\LibSass\win\libsass.sln" BuildInParallel="true" Properties="Configuration=$(Configuration);Platform=Win32;TargetName=libsass32;OutDir=$(OutputPath);IntDir=$(IntermediateOutputPath)" />
79+
<MSBuild Targets="Build" Projects="..\LibSass\win\libsass.sln" BuildInParallel="true" Properties="Configuration=$(Configuration);Platform=Win64;TargetName=libsass64;OutDir=$(OutputPath);IntDir=$(IntermediateOutputPath)" />
8780
</Target>
8881
</Project>

contrib/LibSass.NET.Console/LibSass.NET.Console.csproj

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,28 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>LibSass.Console</RootNamespace>
1111
<AssemblyName>LibSass.NET.Console</AssemblyName>
12-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<OutputPath>bin\$(Configuration)\</OutputPath>
14+
<IntermediateOutputPath>bin\$(Configuration)\obj\</IntermediateOutputPath>
15+
<ErrorReport>prompt</ErrorReport>
16+
<WarningLevel>4</WarningLevel>
17+
<Prefer32Bit>false</Prefer32Bit>
18+
<PlatformTarget>AnyCPU</PlatformTarget>
1319
<FileAlignment>512</FileAlignment>
14-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
15-
<TargetFrameworkProfile />
20+
<LibSassPath>$(SolutionDir)\bin\$(Configuration)\</LibSassPath>
1621
</PropertyGroup>
1722
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1823
<PlatformTarget>AnyCPU</PlatformTarget>
1924
<DebugSymbols>true</DebugSymbols>
2025
<DebugType>full</DebugType>
2126
<Optimize>false</Optimize>
22-
<OutputPath>bin\Debug\</OutputPath>
2327
<DefineConstants>DEBUG;TRACE</DefineConstants>
24-
<ErrorReport>prompt</ErrorReport>
25-
<WarningLevel>4</WarningLevel>
26-
<Prefer32Bit>false</Prefer32Bit>
2728
</PropertyGroup>
2829
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2930
<PlatformTarget>AnyCPU</PlatformTarget>
3031
<DebugType>pdbonly</DebugType>
3132
<Optimize>true</Optimize>
32-
<OutputPath>bin\Release\</OutputPath>
3333
<DefineConstants>TRACE</DefineConstants>
34-
<ErrorReport>prompt</ErrorReport>
35-
<WarningLevel>4</WarningLevel>
36-
<Prefer32Bit>false</Prefer32Bit>
3734
</PropertyGroup>
3835
<ItemGroup>
3936
<Reference Include="System" />
@@ -52,13 +49,10 @@
5249
</ProjectReference>
5350
</ItemGroup>
5451
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
55-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
56-
Other similar extension points exist, see Microsoft.Common.targets.
57-
<Target Name="BeforeBuild">
58-
</Target>
59-
-->
6052
<Target Name="AfterBuild">
61-
<Copy SourceFiles="$(SolutionDir)$(OutDir)\libsass32.dll" DestinationFolder="$(TargetDir)" />
62-
<Copy SourceFiles="$(SolutionDir)$(OutDir)\libsass64.dll" DestinationFolder="$(TargetDir)" />
53+
<Copy
54+
SourceFiles="$(LibSassPath)libsass32.dll;$(LibSassPath)libsass64.dll"
55+
DestinationFolder="$(OutputPath)"
56+
SkipUnchangedFiles="true" />
6357
</Target>
6458
</Project>

contrib/LibSass.NET.Console/Program.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ namespace LibSass.Console
99
{
1010
public class Program
1111
{
12-
public static void Main()
12+
public static void Main(string[] args)
1313
{
1414
OutputEncoding = Encoding.Unicode;
1515

16-
const string inputPath = "test.scss";
16+
string inputPath = args.Length > 0 ? args[0] : "test.scss";
1717

1818
if (!File.Exists(inputPath))
1919
{
20-
WriteLine($"Input file '{inputPath}' does not exist.");
20+
WriteLine($"Input file '{inputPath}' does not exist.\n\nPress any key to continue..");
2121
ReadKey();
2222
return;
2323
}
@@ -150,7 +150,10 @@ public static void Main()
150150

151151
var sass = new SassCompiler(sassOptions);
152152
var result = sass.Compile();
153+
153154
WriteLine(result.ToString());
155+
WriteLine("\n\nPress any key to continue..");
156+
154157
ReadKey();
155158
}
156159

contrib/LibSass.NET.Web/LibSass.NET.Web.csproj

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@
1010
<RootNamespace>LibSass.Web</RootNamespace>
1111
<AssemblyName>LibSass.NET.Web</AssemblyName>
1212
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<OutputPath>bin\$(Configuration)\</OutputPath>
14+
<IntermediateOutputPath>bin\$(Configuration)\obj\</IntermediateOutputPath>
15+
<ErrorReport>prompt</ErrorReport>
16+
<WarningLevel>4</WarningLevel>
17+
<Prefer32Bit>false</Prefer32Bit>
18+
<PlatformTarget>AnyCPU</PlatformTarget>
1319
<FileAlignment>512</FileAlignment>
20+
<LibSassPath>$(SolutionDir)\bin\$(Configuration)\</LibSassPath>
1421
</PropertyGroup>
1522
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1623
<DebugSymbols>true</DebugSymbols>
1724
<DebugType>full</DebugType>
1825
<Optimize>false</Optimize>
19-
<OutputPath>bin\Debug\</OutputPath>
2026
<DefineConstants>DEBUG;TRACE</DefineConstants>
21-
<ErrorReport>prompt</ErrorReport>
22-
<WarningLevel>4</WarningLevel>
2327
</PropertyGroup>
2428
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2529
<DebugType>pdbonly</DebugType>
2630
<Optimize>true</Optimize>
27-
<OutputPath>bin\Release\</OutputPath>
2831
<DefineConstants>TRACE</DefineConstants>
29-
<ErrorReport>prompt</ErrorReport>
30-
<WarningLevel>4</WarningLevel>
3132
</PropertyGroup>
3233
<ItemGroup>
3334
<Reference Include="System" />
@@ -55,13 +56,10 @@
5556
<None Include="web.config.transform" />
5657
</ItemGroup>
5758
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
59-
Other similar extension points exist, see Microsoft.Common.targets.
60-
<Target Name="BeforeBuild">
61-
</Target>
62-
-->
6359
<Target Name="AfterBuild">
64-
<Copy SourceFiles="$(SolutionDir)$(OutDir)\libsass32.dll" DestinationFolder="$(TargetDir)" />
65-
<Copy SourceFiles="$(SolutionDir)$(OutDir)\libsass64.dll" DestinationFolder="$(TargetDir)" />
60+
<Copy
61+
SourceFiles="$(LibSassPath)libsass32.dll;$(LibSassPath)libsass64.dll"
62+
DestinationFolder="$(OutputPath)"
63+
SkipUnchangedFiles="true" />
6664
</Target>
6765
</Project>

0 commit comments

Comments
 (0)