Skip to content

Commit

Permalink
Move mobile AppBuilder & AOTCompiler projects into tools-local (dotne…
Browse files Browse the repository at this point in the history
…t#36478)

Moving the projects will make sure their artifacts are always available to the different CI legs.
  • Loading branch information
steveisok committed May 15, 2020
1 parent ec08b85 commit b6ef0a5
Show file tree
Hide file tree
Showing 34 changed files with 97 additions and 85 deletions.
41 changes: 4 additions & 37 deletions Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,10 @@
<Import Project="$(RepositoryEngineeringDir)restore\docs.targets" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<Import Project="$(RepositoryEngineeringDir)restore\optimizationData.targets" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(EnableNgenOptimization)' == 'true'" />

<!--
Use synthetic inputs/outputs to avoid building it all the time. This should let devs build with
MSBuild node reuse enabled (the Arcade default). If it were built every time, it would hit file
locking issues vs. the persistent nodes that loaded the task DLL for the previous build. It
isn't particularly accurate, but better than nothing.
-->
<Target Name="BuildRepoTasks"
DependsOnTargets="GetRepoTasksSrc"
BeforeTargets="Restore"
Inputs="@(RepoTasksSrc)"
Outputs="$(RepoTasksOutputFile)">
<ItemGroup>
<RepoTaskProjects Include="$(RepoTasksDir)**\*.csproj" />
</ItemGroup>

<MSBuild Projects="@(RepoTaskProjects)"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid());Configuration=Debug;Platform=AnyCPU"
Targets="Restore"/>

<MSBuild Projects="@(RepoTaskProjects)"
Properties="Configuration=Debug;Platform=AnyCPU"
Targets="Build"/>

<WriteLinesToFile File="$(RepoTasksOutputFile)"
Lines="$(RepoTasksOutputFile)"
Overwrite="true" />
</Target>

<Target Name="GetRepoTasksSrc">
<PropertyGroup>
<RepoTasksDir>$(RepoTasksDir)</RepoTasksDir>
<RepoTasksOutputFile>$(ArtifactsObjDir)runtime.tasks\Debug\build-semaphore.txt</RepoTasksOutputFile>
</PropertyGroup>

<ItemGroup>
<RepoTasksSrc Include="$(RepoTasksDir)**\*.cs*" />
</ItemGroup>
<Target Name="BuildLocalTasks"
BeforeTargets="Restore">
<MSBuild Projects="$(RepoTasksDir)tasks.proj"
Targets="BuildAndRestoreIncrementally"/>
</Target>

<Target Name="RestoreWithoutStaticGraph"
Expand Down
10 changes: 10 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
<CoreLibSharedDir>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src'))</CoreLibSharedDir>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsMobile)' == 'true'">
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(NetCoreAppCurrent)'))</AppleAppBuilderDir>
<AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', 'Debug', '$(NetCoreAppCurrent)'))</AndroidAppBuilderDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppCurrent)'))</MonoAOTCompilerDir>

<AppleAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AppleAppBuilderDir)', 'AppleAppBuilder.dll'))</AppleAppBuilderTasksAssemblyPath>
<AndroidAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AndroidAppBuilderDir)', 'AndroidAppBuilder.dll'))</AndroidAppBuilderTasksAssemblyPath>
<MonoAOTCompilerTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))</MonoAOTCompilerTasksAssemblyPath>
</PropertyGroup>

<!-- Packaging properties -->
<PropertyGroup>
<!--
Expand Down
14 changes: 8 additions & 6 deletions eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
</PropertyGroup>

<!-- Generate a self-contained app bundle for Android with tests. -->
<UsingTask TaskName="AndroidAppBuilderTask"
AssemblyFile="$(AndroidAppBuilderDir)AndroidAppBuilder.dll" />
<UsingTask Condition="'$(TargetOS)' == 'Android'"
TaskName="AndroidAppBuilderTask"
AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)" />

<Target Condition="'$(TargetOS)' == 'Android'" Name="BundleTestAndroidApp">
<PropertyGroup>
Expand Down Expand Up @@ -48,12 +49,13 @@
</Target>

<!-- Generate a self-contained app bundle for iOS with tests. -->
<UsingTask TaskName="AppleAppBuilderTask"
AssemblyFile="$(AppleAppBuilderDir)AppleAppBuilder.dll" />
<UsingTask Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'"
TaskName="AppleAppBuilderTask"
AssemblyFile="$(AppleAppBuilderTasksAssemblyPath)" />
<UsingTask TaskName="MonoAOTCompiler"
AssemblyFile="$(MonoAOTCompilerDir)MonoAOTCompiler.dll" />
AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />

<Import Project="$(MonoProjectRoot)msbuild\AotCompilerTask\MonoAOTCompiler.props" />
<Import Project="$(MonoAOTCompilerDir)MonoAOTCompiler.props" />

<Target Condition="'$(TargetOS)' == 'iOS'" Name="BundleTestAppleApp">
<Error Condition="!Exists('$(RuntimePackRidDir)')" Text="RuntimePackRidDir=$(RuntimePackRidDir) doesn't exist" />
Expand Down
5 changes: 0 additions & 5 deletions eng/testing/tests.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsMobile)' == 'true'">
<MobileHelperTasksDirSuffix>$(NetCoreAppCurrent)-$(MonoConfiguration)</MobileHelperTasksDirSuffix>
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', '$(MobileHelperTasksDirSuffix)'))</AppleAppBuilderDir>
<AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', '$(MobileHelperTasksDirSuffix)'))</AndroidAppBuilderDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', '$(MobileHelperTasksDirSuffix)'))</MonoAOTCompilerDir>

<!-- Test runners are built as part of libs.pretest so we need to use libraries configuration -->
<MobileRunnersDirSuffix>$(NetCoreAppCurrent)-$(Configuration)</MobileRunnersDirSuffix>
<AppleTestRunnerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleTestRunner', '$(MobileRunnersDirSuffix)'))</AppleTestRunnerDir>
Expand Down
10 changes: 5 additions & 5 deletions src/mono/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@

<!-- Paths for Mobile App Projects -->
<PropertyGroup>
<AppleAppBuilderProjDirectory>$([MSBuild]::NormalizeDirectory('$(MonoProjectRoot)', 'msbuild', 'AppleAppBuilder'))</AppleAppBuilderProjDirectory>
<AppleTestRunnerProjDirectory>$([MSBuild]::NormalizeDirectory('$(MonoProjectRoot)', 'msbuild', 'AppleTestRunner'))</AppleTestRunnerProjDirectory>
<AndroidAppBuilderProjDirectory>$([MSBuild]::NormalizeDirectory('$(MonoProjectRoot)', 'msbuild', 'AndroidAppBuilder'))</AndroidAppBuilderProjDirectory>
<AndroidTestRunnerProjDirectory>$([MSBuild]::NormalizeDirectory('$(MonoProjectRoot)', 'msbuild', 'AndroidTestRunner'))</AndroidTestRunnerProjDirectory>
<MonoAOTCompilerProjDirectory>$([MSBuild]::NormalizeDirectory('$(MonoProjectRoot)', 'msbuild', 'AotCompilerTask'))</MonoAOTCompilerProjDirectory>
<AppleAppBuilderProjDirectory>$([MSBuild]::NormalizeDirectory('$(RepoTasksDir)', 'mobile.tasks', 'AppleAppBuilder'))</AppleAppBuilderProjDirectory>
<AppleTestRunnerProjDirectory>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'Common', tests, 'AppleTestRunner'))</AppleTestRunnerProjDirectory>
<AndroidAppBuilderProjDirectory>$([MSBuild]::NormalizeDirectory('$(RepoTasksDir)', 'mobile.tasks', 'AndroidAppBuilder'))</AndroidAppBuilderProjDirectory>
<AndroidTestRunnerProjDirectory>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'Common', tests, 'AndroidTestRunner'))</AndroidTestRunnerProjDirectory>
<MonoAOTCompilerProjDirectory>$([MSBuild]::NormalizeDirectory('$(RepoTasksDir)', 'mobile.tasks', 'AotCompilerTask'))</MonoAOTCompilerProjDirectory>
</PropertyGroup>
</Project>
20 changes: 1 addition & 19 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -885,34 +885,16 @@

<Import Project="Directory.Build.targets" />

<Target Name="BuildAppleAppBuilder" Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">
<MSBuild Projects="$(AppleAppBuilderProjDirectory)AppleAppBuilder.csproj"
Properties="Configuration=$(Configuration);Platform=$(HostArch)"
Targets="Restore;Build" />
</Target>

<Target Name="BuildAndroidAppBuilder" Condition="'$(TargetsAndroid)' == 'true'">
<MSBuild Projects="$(AndroidAppBuilderProjDirectory)AndroidAppBuilder.csproj"
Properties="Configuration=$(Configuration);Platform=$(HostArch)"
Targets="Restore;Build" />
</Target>

<!-- Need to publish this since it references System.Reflection.MetadataLoadContext -->
<Target Name="BuildWasmAppBuilder" Condition="'$(TargetsBrowser)' == 'true'">
<MSBuild Projects="$(MonoProjectRoot)msbuild\WasmAppBuilder\WasmAppBuilder.csproj"
Properties="Configuration=$(Configuration);"
Targets="Restore;Build;Publish"/>
</Target>

<Target Name="BuildMonoAOTCompilerTask">
<MSBuild Projects="$(MonoProjectRoot)msbuild\AotCompilerTask\MonoAOTCompiler.csproj"
Properties="Configuration=$(Configuration)"
Targets="Restore;Build" />
</Target>

<!-- Ordering matters! Overwriting the Build target. -->
<!-- General targets -->
<Target Name="Build" DependsOnTargets="BuildMonoRuntimeUnix;BuildMonoRuntimeWindows;BuildAppleAppBuilder;BuildAndroidAppBuilder;BuildWasmAppBuilder;BuildMonoAOTCompilerTask">
<Target Name="Build" DependsOnTargets="BuildMonoRuntimeUnix;BuildMonoRuntimeWindows;BuildWasmAppBuilder;">
<PropertyGroup>
<_MonoRuntimeFilePath Condition="'$(TargetsWindows)' == 'true' and '$(Platform)' == 'x64'">$(MonoObjDir)x64\Bin\$(Configuration)\mono-2.0-sgen.dll</_MonoRuntimeFilePath>
<_MonoRuntimeFilePath Condition="'$(TargetsWindows)' == 'true' and '$(Platform)' == 'x86'">$(MonoObjDir)Win32\Bin\$(Configuration)\mono-2.0-sgen.dll</_MonoRuntimeFilePath>
Expand Down
5 changes: 1 addition & 4 deletions src/mono/netcore/sample/Android/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOTNET := ../../../../.././dotnet.sh
#export ANDROID_NDK_ROOT=/path/to/android/ndk
#export ANDROID_SDK_ROOT=/path/to/android/sdk

all: runtimepack bundle
all: bundle

bundle: clean
$(DOTNET) build -c $(MONO_CONFIG) Program.csproj
Expand All @@ -14,8 +14,5 @@ bundle: clean
deploy-launch: bundle
$(DOTNET) msbuild /t:ReinstallAndLaunch

runtimepack:
../../../../.././build.sh -c $(MONO_CONFIG) -os Android -arch $(MONO_ARCH) -subset Mono+Libs /p:DisableCrossgen=true

clean:
rm -rf bin
3 changes: 2 additions & 1 deletion src/mono/netcore/sample/Android/Program.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<TargetArchitecture Condition="'$(TargetArchitecture)'==''">x64</TargetArchitecture>
<RuntimePackDir>$(ArtifactsDir)bin\lib-runtime-packs\$(NetCoreAppCurrent)-Android-$(Configuration)-$(TargetArchitecture)\runtimes\android-$(TargetArchitecture)</RuntimePackDir>
<BundleDir>$(MSBuildThisFileDirectory)\bin\bundle</BundleDir>
<AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', '$(NetCoreAppCurrent)-$(Configuration)'))</AndroidAppBuilderDir>
<AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', 'Debug', '$(NetCoreAppCurrent)'))</AndroidAppBuilderDir>

</PropertyGroup>

<Target Name="RebuildAndroidAppBuilder">
Expand Down
7 changes: 2 additions & 5 deletions src/mono/netcore/sample/iOS/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
MONO_CONFIG=Debug
MONO_ARCH=arm64
MONO_ARCH=x64
DOTNET := ../../../../.././dotnet.sh
USE_LLVM=True

# usage example:
# 'make all MONO_ARCH=x64 MONO_CONFIG=Release' to build the app for simulator
all: runtimepack bundle
all: bundle

program:
$(DOTNET) build -c $(MONO_CONFIG) Program.csproj
Expand All @@ -17,8 +17,5 @@ bundle: clean program
deploy-sim:
$(DOTNET) msbuild /t:IosDeployToSimulator /p:Configuration=$(MONO_CONFIG) /p:TargetArchitecture=$(MONO_ARCH)

runtimepack:
../../../../.././build.sh -c $(MONO_CONFIG) -os iOS -arch $(MONO_ARCH) -subset Mono+Libs /p:DisableCrossgen=true

clean:
rm -rf bin
8 changes: 5 additions & 3 deletions src/mono/netcore/sample/iOS/Program.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
<RuntimePackDir>$(ArtifactsDir)bin\lib-runtime-packs\$(NetCoreAppCurrent)-iOS-$(Configuration)-$(TargetArchitecture)\runtimes\ios-$(TargetArchitecture)</RuntimePackDir>
<MonoRuntimeDir>$(ArtifactsDir)bin\mono\iOS.$(TargetArchitecture).$(Configuration)</MonoRuntimeDir>
<BundleDir>$(MSBuildThisFileDirectory)\bin\bundle</BundleDir>
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', '$(NetCoreAppCurrent)-$(Configuration)'))</AppleAppBuilderDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', '$(NetCoreAppCurrent)-$(Configuration)'))</MonoAOTCompilerDir>
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(NetCoreAppCurrent)'))</AppleAppBuilderDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppCurrent)'))</MonoAOTCompilerDir>
<RunAOTCompilation Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm'">true</RunAOTCompilation>
<Optimized Condition="'$(Configuration)' != 'Debug'">true</Optimized>
<Optimized Condition="'$(Configuration)' == 'Debug'">false</Optimized>
</PropertyGroup>

<Target Name="RebuildAppleAppBuilder">
Expand Down Expand Up @@ -84,7 +86,7 @@
BuildAppBundle="True"
DevTeamProvisioning="$(DevTeamProvisioning)"
OutputDirectory="$(BundleDir)"
Optimized="True"
Optimized="$(Optimized)"
AppDir="$(BundleDir)">
<Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" />
<Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<OutputType>Library</OutputType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Templates\*.*" />
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<OutputType>Library</OutputType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="$(RefOnlyMicrosoftBuildVersion)" />
Expand All @@ -14,4 +16,9 @@
<Compile Include="MonoAOTCompiler.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="MonoAOTCompiler.props">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<OutputType>Library</OutputType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Templates\*.*" />
Expand Down
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions tools-local/tasks/tasks.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)**\*.csproj" Exclude="$(MSBuildProjectFullPath)" />
<ProjectReference Remove="$(MSBuildThisFileDirectory)mobile.tasks\AndroidAppBuilder\AndroidAppBuilder.csproj"
Condition="'$(TargetOS)' != 'Android'" />
<ProjectReference Remove="$(MSBuildThisFileDirectory)mobile.tasks\AppleAppBuilder\AppleAppBuilder.csproj"
Condition="'$(TargetOS)' != 'iOS' and '$(TargetOS)' != 'tvOS'" />
<ProjectReference Remove="$(MSBuildThisFileDirectory)mobile.tasks\AotCompilerTask\MonoAOTCompiler.csproj"
Condition="'$(TargetsMobile)' != 'true'" />
</ItemGroup>

<!--
Use synthetic inputs/outputs to avoid building it all the time. This should let devs build with
MSBuild node reuse enabled (the Arcade default). If it were built every time, it would hit file
locking issues vs. the persistent nodes that loaded the task DLL for the previous build. It
isn't particularly accurate, but better than nothing.
-->
<Target Name="BuildAndRestoreIncrementally"
DependsOnTargets="GetTasksSrc"
Inputs="@(TasksSrc)"
Outputs="$(TasksIntermediateFile)">
<ItemGroup>
<TaskProject Include="$(MSBuildProjectFullPath)" />
</ItemGroup>

<MSBuild Projects="@(TaskProject)"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid());Configuration=Debug;Platform=AnyCPU"
Targets="Restore"/>

<MSBuild Projects="@(TaskProject)"
Properties="Configuration=Debug;Platform=AnyCPU"
Targets="Build"/>

<WriteLinesToFile File="$(TasksIntermediateFile)"
Lines="$(TasksIntermediateFile)"
Overwrite="true" />
</Target>

<Target Name="GetTasksSrc">
<PropertyGroup>
<TasksIntermediateFile>$([MSBuild]::NormalizePath('$(ArtifactsObjDir)', '$(MSBuildProjectName)', 'Debug', 'build-semaphore.txt'))</TasksIntermediateFile>
</PropertyGroup>

<ItemGroup>
<TasksSrc Include="$(MSBuildThisFileDirectory)**\*.cs*;$(MSBuildThisFileDirectory)**\*.*proj" />
</ItemGroup>
</Target>
</Project>

0 comments on commit b6ef0a5

Please sign in to comment.