Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] make designer MSBuild targets a no-op (#…
Browse files Browse the repository at this point in the history
…9473)

Context: https://developercommunity.visualstudio.com/t/XamarinAndroid-Designer---Replacement/10728132

As the Android designer is no longer supported in Visual Studio, we
can remove the MSBuild logic for the following targets:

* `GetExtraLibraryLocationsForDesigner`

* `SetupDependenciesForDesigner`

Since these are public MSBuild target names, we should probably leave
them in and "do nothing".

This also will simplify things if we ever refactor
`<GenerateJavaStubs/>` and friends as this removes a caller.

I also removed the `DesignerTests.cs` file that was testing these.
  • Loading branch information
jonathanpeppers authored Oct 31, 2024
1 parent ea6734f commit 13b7378
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 514 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,146 +16,8 @@ Copyright (C) 2016 Xamarin. All rights reserved.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="GetExtraLibraryLocationsForDesigner"
DependsOnTargets="_SetupDesignTimeBuildForCompile"
Returns="ExtraJarLocation;ExtraResourceLocation">
<ReadLibraryProjectImportsCache
Condition="Exists('$(_AndroidLibraryProjectImportsCache)')"
CacheFile="$(_AndroidLibraryProjectImportsCache)">
<Output TaskParameter="ResolvedResourceDirectories" ItemName="_LibraryResourceDirectories" />
<Output TaskParameter="Jars" ItemName="_LibraryJars" />
</ReadLibraryProjectImportsCache>
<ItemGroup>
<ExtraJarLocation Include="@(_LibraryJars)">
<Source>LibraryImport</Source>
</ExtraJarLocation>
<ExtraJarLocation Include="@(AndroidJavaLibrary->'%(FullPath)')">
<Source>AndroidJavaLibrary</Source>
</ExtraJarLocation>
<ExtraResourceLocation Include="@(_LibraryResourceDirectories)">
<Source>LibraryImport</Source>
</ExtraResourceLocation>
</ItemGroup>
</Target>

<Target Name="_CopyAssembliesForDesigner"
Inputs="@(ResolvedAssemblies)"
Outputs="@(ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')">
<Copy
SourceFiles="@(ResolvedAssemblies)"
DestinationFiles="@(ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')"
/>
</Target>

<Target Name="_PrepareAssembliesForDesigner">
<ItemGroup>
<_ResolvedAssemblies
Include="@(ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')"
/>
<_ResolvedUserAssemblies
Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')"
/>
<_ResolvedUserMonoAndroidAssembliesForDesigner
Include="@(_ResolvedUserAssemblies)"
Condition="'%(_ResolvedUserAssemblies.TargetFrameworkIdentifier)' == 'MonoAndroid' Or '%(_ResolvedUserAssemblies.HasMonoAndroidReference)' == 'True'"
/>
</ItemGroup>
</Target>

<Target Name="_GeneratePackageManagerJavaForDesigner"
DependsOnTargets="_AddStaticResources;_ResolveAssemblies;_CopyAssembliesForDesigner;_PrepareAssembliesForDesigner;$(BeforeGenerateAndroidManifest)"
Inputs="$(_ResolvedUserAssembliesHashFile);@(ResolvedAssemblies);@(ResolvedUserAssemblies);$(_AndroidManifestAbs);"
Outputs="$(_AndroidIntermediateJavaSourceDirectory)mono\MonoPackageManager_Resources.java;$(_AcwMapFile)">

<PropertyGroup>
<_ManifestOutput Condition=" '$(AndroidManifestMerger)' == 'legacy' ">$(IntermediateOutputPath)android\AndroidManifest.xml</_ManifestOutput>
<_ManifestOutput Condition=" '$(AndroidManifestMerger)' != 'legacy' ">$(IntermediateOutputPath)AndroidManifest.xml</_ManifestOutput>
</PropertyGroup>
<ItemGroup>
<_MergedManifestDocuments Condition=" '$(AndroidManifestMerger)' == 'legacy' " Include="@(ExtractedManifestDocuments)" />
</ItemGroup>

<GenerateJavaStubs
ResolvedAssemblies="@(_ResolvedAssemblies)"
ResolvedUserAssemblies="@(_ResolvedUserMonoAndroidAssembliesForDesigner)"
ManifestTemplate="$(_AndroidManifestAbs)"
MergedManifestDocuments="@(_MergedManifestDocuments)"
Debug="$(AndroidIncludeDebugSymbols)"
NeedsInternet="$(AndroidNeedsInternetPermission)"
AndroidSdkPlatform="$(_AndroidApiLevel)"
AndroidSdkDir="$(_AndroidSdkDirectory)"
PackageName="$(_AndroidPackage)"
VersionName="$(_AndroidVersionName)"
VersionCode="$(_AndroidVersionCode)"
ApplicationLabel="$(_ApplicationLabel)"
OutputDirectory="$(IntermediateOutputPath)android"
TypemapOutputDirectory="$(_NativeAssemblySourceDir)"
GenerateNativeAssembly="false"
MergedAndroidManifestOutput="$(_ManifestOutput)"
EmbedAssemblies="$(EmbedAssembliesIntoApk)"
BundledWearApplicationName="$(BundledWearApplicationPackageName)"
PackageNamingPolicy="$(AndroidPackageNamingPolicy)"
ApplicationJavaClass="$(AndroidApplicationJavaClass)"
FrameworkDirectories="$(_XATargetFrameworkDirectories);$(_XATargetFrameworkDirectories)Facades"
AcwMapFile="$(_AcwMapFile)"
SupportedAbis="$(_BuildTargetAbis)"
SupportedOSPlatformVersion="$(SupportedOSPlatformVersion)">
</GenerateJavaStubs>
<ManifestMerger
Condition=" '$(AndroidManifestMerger)' == 'manifestmerger.jar' "
ToolPath="$(JavaToolPath)"
JavaOptions="$(JavaOptions)"
ManifestMergerJarPath="$(AndroidManifestMergerJarPath)"
AndroidManifest="$(IntermediateOutputPath)AndroidManifest.xml"
OutputManifestFile="$(IntermediateOutputPath)android\AndroidManifest.xml"
LibraryManifestFiles="@(ExtractedManifestDocuments)"
ManifestPlaceholders="$(AndroidManifestPlaceholders)"
/>
<ConvertCustomView
Condition="Exists('$(_CustomViewMapFile)')"
CustomViewMapFile="$(_CustomViewMapFile)"
AcwMapFile="$(_AcwMapFile)"
ResourceDirectories="$(MonoAndroidResDirIntermediate);@(LibraryResourceDirectories)"
/>
<!-- Create java needed for Mono runtime -->
<GeneratePackageManagerJava
ResolvedAssemblies="@(_ResolvedAssemblies)"
ResolvedUserAssemblies="@(_ResolvedUserAssemblies)"
MainAssembly="$(MonoAndroidLinkerInputDir)$(TargetFileName)"
OutputDirectory="$(_AndroidIntermediateJavaSourceDirectory)mono"
EnvironmentOutputDirectory="$(_AndroidIntermediateJavaSourceDirectory)mono\android\app"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
Manifest="$(IntermediateOutputPath)android\AndroidManifest.xml"
Environments="@(AndroidEnvironment);@(LibraryEnvironments)"
AndroidAotMode="$(AndroidAotMode)"
EnableLLVM="$(EnableLLVM)"
HttpClientHandlerType="$(AndroidHttpClientHandlerType)"
TlsProvider="$(AndroidTlsProvider)"
Debug="$(AndroidIncludeDebugSymbols)"
AndroidSequencePointsMode="$(_SequencePointsMode)"
EnableSGenConcurrent="$(AndroidEnableSGenConcurrent)"
SupportedAbis="$(_BuildTargetAbis)"
AndroidPackageName="$(_AndroidPackage)"
EnablePreloadAssembliesDefault="$(_AndroidEnablePreloadAssembliesDefault)">
</GeneratePackageManagerJava>
</Target>

<Target Name="SetupDependenciesForDesigner"
DependsOnTargets="_ResolveMonoAndroidSdks;UpdateAndroidResources;_AdjustJavacVersionArguments;_GeneratePackageManagerJavaForDesigner;_GetMonoPlatformJarPath;_DetermineJavaLibrariesToCompile"
Inputs="@(_AndroidMSBuildAllProjects);$(MonoPlatformJarPath);@(_JavaStubFiles);@(AndroidJavaSource)"
Outputs="$(_AndroidStampDirectory)SetupDependenciesForDesigner.stamp">
<Javac
JavaPlatformJarPath="$(JavaPlatformJarPath)"
ClassesOutputDirectory="$(_AndroidIntermediateJavaClassDirectory)"
StubSourceDirectory="$(_AndroidIntermediateJavaSourceDirectory)"
JavaSourceFiles=""
ToolPath="$(JavacToolPath)"
ToolExe="$(JavacToolExe)"
Jars="@(_JavaLibrariesToCompile);@(_ReferenceJavaLibs)"
JavacTargetVersion="$(JavacTargetVersion)"
JavacSourceVersion="$(JavacSourceVersion)"
/>
<Touch Files="$(_AndroidStampDirectory)SetupDependenciesForDesigner.stamp" AlwaysCreate="true" />
</Target>
<!-- Public targets for the designer are deprecated -->
<Target Name="GetExtraLibraryLocationsForDesigner" />
<Target Name="SetupDependenciesForDesigner" />

</Project>
Loading

0 comments on commit 13b7378

Please sign in to comment.