107 lines
5.7 KiB
XML
107 lines
5.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<PropertyGroup>
|
|
|
|
<!-- REQUIRED PROPERTIES / ENVIRONMENT VARIABLES
|
|
|
|
INPUT_DLL = semi-colon separated list of DLLs to convert using Bluebonnet
|
|
e.g. /path/to/MyGame.exe;/path/to/MySupportLib.dll
|
|
|
|
INPUT_DLL_1 .. INPUT_DLL_9 = same as INPUT_DLL
|
|
|
|
EXTRA_JAR = semi-colon separated list of additional JARs to bundle in the APK
|
|
e.g. /path/to/Baselib.jar;/path/to/BNA.jar
|
|
|
|
EXTRA_JAR_1 .. EXTRA_JAR_9 = same as EXTRA_JAR
|
|
|
|
CONTENT_DIR = path to Content directory
|
|
e.g. $(OutputDir)/MyGame/Debug/Content
|
|
|
|
ICON_PNG = path to a PNG file to use as the app icon
|
|
|
|
APK_OUTPUT = path to copy the final APK
|
|
e.g. $(OutputDir)/MyGame.apk
|
|
|
|
APK_TEMP_DIR = directory where APK processing occurs
|
|
e.g. $(OutputDir)/MyGame/Debug/Content
|
|
|
|
KEYSTORE_FILE = path to a keystore file used in APK signing
|
|
|
|
KEYSTORE_PWD = password for keystore file
|
|
|
|
ANDROID_MANIFEST = path to AndroidManifest.xml file
|
|
|
|
BLUEBONNET_EXE = path to Bluebonnet.exe program file
|
|
|
|
BLUEBONNET_JAR = path to Baselib.jar file from Bluebonnet
|
|
|
|
ANDROID_JAR = path to Android.jar file, for desired API level
|
|
e.g. $(ANDROID_HOME)/android-28/android.jar
|
|
|
|
ANDROID_BUILD = path to a build tools directory, for desired tools version
|
|
e.g. $(ANDROID_HOME)/build-tools/30.0.2
|
|
|
|
-->
|
|
|
|
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<InputDll Include="$(INPUT_DLL);$(INPUT_DLL_1);$(INPUT_DLL_2);$(INPUT_DLL_3);$(INPUT_DLL_4);$(INPUT_DLL_5);$(INPUT_DLL_6);$(INPUT_DLL_7);$(INPUT_DLL_8);$(INPUT_DLL_9)" />
|
|
<ExtraJar Include="$(EXTRA_JAR);$(EXTRA_JAR_1);$(EXTRA_JAR_2);$(EXTRA_JAR_3);$(EXTRA_JAR_4);$(EXTRA_JAR_5);$(EXTRA_JAR_6);$(EXTRA_JAR_7);$(EXTRA_JAR_8);$(EXTRA_JAR_9)" />
|
|
<ContentDir Include="$(CONTENT_DIR)">
|
|
<DirName>%(ContentDir.Filename)%(ContentDir.Extension)</DirName>
|
|
</ContentDir>
|
|
<ContentFiles Include="$(CONTENT_DIR)/**/*" />
|
|
</ItemGroup>
|
|
|
|
<Target Name="CoreCompile">
|
|
|
|
<Error Condition="(! Exists($(ICON_PNG)))"
|
|
Text="Cannot find icon PNG file at '$(ICON_PNG)' using property ICON_PNG."/>
|
|
<Error Condition="(! Exists($(CONTENT_DIR)))"
|
|
Text="Cannot find game content folder at '$(CONTENT_DIR)' using property CONTENT_DIR."/>
|
|
<Error Condition="(! Exists($(ANDROID_MANIFEST)))"
|
|
Text="Cannot find Android manifest file at '$(ANDROID_MANIFEST)' using property ANDROID_MANIFEST."/>
|
|
<Error Condition="(! Exists($(KEYSTORE_FILE)))"
|
|
Text="Cannot find keystroke file at '$(KEYSTORE_FILE)' using property KEYSTORE_FILE."/>
|
|
<Error Condition="(! Exists($(BLUEBONNET_EXE)))"
|
|
Text="Cannot find Bluebonnet program file at '$(BLUEBONNET_EXE)' using property BLUEBONNET_EXE."/>
|
|
<Error Condition="(! Exists($(ANDROID_JAR)))"
|
|
Text="Cannot find Android platform JAR file at '$(ANDROID_JAR)' using property ANDROID_JAR."/>
|
|
<Error Condition="(! Exists('$(ANDROID_BUILD)/aapt.exe')) and (! Exists('$(ANDROID_BUILD)/aapt'))"
|
|
Text="Cannot find Android build tools at '$(ANDROID_BUILD)' using property ANDROID_BUILD."/>
|
|
|
|
<Error Condition="'$(APK_OUTPUT)' == ''"
|
|
Text="The APK_OUTPUT property should specify the output location."/>
|
|
<Error Condition="'$(APK_TEMP_DIR)' == ''"
|
|
Text="The APK_TEMP_DIR property should specify a temporary directory."/>
|
|
<Error Condition="'$(KEYSTORE_PWD)' == ''"
|
|
Text="The KEYSTORE_PWD property should specify a the keystore password."/>
|
|
|
|
<CreateProperty Value="%(ContentDir.DirName)">
|
|
<Output TaskParameter="Value" PropertyName="CONTENT_SUBDIR" />
|
|
</CreateProperty>
|
|
|
|
<RemoveDir Directories="$(APK_TEMP_DIR)" />
|
|
<MakeDir Directories="$(APK_TEMP_DIR)" />
|
|
|
|
<Exec Command=""$(BLUEBONNET_EXE)" "%(InputDll.FullPath)" "$(APK_TEMP_DIR)/classes.jar"" />
|
|
<Exec Command=""$(ANDROID_BUILD)/d8" --release --lib "$(ANDROID_JAR)" "$(APK_TEMP_DIR)/classes.jar" "@(ExtraJar,'" "')" --output "$(APK_TEMP_DIR)""
|
|
Condition="'@(ExtraJar)' != ''" />
|
|
<Exec Command=""$(ANDROID_BUILD)/d8" --release --lib "$(ANDROID_JAR)" "$(APK_TEMP_DIR)/classes.jar" --output "$(APK_TEMP_DIR)""
|
|
Condition="'@(ExtraJar)' == ''" />
|
|
<Copy SourceFiles="@(ContentFiles)" DestinationFolder="$(APK_TEMP_DIR)/assets/$(CONTENT_SUBDIR)" SkipUnchangedFiles="true" />
|
|
<Copy SourceFiles="$(ICON_PNG)" DestinationFiles="$(APK_TEMP_DIR)/res/drawable/icon.png" SkipUnchangedFiles="true" />
|
|
<Exec Command=""$(ANDROID_BUILD)/aapt" package -f -F "$(APK_TEMP_DIR)/unaligned.apk" -M "$(ANDROID_MANIFEST)" -S "$(APK_TEMP_DIR)/res" -I "$(ANDROID_JAR)"" />
|
|
<Exec Command=""$(ANDROID_BUILD)/aapt" add "unaligned.apk" classes.dex" WorkingDirectory="$(APK_TEMP_DIR)" />
|
|
<Exec Command=""$(ANDROID_BUILD)/aapt" add "unaligned.apk" assets/$(CONTENT_SUBDIR)/%(ContentFiles.RecursiveDir)%(ContentFiles.Filename)%(ContentFiles.Extension)" WorkingDirectory="$(APK_TEMP_DIR)" />
|
|
<Exec Command=""$(ANDROID_BUILD)/zipalign" -f 4 "$(APK_TEMP_DIR)/unaligned.apk" "$(APK_TEMP_DIR)/aligned.apk"" />
|
|
<Exec Command=""$(ANDROID_BUILD)/apksigner" sign --ks "$(KEYSTORE_FILE)" --ks-pass "pass:$(KEYSTORE_PWD)" "$(APK_TEMP_DIR)/aligned.apk"" />
|
|
<!-- copy the final APK -->
|
|
<Copy SourceFiles="$(APK_TEMP_DIR)/aligned.apk" DestinationFiles="$(APK_OUTPUT)" />
|
|
|
|
</Target>
|
|
|
|
</Project>
|