Delphi中,如果生成Android或者IOS等APP,需要在Project -> Deployment中按下Deploy图标 ,然后就会生成和项目工程文件名称一致,后缀是.deployproj的文件。当然如果直接按下运行图标(RUN)也会自动生成这个文件。
一、.deployproj文件整体结构
后缀为.deployproj的文件是一个XML文件。
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="Exists('$(BDS)\bin\CodeGear.Deployment.targets')" Project="$(BDS)\bin\CodeGear.Deployment.targets"/>
<ProjectExtensions>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<PropertyGroup>
<DeviceId Condition="'$(Platform)'=='Android'">fe7cdd09</DeviceId>
<DeviceId Condition="'$(Platform)'=='Android64'">fe7cdd09</DeviceId>
<DeviceId Condition="'$(Platform)'=='iOSDevice64'"/>
<DeviceId Condition="'$(Platform)'=='iOSSimARM64'"/>
</PropertyGroup>
<ItemGroup Condition="'$(Platform)'=='OSX64'"/>
<ItemGroup Condition="'$(Platform)'=='Android64'"/>
<ItemGroup Condition="'$(Platform)'=='OSXARM64'"/>
<ItemGroup Condition="'$(Platform)'=='Android'">
<DeployFile Include="$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png" Condition="'$(Config)'=='Release'">
<RemoteDir>FMX_DEMO\res\drawable-large\</RemoteDir>
<RemoteName>splash_image.png</RemoteName>
<DeployClass>Android_SplashImage640</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="Android\Debug\Android32_Debug\splash_image_def.xml" Condition="'$(Config)'=='Debug'">
<RemoteDir>FMX_DEMO\res\drawable\</RemoteDir>
<RemoteName>splash_image_def.xml</RemoteName>
<DeployClass>AndroidSplashImageDef</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
...
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='Win32'">
<DeployFile Include="Win32\Debug\FMX_DEMO.exe" Condition="'$(Config)'=='Debug'">
<RemoteDir>FMX_DEMO\</RemoteDir>
<RemoteName>FMX_DEMO.exe</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='Win64'">
<DeployFile Include="Win64\Debug\FMX_DEMO.exe" Condition="'$(Config)'=='Debug'">
<RemoteDir>FMX_DEMO\</RemoteDir>
<RemoteName>FMX_DEMO.exe</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
<DeployFile Include="\\Mac\Home\Documents\sensorwu\iCenter\Delphi_AutoBuilder\VCL\VCL_DEMO - 副本.txt" Condition="'$(Config)'=='Debug'">
<RemoteDir>FMX_DEMO\</RemoteDir>
<RemoteName>VCL_DEMO - 副本.txt</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='Linux64'"/>
<ItemGroup Condition="'$(Platform)'=='iOSDevice64'"/>
<ItemGroup Condition="'$(Platform)'=='iOSSimARM64'"/>
</Project>
包含的节点说明
序号 | 节点 | 说明 |
1 | <Project> | 根节点,只有一个 |
2 | <ProjectExtensions> | 项目扩展,只有一个节点 |
3 | <PropertyGroup> | 属性组节点,表示当前工程支持的平台,里边包含<DeviceId>节点,一个节点表示一个移动平台设备。有text属性的,表示连接设备的ID。例如本示例的:fe7cdd09 |
4 | <ItemGroup> | 表示某个平台包含的资源文件,里边<DeployFile>节点表示需要分发的文件。如果没有<DeployFile>节点表示该平台没有需要下发的文件(例如上面的OSX64、Android64等等),如果有这个节点(可以多个),一个节点表示一个文件资源,例如:Android |
<DeployFile>节点说明 | ||
1 | Include 属性 | 表示包含的文件 |
2 | Condition 属性 | 表示构建的是Release还是Debug |
3 | <RemoteDir> | 子节点:表示文件下发到设备的目录 |
4 | <RemoteName> | 字节点:表示文件下发到设备的名称 |
5 | <DeployClass> | 子节点:字面意思表示下发的类型,实际就是预先定义的名称 |
... | ... |
二、Android下发图标的目录及类型
序号 | 名称 | <RemoteDir> | <RemoteName> | <DeployClass> |
1 | 36x36ldpi | res\drawable-ldpi\ | ic_launcher.png | Android_LauncherIcon36 |
2 | 48x48mdpi | res\drawable-mdpi\ | Android_LauncherIcon48 | |
3 | 72x72hdpi | res\drawable-hdpi\ | Android_LauncherIcon72 | |
4 | 96x96xhdpi | res\drawable-xhdpi\ | Android_LauncherIcon96 | |
5 | 144x144xxhdpi | res\drawable-xxhdpi\ | Android_LauncherIcon144 | |
6 | 192x192xxxhdpi | res\drawable-xxxhdpi\ | Android_LauncherIcon192 | |
7 | 24x24mdpi | res\drawable-mdpi\ | ic_notification.png | Android_NotificationIcon24 |
8 | 36x36hdpi | res\drawable-hdpi\ | Android_NotificationIcon36 | |
9 | 48x48xhdpi | res\drawable-xhdpi\ | Android_NotificationIcon48 | |
10 | 72x72xxhdpi | res\drawable-xxhdpi\ | Android_NotificationIcon72 | |
11 | 96x96xxxhdpi | res\drawable-xxxhdpi\ | Android_NotificationIcon96 | |
12 | 426x320small | res\drawable-small\ | splash_image.png | Android_SplashImage426 |
13 | 470x320normal | res\drawable-normal\ | Android_SplashImage470 | |
14 | 640x480large | res\drawable-large\ | Android_SplashImage640 | |
15 | 960x720xlarge | res\drawable-xlarge\ | Android_SplashImage960 |
三、完整的<DeployFile>节点样例
<DeployFile Include="..\Document\ICON\访客预约备份72x72.png" Condition="'$(Config)'=='Debug'">
<RemoteDir>FMX_DEMO\res\drawable-hdpi\</RemoteDir>
<RemoteName>ic_launcher.png</RemoteName>
<DeployClass>Android_LauncherIcon72</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
说明:
如果实现自动构建,以上节点格式格式不要动;
增加一个分发图标,需要相应修改属性:Include和Condition;
需要根据实际情况修改子节点<RemoteDir>、<RemoteName>、<DeployClass>内容;
其他子节点照抄;