-
Notifications
You must be signed in to change notification settings - Fork 5k
/
Copy pathAndroidSampleApp.csproj
160 lines (139 loc) · 7.22 KB
/
AndroidSampleApp.csproj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<RuntimeIdentifier>android-$(TargetArchitecture)</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>Link</TrimMode>
<ForceAOT Condition="'$(ForceAOT)' == ''">false</ForceAOT>
<!-- Disable event source by default - iOS and Android SDKs do this by default as well -->
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">false</EventSourceSupport>
</PropertyGroup>
<ItemGroup>
<RuntimeComponents Condition="'$(DiagnosticPorts)' != ''" Include="diagnostics_tracing" />
</ItemGroup>
<Import Project="$(RepoTasksDir)AotCompilerTask\MonoAOTCompiler.props" />
<UsingTask TaskName="AndroidAppBuilderTask"
AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)"/>
<UsingTask TaskName="MonoAOTCompiler"
AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />
<UsingTask Condition="'$(RunAOTCompilation)' == 'true'"
TaskName="NdkToolFinderTask"
AssemblyFile="$(MobileBuildTasksAssemblyPath)" />
<PropertyGroup Condition="'$(RunAOTCompilation)' == 'true'">
<_MobileIntermediateOutputPath>$(IntermediateOutputPath)mobile</_MobileIntermediateOutputPath>
</PropertyGroup>
<Target Name="BuildApp" AfterTargets="CopyFilesToPublishDirectory">
<PropertyGroup>
<StripDebugSymbols>False</StripDebugSymbols>
<StripDebugSymbols Condition="'$(Configuration)' == 'Release'">True</StripDebugSymbols>
<ApkDir>$(PublishDir)apk\</ApkDir>
</PropertyGroup>
<ItemGroup>
<AotInputAssemblies Include="$(PublishDir)\*.dll">
<AotArguments>@(MonoAOTCompilerDefaultAotArguments, ';')</AotArguments>
<ProcessArguments>@(MonoAOTCompilerDefaultProcessArguments, ';')</ProcessArguments>
</AotInputAssemblies>
</ItemGroup>
<MakeDir Directories="$(_MobileIntermediateOutputPath)"
Condition="'$(ForceAOT)' == 'true'"/>
<RemoveDir Directories="$(ApkDir)" />
<Message Importance="High" Text="Path: $(PublishDir)" />
<Message Importance="High" Text="SourceDir: $(OutputPath)" />
<!-- Make sure marshal-ilgen is included in the components list. -->
<ItemGroup>
<RuntimeComponents Include="marshal-ilgen" KeepDuplicates="false"/>
</ItemGroup>
<PropertyGroup Condition="'$(ForceAOT)' == 'true' and '$(AOTWithLibraryFiles)' == 'true'">
<_AotOutputType>Library</_AotOutputType>
<_AotLibraryFormat>So</_AotLibraryFormat>
<_AotMode Condition="'$(AotMode)' == ''">Normal</_AotMode>
</PropertyGroup>
<PropertyGroup Condition="'$(ForceAOT)' == 'true' and '$(AOTWithLibraryFiles)' != 'true'">
<_AotOutputType>AsmOnly</_AotOutputType>
<_AotModulesTablePath>$(ApkDir)\modules.c</_AotModulesTablePath>
<_AotMode Condition="'$(AotMode)' == ''">Full</_AotMode>
</PropertyGroup>
<PropertyGroup>
<AndroidLibraryMinApiLevel Condition="'$(AndroidLibraryMinApiLevel)' == ''">21</AndroidLibraryMinApiLevel>
</PropertyGroup>
<NdkToolFinderTask
Condition="'$(AOTWithLibraryFiles)' == 'true'"
Architecture="$(TargetArchitecture)"
HostOS="$(_HostOS)"
MinApiLevel="$(AndroidLibraryMinApiLevel)">
<Output TaskParameter="AsPrefixPath" PropertyName="_AsPrefixPath" />
<Output TaskParameter="ToolPrefixPath" PropertyName="_ToolPrefixPath" />
<Output TaskParameter="Triple" PropertyName="_Triple" />
<Output TaskParameter="LdName" PropertyName="_LdName" />
<Output TaskParameter="LdPath" PropertyName="_LdPath" />
<Output TaskParameter="ClangPath" PropertyName="_ClangPath" />
</NdkToolFinderTask>
<PropertyGroup Condition="'$(AOTWithLibraryFiles)' == 'true'">
<_AsPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_AsPrefixPath)'))</_AsPrefixPath>
<_ToolPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_ToolPrefixPath)'))</_ToolPrefixPath>
</PropertyGroup>
<MonoAOTCompiler Condition="'$(ForceAOT)' == 'true'"
AotModulesTablePath="$(_AotModulesTablePath)"
AsPrefix="$(_AsPrefixPath)"
Assemblies="@(AotInputAssemblies)"
CompilerBinaryPath="@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())'))"
IntermediateOutputPath="$(IntermediateOutputPath)"
LibraryFormat="$(_AotLibraryFormat)"
LLVMPath="$(MonoAotCrossDir)"
Mode="$(_AotMode)"
OutputDir="$(_MobileIntermediateOutputPath)"
OutputType="$(_AotOutputType)"
ToolPrefix="$(_ToolPrefixPath)"
UseAotDataFile="false"
UseLLVM="$(UseLLVM)">
<Output TaskParameter="CompiledAssemblies" ItemName="BundleAssemblies" />
</MonoAOTCompiler>
<AndroidAppBuilderTask
AppDir="$(PublishDir)"
Assemblies="@(BundleAssemblies)"
DiagnosticPorts="$(DiagnosticPorts)"
ExtraLinkerArguments="@(_ExtraAppLinkerArgs)"
ForceInterpreter="$(MonoForceInterpreter)"
ForceAOT="$(ForceAOT)"
MainLibraryFileName="$(AssemblyName).dll"
MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)runtimes\android-$(TargetArchitecture)\native\include\mono-2.0"
OutputDir="$(ApkDir)"
ProjectName="HelloAndroid"
RuntimeComponents="@(RuntimeComponents)"
RuntimeIdentifier="$(RuntimeIdentifier)"
StripDebugSymbols="$(StripDebugSymbols)">
<Output TaskParameter="ApkBundlePath" PropertyName="ApkBundlePath" />
<Output TaskParameter="ApkPackageId" PropertyName="ApkPackageId" />
</AndroidAppBuilderTask>
<Message Importance="High" Text="Apk: $(ApkBundlePath)"/>
<Message Importance="High" Text="PackageId: $(ApkPackageId)"/>
<Exec Condition="'$(DeployAndRun)' == 'true' and '$(ArchiveTests)' != 'true'" Command="dotnet xharness android test --package-name=net.dot.HelloAndroid --instrumentation=net.dot.MonoRunner --app=$(ApkDir)/bin/HelloAndroid.apk --expected-exit-code=42 --output-directory=$(ApkDir)/log" />
</Target>
<ItemGroup>
<Compile Include="Program.cs" />
</ItemGroup>
<Target Name="CopySampleAppToHelixTestDir"
Condition="'$(ArchiveTests)' == 'true'"
AfterTargets="Build"
DependsOnTargets="Publish;BuildApp" >
<PropertyGroup>
<!-- Helix properties -->
<!-- AnyCPU as Platform-->
<OSPlatformConfig>$(TargetOS).AnyCPU.$(Configuration)</OSPlatformConfig>
<!-- <OSPlatformConfig>$(TargetOS).$(Platform).$(Configuration)</OSPlatformConfig> -->
<HelixArchiveRoot>$(ArtifactsDir)helix/</HelixArchiveRoot>
<HelixArchiveRunOnlyRoot>$(HelixArchiveRoot)runonly/</HelixArchiveRunOnlyRoot>
<HelixArchiveRunOnlyAppsDir>$(HelixArchiveRunOnlyRoot)$(OSPlatformConfig)/</HelixArchiveRunOnlyAppsDir>
</PropertyGroup>
<ItemGroup>
<_apkFiles Include="$(ApkBundlePath)" />
</ItemGroup>
<Copy SourceFiles="@(_apkFiles)"
DestinationFolder="$(HelixArchiveRunOnlyAppsDir)/%(RecursiveDir)" />
<Message Importance="High" Text="ApkBundlePath: $(ApkBundlePath)"/>
<Message Importance="High" Text="TestArchiveTestsDir: $(TestArchiveTestsDir)"/>
</Target>
</Project>