Skip to content

Commit ecb207b

Browse files
authored
Convert /tools and /build-tools projects from net472 to $(DotNetStableTargetFramework) (#7943)
Many of our projects in `/tools` and `/build-tools` target `net472`. Update them to instead target `$(DotNetStableTargetFramework)`. A side-effect of this is that there is no longer an `.exe` built, so we also need to update everything in our build system that calls these tools to use `dotnet foo.dll` instead of `mono foo.exe`.
1 parent cd9c9ff commit ecb207b

File tree

16 files changed

+50
-38
lines changed

16 files changed

+50
-38
lines changed

Configuration.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
<AndroidSupportedTargetAotAbisSplit>$(AndroidSupportedTargetAotAbis.Split(':'))</AndroidSupportedTargetAotAbisSplit>
232232
</PropertyGroup>
233233
<PropertyGroup>
234-
<RemapAssemblyRefToolExecutable>$(MSBuildThisFileDirectory)bin\Build$(Configuration)\remap-assembly-ref\remap-assembly-ref.exe</RemapAssemblyRefToolExecutable>
234+
<RemapAssemblyRefToolExecutable>$(MSBuildThisFileDirectory)bin\Build$(Configuration)\remap-assembly-ref\remap-assembly-ref.dll</RemapAssemblyRefToolExecutable>
235235
<RemapAssemblyRefTool>$(ManagedRuntime) $(ManagedRuntimeArgs) &quot;$(RemapAssemblyRefToolExecutable)&quot;</RemapAssemblyRefTool>
236236
</PropertyGroup>
237237

build-tools/api-merge/api-merge.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<OutputType>Exe</OutputType>
6-
<TargetFramework>net472</TargetFramework>
6+
<TargetFramework>$(DotNetStableTargetFramework)</TargetFramework>
77
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
88
<OutputPath>..\..\bin\Build$(Configuration)</OutputPath>
99
</PropertyGroup>

build-tools/api-xml-adjuster/api-xml-adjuster.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<OutputType>Exe</OutputType>
6-
<TargetFramework>net472</TargetFramework>
6+
<TargetFramework>$(DotNetStableTargetFramework)</TargetFramework>
77
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
88
<OutputPath>..\..\bin\Build$(Configuration)</OutputPath>
99
</PropertyGroup>

build-tools/check-boot-times/check-boot-times.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk" >
33
<PropertyGroup>
4-
<TargetFramework>net472</TargetFramework>
4+
<TargetFramework>$(DotNetStableTargetFramework)</TargetFramework>
55
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
66
<OutputType>Exe</OutputType>
77
<RootNamespace>Xamarin.Android.Tools</RootNamespace>

build-tools/conjure-xamarin-android-cecil/conjure-xamarin-android-cecil.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk" >
33
<PropertyGroup>
4-
<TargetFramework>net472</TargetFramework>
4+
<TargetFramework>$(DotNetStableTargetFramework)</TargetFramework>
55
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
66
<OutputType>Exe</OutputType>
77
<RootNamespace>Xamarin.Android.Prepare</RootNamespace>

build-tools/create-android-api/create-android-api.csproj

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ProjectReference Include="..\..\external\Java.Interop\tools\class-parse\class-parse.csproj" ReferenceOutputAssembly="False" />
1313
<ProjectReference Include="..\api-xml-adjuster\api-xml-adjuster.csproj" ReferenceOutputAssembly="False" />
1414
<ProjectReference Include="..\api-merge\api-merge.csproj" ReferenceOutputAssembly="False" />
15-
<ProjectReference Include="..\jnienv-gen\jnienv-gen.csproj" ReferenceOutputAssembly="False" SkipGetTargetFrameworkProperties="True" AdditionalProperties="TargetFramework=net472" />
15+
<ProjectReference Include="..\jnienv-gen\jnienv-gen.csproj" ReferenceOutputAssembly="False" SkipGetTargetFrameworkProperties="True" />
1616
</ItemGroup>
1717

1818
<PropertyGroup>
@@ -52,24 +52,22 @@
5252
Outputs="@(ApiFileDefinition->'%(ClassParseXml)')">
5353

5454
<PropertyGroup>
55-
<ClassParse>$(XamarinAndroidSourcePath)\bin\$(Configuration)\lib\xamarin.android\xbuild\Xamarin\Android\class-parse.exe</ClassParse>
55+
<ClassParse>$(MicrosoftAndroidSdkOutDir)class-parse.dll</ClassParse>
5656
</PropertyGroup>
5757

5858
<ItemGroup>
5959
<_ClassParseCommands
6060
Condition="Exists('$(XamarinAndroidSourcePath)\src\Mono.Android\Profiles\api-%(ApiFileDefinition.Id).params.txt')"
6161
Include="@(ApiFileDefinition)">
62-
<Command>$(ClassParse)</Command>
63-
<Arguments>$(AndroidSdkDirectory)\platforms\android-%(ApiFileDefinition.Id)\android.jar -platform=%(ApiFileDefinition.Id) -parameter-names=&quot;%(ApiFileDefinition.ParameterDescription)&quot; -o=&quot;%(ApiFileDefinition.ClassParseXml)&quot;</Arguments>
62+
<Command>$(DotNetPreviewTool)</Command>
63+
<Arguments>$(ClassParse) $(AndroidSdkDirectory)\platforms\android-%(ApiFileDefinition.Id)\android.jar -platform=%(ApiFileDefinition.Id) -parameter-names=&quot;%(ApiFileDefinition.ParameterDescription)&quot; -o=&quot;%(ApiFileDefinition.ClassParseXml)&quot;</Arguments>
6464
</_ClassParseCommands>
6565
</ItemGroup>
6666

6767
<MakeDir Directories="$(_OutputPath)api" />
6868

6969
<RunParallelCmds
7070
Commands="@(_ClassParseCommands)"
71-
ManagedRuntime="$(ManagedRuntime)"
72-
ManagedRuntimeArguments="$(ManagedRuntimeArgs)"
7371
/>
7472
</Target>
7573

@@ -81,22 +79,20 @@
8179
Outputs="@(ApiFileDefinition->'%(ApiAdjustedXml)')">
8280

8381
<PropertyGroup>
84-
<ApiXmlAdjuster>$(XamarinAndroidSourcePath)\bin\Build$(Configuration)\api-xml-adjuster.exe</ApiXmlAdjuster>
82+
<ApiXmlAdjuster>$(XamarinAndroidSourcePath)\bin\Build$(Configuration)\api-xml-adjuster.dll</ApiXmlAdjuster>
8583
</PropertyGroup>
8684

8785
<ItemGroup>
8886
<_AdjustApiXmlPrepareCommands
8987
Condition="Exists('$(XamarinAndroidSourcePath)\src\Mono.Android\Profiles\api-%(ApiFileDefinition.Id).params.txt')"
9088
Include="@(ApiFileDefinition)">
91-
<Command>$(ApiXmlAdjuster)</Command>
92-
<Arguments>%(ApiFileDefinition.ClassParseXml) %(ApiFileDefinition.ApiAdjustedXml)</Arguments>
89+
<Command>$(DotNetPreviewTool)</Command>
90+
<Arguments>$(ApiXmlAdjuster) %(ApiFileDefinition.ClassParseXml) %(ApiFileDefinition.ApiAdjustedXml)</Arguments>
9391
</_AdjustApiXmlPrepareCommands>
9492
</ItemGroup>
9593

9694
<RunParallelCmds
9795
Commands="@(_AdjustApiXmlPrepareCommands)"
98-
ManagedRuntime="$(ManagedRuntime)"
99-
ManagedRuntimeArguments="$(ManagedRuntimeArgs)"
10096
/>
10197
</Target>
10298

@@ -108,24 +104,24 @@
108104
Outputs="@(_MergedXmlFiles->'%(MergedXml)')">
109105

110106
<PropertyGroup>
111-
<ApiMerge>..\..\bin\Build$(Configuration)\api-merge.exe</ApiMerge>
107+
<ApiMerge>..\..\bin\Build$(Configuration)\api-merge.dll</ApiMerge>
112108
<_ConfigurationFile>..\..\bin\Build$(Configuration)\merge-configuration.xml</_ConfigurationFile>
113109
<_ConfigurationInputBaseDirectory>..\..\bin\Build$(Configuration)\api\</_ConfigurationInputBaseDirectory>
114110
<_ConfigurationOutputBaseDirectory>..\..\bin\Build$(Configuration)\api\</_ConfigurationOutputBaseDirectory>
115111
</PropertyGroup>
116112

117113
<Exec
118-
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) $(ApiMerge) -config=$(_ConfigurationFile) -config-input-dir=$(_ConfigurationInputBaseDirectory) -config-output-dir=$(_ConfigurationOutputBaseDirectory)" />
114+
Command="&quot;$(DotNetPreviewTool)&quot; $(ApiMerge) -config=$(_ConfigurationFile) -config-input-dir=$(_ConfigurationInputBaseDirectory) -config-output-dir=$(_ConfigurationOutputBaseDirectory)" />
119115

120116
</Target>
121117

122118
<!-- Generates 'JNIEnv.g.cs' file. We do this here because it should only run once, not per-TF. -->
123119
<Target Name="_BuildJNIEnv"
124120
BeforeTargets="Build"
125-
Inputs="..\..\bin\Build$(Configuration)\jnienv-gen.exe"
121+
Inputs="..\..\bin\Build$(Configuration)\jnienv-gen.dll"
126122
Outputs="../../src/Mono.Android/Android.Runtime/JNIEnv.g.cs">
127123
<Exec
128-
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) &quot;../../bin/Build$(Configuration)/jnienv-gen.exe&quot; -o ../../src/Mono.Android/Android.Runtime/JNIEnv.g.cs --use-java-interop"
124+
Command="&quot;$(DotNetPreviewTool)&quot; &quot;../../bin/Build$(Configuration)/jnienv-gen.dll&quot; -o ../../src/Mono.Android/Android.Runtime/JNIEnv.g.cs --use-java-interop"
129125
/>
130126
<Touch Files="../../src/Mono.Android/Android.Runtime/JNIEnv.g.cs" />
131127
</Target>
@@ -140,4 +136,4 @@
140136
<Delete Files="%(_MergedXmlFiles.MergedXml)" />
141137
</Target>
142138

143-
</Project>
139+
</Project>

build-tools/jnienv-gen/jnienv-gen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<OutputType>Exe</OutputType>
6-
<TargetFramework>net472</TargetFramework>
6+
<TargetFramework>$(DotNetStableTargetFramework)</TargetFramework>
77
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
88
<OutputPath>..\..\bin\Build$(Configuration)</OutputPath>
99
</PropertyGroup>

build-tools/plots-to-appinsights/ProcessPlotCSVFile.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup>
55
<OutputType>Exe</OutputType>
6-
<TargetFramework>net472</TargetFramework>
6+
<TargetFramework>$(DotNetStableTargetFramework)</TargetFramework>
77
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
88
<RootNamespace>Xamarin.Android.Tools.Plots</RootNamespace>
99
</PropertyGroup>

build-tools/remap-assembly-ref/remap-assembly-ref.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<TargetFramework>net472</TargetFramework>
4+
<TargetFramework>$(DotNetStableTargetFramework)</TargetFramework>
55
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
66
<OutputType>Exe</OutputType>
77
<RootNamespace>remapassemblyref</RootNamespace>

build-tools/xaprepare/xaprepare/Application/Utilities.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Net;
56
using System.Net.Http;
67
using System.Reflection;
@@ -796,6 +797,25 @@ public static bool RunCommand (string command, string? workingDirectory, bool ec
796797
return runner.Run ();
797798
}
798799

800+
public static bool RunManagedCommand (string command, string workingDirectory, bool ignoreEmptyArguments, params string [] arguments)
801+
{
802+
return RunManagedCommand (command, workingDirectory, echoStderr: true, ignoreEmptyArguments: ignoreEmptyArguments, arguments: arguments);
803+
}
804+
805+
// This is a managed assembly that needs to be run as 'dotnet foo.dll'
806+
public static bool RunManagedCommand (string command, string? workingDirectory, bool echoStderr, bool ignoreEmptyArguments, params string [] arguments)
807+
{
808+
if (string.IsNullOrEmpty (command))
809+
throw new ArgumentException ("must not be null or empty", nameof (command));
810+
811+
var runner = new ProcessRunner ("dotnet", ignoreEmptyArguments, new [] { command }.Concat (arguments).ToArray ()) {
812+
EchoStandardError = echoStderr,
813+
WorkingDirectory = workingDirectory,
814+
};
815+
816+
return runner.Run ();
817+
}
818+
799819
public static string GetStringFromStdout (string command, params string?[] arguments)
800820
{
801821
return GetStringFromStdout (command, throwOnErrors: false, trimTrailingWhitespace: true, arguments: arguments);

0 commit comments

Comments
 (0)