Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<AndroidToolPath Condition=" '$(AndroidToolPath)' == '' ">$(AndroidSdkFullPath)\tools</AndroidToolPath>
<AndroidToolsBinPath Condition=" '$(AndroidToolsBinPath)' == '' ">$(AndroidToolPath)\bin</AndroidToolsBinPath>
<AndroidToolExe Condition=" '$(AndroidToolExe)' == '' ">android</AndroidToolExe>
<EmulatorToolPath Condition=" '$(EmulatorToolPath)' == '' ">$(AndroidSdkFullPath)\tools</EmulatorToolPath>
<EmulatorToolPath Condition=" '$(EmulatorToolPath)' == '' ">$(AndroidSdkFullPath)\emulator</EmulatorToolPath>
<EmulatorToolExe Condition=" '$(EmulatorToolExe)' == '' ">emulator</EmulatorToolExe>
<NdkBuildPath Condition=" '$(NdkBuildPath)' == '' And '$(HostOS)' != 'Windows' ">$(AndroidNdkDirectory)\ndk-build</NdkBuildPath>
<NdkBuildPath Condition=" '$(NdkBuildPath)' == '' And '$(HostOS)' == 'Windows' ">$(AndroidNdkDirectory)\ndk-build.cmd</NdkBuildPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected override string GenerateCommandLineCommands ()

protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance)
{
base.LogEventsFromTextOutput (singleLine, messageImportance);
Log.LogMessage (MessageImportance.Low, singleLine);
Lines.Add (singleLine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ public class CreateAndroidEmulator : Task

public string TargetId {get; set;}

public string ImageName {get; set;} = "XamarinAndroidTestRunner";
public string ImageName {get; set;} = "XamarinAndroidTestRunner";

public string DataPartitionSizeMB {get; set;} = "2048";
public string RamSizeMB {get; set;} = "2048";


public override bool Execute ()
{
Expand Down Expand Up @@ -68,6 +72,29 @@ void Run (string android)

var arguments = $"create avd --abi {AndroidAbi} -f -n {ImageName} --package \"{TargetId}\"";
Exec (android, arguments);

string configPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".android", "avd", $"{ImageName}.avd", "config.ini");
if (!File.Exists (configPath)) {
Log.LogWarning ($"Config file for AVD '{ImageName}' not found at {configPath}");
Log.LogWarning ($"AVD '{ImageName}' will use default emulator settings (memory and data partition size)");
return;
}

ulong diskSize;
if (!UInt64.TryParse (DataPartitionSizeMB, out diskSize))
Log.LogError ($"Invalid data partition size '{DataPartitionSizeMB}' - must be a positive integer value expressing size in megabytes");

ulong ramSize;
if (!UInt64.TryParse (RamSizeMB, out ramSize))
Log.LogError ($"Invalid RAM size '{RamSizeMB}' - must be a positive integer value expressing size in megabytes");

if (Log.HasLoggedErrors)
return;

File.AppendAllLines (configPath, new string[] {
$"disk.dataPartition.size={diskSize}M",
$"hw.ramSize={ramSize}"
});
}

StreamWriter stdin;
Expand Down
10 changes: 5 additions & 5 deletions build-tools/android-toolchain/android-toolchain.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<HostOS>Linux</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-linux-4266726">
<AndroidSdkItem Include="emulator-linux-4969155">
<HostOS>Linux</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
Expand All @@ -42,7 +42,7 @@
<HostOS>Darwin</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-darwin-4266726">
<AndroidSdkItem Include="emulator-darwin-4969155">
<HostOS>Darwin</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
Expand All @@ -61,7 +61,7 @@
<HostOS>Windows</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-windows-4266726">
<AndroidSdkItem Include="emulator-windows-4969155">
<HostOS>Windows</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
Expand Down Expand Up @@ -151,10 +151,10 @@
<HostOS></HostOS>
<DestDir>extras\android\m2repository</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="x86-21_r05">
<AndroidSdkItem Include="x86-28_r04">
<HostOS></HostOS>
<RelUrl>sys-img/android/</RelUrl>
<DestDir>system-images\android-21\default\x86</DestDir>
<DestDir>system-images\android-28\default\x86</DestDir>
</AndroidSdkItem>
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion build-tools/scripts/TestApks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
AndroidAbi="x86"
AndroidSdkHome="$(AndroidSdkDirectory)"
JavaSdkHome="$(JavaSdkDirectory)"
SdkVersion="21"
SdkVersion="28"
ImageName="$(_TestImageName)"
ToolExe="$(AvdManagerToolExe)"
ToolPath="$(AndroidToolsBinPath)"
RamSizeMB="2048"
DataPartitionSizeMB="2048"
/>
<StartAndroidEmulator
Condition=" '$(_ValidAdbTarget)' != 'True' "
Expand Down