Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AndroidApp.targets « build « android « msbuild « mono « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6fd26641cd1e103b297a2822fd6d63f187b851c4 (plain)
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
161
162
163
164
165
166
167
168
<Project>
  <UsingTask TaskName="AndroidAppBuilderTask" 
             AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)" />

  <Target Name="AndroidBuildApp" AfterTargets="$(AndroidBuildAppAfterThisTarget)" />

  <Target Name="_AndroidCoreBuild" BeforeTargets="AndroidBuildApp" DependsOnTargets="$(AndroidBuildAppDependsOn)" />

  <Target Name="_InitializeCommonProperties">
    <Error Condition="'$(IntermediateOutputPath)' == ''" Text="%24(IntermediateOutputPath) property needs to be set" />

    <PropertyGroup>
      <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile'))</_MobileIntermediateOutputPath>
    </PropertyGroup>
  </Target>

  <Target Name="_BeforeAndroidBuildApp">
    <PropertyGroup>
      <_AndroidRuntimeConfigFilePath Condition="'$(_AndroidRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AndroidAppDir), '$(AssemblyName).runtimeconfig.json'))</_AndroidRuntimeConfigFilePath>
      <_ParsedRuntimeConfigFilePath Condition="'$(_ParsedRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AndroidAppDir), 'runtimeconfig.bin'))</_ParsedRuntimeConfigFilePath>
    </PropertyGroup>

    <RemoveDir Directories="$(AndroidAppBundleDir)" />
  </Target>

  <Target Name="_AndroidResolveReferences">
    <ItemGroup>
      <_AndroidAssembliesInternal Remove="@(_AndroidAssembliesInternal)" />
      <_AndroidAssembliesInternal Include="@(AndroidAssembliesToBundle)">
        <_InternalForceInterpret>%(AndroidAssembliesToBundle._InternalForceInterpret)</_InternalForceInterpret>
        <_IsNative>%(AndroidAssembliesToBundle._IsNative)</_IsNative>
      </_AndroidAssembliesInternal>
    </ItemGroup>
  </Target>

  <Target Name="_AndroidBeforeAotCompileApp">
    <PropertyGroup>
      <_AOTMode Condition="'$(UseMonoJustInterp)' != 'true'">Normal</_AOTMode>
      <_AOTMode Condition="'$(UseMonoJustInterp)' == 'true'">JustInterp</_AOTMode>
      <_AOTMode Condition="'$(ForceFullAOT)' == 'true'">Full</_AOTMode>
    </PropertyGroup>

    <ItemGroup>
      <MonoAOTCompilerDefaultAotArguments Condition="'$(TargetArchitecture)' == 'arm'" Include="mtriple=armv7-linux-gnueabi" />
      <MonoAOTCompilerDefaultAotArguments Condition="'$(TargetArchitecture)' == 'arm64'" Include="mtriple=aarch64-linux-android" />
      <MonoAOTCompilerDefaultAotArguments Condition="'$(TargetArchitecture)' == 'x86'" Include="mtriple=i686-linux-android" />
      <MonoAOTCompilerDefaultAotArguments Condition="'$(TargetArchitecture)' == 'x64'" Include="mtriple=x86_64-linux-android" />
  
      <MonoAOTCompilerDefaultAotArguments Include="static" />
      <MonoAOTCompilerDefaultAotArguments Include="dwarfdebug" />

      <MonoAOTCompilerDefaultAotArguments Include="nimt-trampolines=2000" />
      <MonoAOTCompilerDefaultAotArguments Include="ntrampolines=10000" />
      <MonoAOTCompilerDefaultAotArguments Include="nrgctx-fetch-trampolines=256" />
      <MonoAOTCompilerDefaultAotArguments Include="ngsharedvt-trampolines=4400" />
      <MonoAOTCompilerDefaultAotArguments Include="nftnptr-arg-trampolines=4000" />
      <MonoAOTCompilerDefaultAotArguments Include="nrgctx-trampolines=31000" />
    </ItemGroup>

    <PropertyGroup>
      <AotArguments>@(MonoAOTCompilerDefaultAotArguments, ';')</AotArguments>
      <ProcessArguments>@(MonoAOTCompilerDefaultProcessArguments, ';')</ProcessArguments>
    </PropertyGroup>

    <ItemGroup>
      <_AotInputAssemblies Include="@(_AndroidAssembliesInternal)" 
                           Condition="'%(_AndroidAssembliesInternal._InternalForceInterpret)' != 'true'">
        <AotArguments>$(AotArguments)</AotArguments>
        <ProcessArguments>$(ProcessArguments)</ProcessArguments>
      </_AotInputAssemblies>

      <_AOT_InternalForceInterpretAssemblies Include="@(_AndroidAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" />
      <_AndroidAssembliesInternal Remove="@(_AndroidAssembliesInternal)" />
    </ItemGroup>
    
    <MakeDir Directories="$(_MobileIntermediateOutputPath)" />
  </Target>

  <Target Name="_AndroidPrepareProfiledAot"
          Condition="'$(NetTraceFilePath)' != '' and '$(ForceFullAOT)' != 'true'"
          DependsOnTargets="_AndroidBeforeAotCompileApp">
    <PropertyGroup>
      <_ToolPath>$([System.IO.Path]::GetDirectoryName('$(DotnetPgoToolPath)'))</_ToolPath>
    </PropertyGroup>

    <NetTraceToMibcConverter
      ToolPath="$(_ToolPath)"
      Assemblies="@(_AotInputAssemblies)"
      NetTraceFilePath="$(NetTraceFilePath)"
      OutputDir="$(_MobileIntermediateOutputPath)">
      <Output TaskParameter="MibcFilePath" ItemName="ProfiledAOTProfilePaths" />
    </NetTraceToMibcConverter>
  </Target>

  <Target Name="_AndroidAotCompileApp"
          Condition="'$(RunAOTCompilation)' == 'true'"
          DependsOnTargets="_AndroidBeforeAotCompileApp">

    <ItemGroup>
      <ProfiledAOTProfilePaths Include="$(MibcFilePath)" />
    </ItemGroup>

    <MonoAOTCompiler
        CompilerBinaryPath="@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','$(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())'))"
        OutputDir="$(_MobileIntermediateOutputPath)"
        Mode="$(_AOTMode)"
        OutputType="AsmOnly"
        Assemblies="@(_AotInputAssemblies)"
        AotModulesTablePath="$(AndroidAppBundleDir)\modules.c"
        IntermediateOutputPath="$(_MobileIntermediateOutputPath)"
        MibcProfilePath="@(ProfiledAOTProfilePaths)"
        UseLLVM="$(MonoEnableLLVM)"
        LLVMPath="$(MonoAotCrossDir)">
        <Output TaskParameter="CompiledAssemblies" ItemName="_AndroidAssembliesInternal" />
    </MonoAOTCompiler>

    <ItemGroup>
      <_AndroidAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" />
    </ItemGroup>
  </Target>

  <Target Name="_AndroidGenerateAppBundle" DependsOnTargets="_AndroidGenerateRuntimeConfig">

    <AndroidAppBuilderTask
        RuntimeIdentifier="$(RuntimeIdentifier)"
        ProjectName="$(AssemblyName)"
        MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0"
        Assemblies="@(_AndroidAssembliesInternal)"
        MainLibraryFileName="$(MainLibraryFileName)"
        IncludeNetworkSecurityConfig="$(IncludeNetworkSecurityConfig)"
        EnvironmentVariables="@(AndroidEnv)"
        ForceAOT="$(RunAOTCompilation)"
        ForceFullAOT="$(ForceFullAOT)"
        ForceInterpreter="$(MonoForceInterpreter)"
        StripDebugSymbols="False"
        RuntimeComponents="$(RuntimeComponents)"
        DiagnosticPorts="$(DiagnosticPorts)"
        OutputDir="$(AndroidAppBundleDir)"
        AppDir="$(AndroidAppDir)">
        <Output TaskParameter="ApkPackageId"  PropertyName="ApkPackageId" />
        <Output TaskParameter="ApkBundlePath" PropertyName="ApkBundlePath" />
    </AndroidAppBuilderTask>

    <Message Importance="High" Text="PackageId:       $(ApkPackageId)"/>
    <Message Importance="High" Text="Instrumentation: net.dot.MonoRunner"/>
    <Message Importance="High" Text="Apk:             $(ApkBundlePath)"/>
  </Target>

  <Target Name="_AfterAndroidBuildApp">
    
  </Target>

  <Target Name="_AndroidGenerateRuntimeConfig"
          Inputs="$(_AndroidRuntimeConfigFilePath)"
          Outputs="$(_ParsedRuntimeConfigFilePath)"
          Condition="Exists('$(_AndroidRuntimeConfigFilePath)')">
    <ItemGroup>
      <_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/>
      <_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/>
    </ItemGroup>

    <RuntimeConfigParserTask
        RuntimeConfigFile="$(_AndroidRuntimeConfigFilePath)"
        OutputFile="$(_ParsedRuntimeConfigFilePath)"
        RuntimeConfigReservedProperties="@(_RuntimeConfigReservedProperties)">
    </RuntimeConfigParserTask>
  </Target>
</Project>