Skip to content

Commit 2967144

Browse files
committed
[Xamarin.Android.Cecil] Fixups for chained MSBuild invocation
Eventually -- sooner rather than later? -- we'd like to support building xamarin-android using `msbuild` instead of `xbuild`. Unfortunately, that doesn't work, for a variety of reasons. Appropos to `Xamarin.Android.Cecil` is that if we, from a *clean* state, build *just* `xamarin-android/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj` without a solution, the build fails because `Xamarin.Android.Cecil.dll` and `Xamarin.Android.Cecil.Mdb.dll` cannot be resolved or found, because they're copied into the wrong directories. Cleanup the `Xamarin.Android.Cecil` project files so that they increase consistency with the other project files, e.g. `$(OutputPath)` is `..\..\bin\$(Configuration)`, not `bin\$(Configuration)`, which also allows a from-clean `msbuild`-based build of `Xamarin.Android.Build.Tasks.csproj` to not be stopped when attempting to build `Xamarin.Android.Cecil.dll`.
1 parent db3126d commit 2967144

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.Mdb.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111
<AssemblyName>Xamarin.Android.Cecil.Mdb</AssemblyName>
1212
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1313
</PropertyGroup>
14+
<Import Project="..\..\Configuration.props" />
1415
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1516
<DebugSymbols>true</DebugSymbols>
1617
<DebugType>full</DebugType>
1718
<Optimize>false</Optimize>
18-
<OutputPath>bin\Debug</OutputPath>
19+
<OutputPath>..\..\bin\Debug</OutputPath>
1920
<DefineConstants>DEBUG;</DefineConstants>
2021
<ErrorReport>prompt</ErrorReport>
2122
<WarningLevel>4</WarningLevel>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<Optimize>true</Optimize>
25-
<OutputPath>bin\Release</OutputPath>
26+
<OutputPath>..\..\bin\Release</OutputPath>
2627
<ErrorReport>prompt</ErrorReport>
2728
<WarningLevel>4</WarningLevel>
2829
</PropertyGroup>

src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111
<AssemblyName>Xamarin.Android.Cecil</AssemblyName>
1212
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1313
</PropertyGroup>
14+
<Import Project="..\..\Configuration.props" />
1415
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1516
<DebugSymbols>true</DebugSymbols>
1617
<DebugType>full</DebugType>
1718
<Optimize>false</Optimize>
18-
<OutputPath>bin\Debug</OutputPath>
19+
<OutputPath>..\..\bin\Debug</OutputPath>
1920
<DefineConstants>DEBUG;</DefineConstants>
2021
<ErrorReport>prompt</ErrorReport>
2122
<WarningLevel>4</WarningLevel>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<Optimize>true</Optimize>
25-
<OutputPath>bin\Release</OutputPath>
26+
<OutputPath>..\..\bin\Release</OutputPath>
2627
<ErrorReport>prompt</ErrorReport>
2728
<WarningLevel>4</WarningLevel>
2829
</PropertyGroup>

src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.targets

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<PropertyGroup>
44
<CecilDirectory>$(MSBuildThisFileDirectory)\..\..\external\cecil</CecilDirectory>
55
<CecilPreparedFlag>prepared.flag</CecilPreparedFlag>
6-
<OutputPath Condition="'$(OutputPath)' == ''">bin\$(Configuration)</OutputPath>
76
<CecilOutputPath>$([System.IO.Path]::GetFullPath ('$(OutputPath)'))</CecilOutputPath>
87
<CecilAssemblies>$(OutputPath)\Xamarin.Android.Cecil.dll;$(OutputPath)\Xamarin.Android.Cecil.Mdb.dll</CecilAssemblies>
98
</PropertyGroup>
@@ -17,13 +16,19 @@
1716
<Target Name="BuildCecil"
1817
Inputs="$(CecilPreparedFlag)"
1918
Outputs="$(CecilAssemblies)" DependsOnTargets="PrepareCecil">
20-
<Exec Command="cd $(CecilDirectory); patch -Ep1 &lt; $(MSBuildThisFileDirectory)\assembly-rename.patch" />
19+
<Exec
20+
Command="patch -Ep1 &lt; &quot;$(MSBuildThisFileDirectory)\assembly-rename.patch&quot;"
21+
WorkingDirectory="$(CecilDirectory)"
22+
/>
2123
<MSBuild
22-
Projects="$(CecilDirectory)\Mono.Cecil.csproj;$(CecilDirectory)\symbols\mdb\Mono.Cecil.Mdb.csproj"
23-
Targets="Clean;Build"
24-
StopOnFirstFailure="true"
25-
Properties="Configuration=net_4_0_Debug;OutputPath=$(CecilOutputPath);BuildingSolutionFile=false" />
26-
<Exec Command="cd $(CecilDirectory); patch -REp1 &lt; $(MSBuildThisFileDirectory)\assembly-rename.patch" />
24+
Projects="$(CecilDirectory)\Mono.Cecil.csproj;$(CecilDirectory)\symbols\mdb\Mono.Cecil.Mdb.csproj"
25+
Targets="Clean;Build"
26+
StopOnFirstFailure="True"
27+
Properties="Configuration=net_4_0_Debug;OutputPath=$(CecilOutputPath);BuildingSolutionFile=false" />
28+
<Exec
29+
Command="patch -REp1 &lt; &quot;$(MSBuildThisFileDirectory)\assembly-rename.patch&quot;"
30+
WorkingDirectory="$(CecilDirectory)"
31+
/>
2732
<Touch Files="$(CecilAssemblies)" />
2833
</Target>
2934
<Target Name="Build" DependsOnTargets="BuildCecil" Returns="$(CecilOutputPath)\$(AssemblyName).dll">

0 commit comments

Comments
 (0)