Skip to content

Commit feedee8

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 feedee8

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
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: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<CecilDirectory>$(MSBuildThisFileDirectory)\..\..\external\cecil</CecilDirectory>
55
<CecilPreparedFlag>prepared.flag</CecilPreparedFlag>
6-
<OutputPath Condition="'$(OutputPath)' == ''">bin\$(Configuration)</OutputPath>
6+
<OutputPath Condition=" '$(OutputPath)' == '' ">..\..\bin\$(Configuration)</OutputPath>
77
<CecilOutputPath>$([System.IO.Path]::GetFullPath ('$(OutputPath)'))</CecilOutputPath>
88
<CecilAssemblies>$(OutputPath)\Xamarin.Android.Cecil.dll;$(OutputPath)\Xamarin.Android.Cecil.Mdb.dll</CecilAssemblies>
99
</PropertyGroup>
@@ -17,20 +17,25 @@
1717
<Target Name="BuildCecil"
1818
Inputs="$(CecilPreparedFlag)"
1919
Outputs="$(CecilAssemblies)" DependsOnTargets="PrepareCecil">
20-
<Exec Command="cd $(CecilDirectory); patch -Ep1 &lt; $(MSBuildThisFileDirectory)\assembly-rename.patch" />
20+
<Exec
21+
Command="patch -Ep1 &lt; &quot;$(MSBuildThisFileDirectory)\assembly-rename.patch&quot;"
22+
WorkingDirectory="$(CecilDirectory)"
23+
/>
2124
<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" />
25+
Projects="$(CecilDirectory)\Mono.Cecil.csproj;$(CecilDirectory)\symbols\mdb\Mono.Cecil.Mdb.csproj"
26+
Targets="Clean;Build"
27+
StopOnFirstFailure="True"
28+
Properties="Configuration=net_4_0_Debug;OutputPath=$(CecilOutputPath);BuildingSolutionFile=false" />
29+
<Exec
30+
Command="patch -REp1 &lt; &quot;$(MSBuildThisFileDirectory)\assembly-rename.patch&quot;"
31+
WorkingDirectory="$(CecilDirectory)"
32+
/>
2733
<Touch Files="$(CecilAssemblies)" />
2834
</Target>
2935
<Target Name="Build" DependsOnTargets="BuildCecil" Returns="$(CecilOutputPath)\$(AssemblyName).dll">
3036
<MakeDir Directories="obj\$(Configuration)" />
3137
</Target>
3238
<Target Name="AfterClean">
3339
<Delete Files="$(CecilPreparedFlag)" />
34-
<RemoveDir Directories="bin" />
3540
</Target>
3641
</Project>

0 commit comments

Comments
 (0)