1
0
mirror of https://github.com/bitwarden/mobile synced 2024-12-27 09:15:54 +01:00

Tracing bundles (#842)

* Output to bundle (play store build only) and enable startup tracing

* Update ci build script to recognize bundle (.aab) for Google Play build

* Added bundle awareness to `appveyor.yml` and `Program.cs`

* Log upload exception

* Restore original apk creation alongside the bundle

* Remove link skip as AOT doesn't support linking
This commit is contained in:
Matt Portune 2020-04-17 17:06:37 -04:00 committed by GitHub
parent ae66a781d1
commit 5a78cbef02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 18 deletions

View File

@ -98,6 +98,7 @@ build_script:
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
.\src\Android\ci-build-apks.ps1
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Push-AppveyorArtifact .\com.x8bit.bitwarden.aab
Push-AppveyorArtifact .\com.x8bit.bitwarden.apk
Push-AppveyorArtifact .\com.x8bit.bitwarden-fdroid.apk
}
@ -114,7 +115,7 @@ on_success:
cd store\google\Publisher\bin\Release\netcoreapp2.0
dotnet Publisher.dll `
$env:APPVEYOR_BUILD_FOLDER\store\google\Publisher\play_creds.json `
$env:APPVEYOR_BUILD_FOLDER\com.x8bit.bitwarden.apk `
$env:APPVEYOR_BUILD_FOLDER\com.x8bit.bitwarden.aab `
alpha
cd $env:APPVEYOR_BUILD_FOLDER
}

View File

@ -19,7 +19,6 @@
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<AndroidLinkSkip>Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;BitwardenCore;Xamarin.Android.Net;Xamarin.Android.Net.OldAndroidSSLSocketFactory;LiteDB;Microsoft.AppCenter.Crashes</AndroidLinkSkip>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -45,7 +44,7 @@
<AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidLinkMode>Full</AndroidLinkMode>
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'FDroid|AnyCPU'">
<DebugSymbols>false</DebugSymbols>
@ -61,7 +60,7 @@
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidLinkMode>Full</AndroidLinkMode>
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
@ -89,7 +88,7 @@
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.1.0" />
<PackageReference Include="Xamarin.AndroidX.Migration" Version="1.0.2" />
<PackageReference Include="Xamarin.AndroidX.Migration" Version="1.0.4" />
<PackageReference Include="Xamarin.GooglePlayServices.SafetyNet">
<Version>71.1600.0</Version>
</PackageReference>

View File

@ -29,16 +29,33 @@ Invoke-Expression "& `"$secureFilePath`" -decrypt $($encKeystorePath) -secret $(
Invoke-Expression "& `"$secureFilePath`" -decrypt $($encUploadKeystorePath) -secret $($env:upload_keystore_dec_secret)"
echo "########################################"
echo "##### Sign Release Configuration"
echo "##### Sign Google Play Bundle Release Configuration"
echo "########################################"
msbuild "$($androidPath)" "/t:SignAndroidPackage" "/p:Configuration=Release" "/p:AndroidKeyStore=true" `
"/p:AndroidSigningKeyAlias=upload" "/p:AndroidSigningKeyPass=$($env:upload_keystore_password)" `
"/p:AndroidSigningKeyStore=upload-keystore.jks" "/p:AndroidSigningStorePass=$($env:upload_keystore_password)" `
"/v:quiet"
"/p:AndroidPackageFormat=aab" "/v:quiet"
echo "########################################"
echo "##### Copy Release apk to project root"
echo "##### Copy Google Play Bundle to project root"
echo "########################################"
$signedAabPath = $($rootPath + "\src\Android\bin\Release\com.x8bit.bitwarden-Signed.aab");
$signedAabDestPath = $($rootPath + "\com.x8bit.bitwarden.aab");
Copy-Item $signedAabPath $signedAabDestPath
echo "########################################"
echo "##### Sign APK Release Configuration"
echo "########################################"
msbuild "$($androidPath)" "/t:SignAndroidPackage" "/p:Configuration=Release" "/p:AndroidKeyStore=true" `
"/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=$($env:keystore_password)" `
"/p:AndroidSigningKeyStore=8bit.keystore" "/p:AndroidSigningStorePass=$($env:keystore_password)" "/v:quiet"
echo "########################################"
echo "##### Copy Release APK to project root"
echo "########################################"
$signedApkPath = $($rootPath + "\src\Android\bin\Release\com.x8bit.bitwarden-Signed.apk");

View File

@ -13,7 +13,7 @@ namespace Bit.Publisher
{
private const string Package = "com.x8bit.bitwarden";
private static string _apkFilePath;
private static string _aabFilePath;
private static string _credsFilePath;
private static string _track;
@ -27,7 +27,7 @@ namespace Bit.Publisher
try
{
_credsFilePath = args[0];
_apkFilePath = args[1];
_aabFilePath = args[1];
var track = args[2].Substring(0, 1).ToLower();
if (track == "a")
@ -83,31 +83,35 @@ namespace Bit.Publisher
Console.WriteLine("Created edit with id {0}.", edit.Id);
Apk apk = null;
using (var stream = new FileStream(_apkFilePath, FileMode.Open))
Bundle aab = null;
using (var stream = new FileStream(_aabFilePath, FileMode.Open))
{
var uploadMedia = service.Edits.Apks.Upload(Package, edit.Id, stream,
"application/vnd.android.package-archive");
var uploadMedia = service.Edits.Bundles.Upload(Package, edit.Id, stream,
"application/octet-stream");
var progress = await uploadMedia.UploadAsync();
if (progress.Status == Google.Apis.Upload.UploadStatus.Completed)
{
apk = uploadMedia.ResponseBody;
aab = uploadMedia.ResponseBody;
}
else
{
if (progress.Exception != null)
{
Console.WriteLine("Upload exception: {0}", progress.Exception);
}
throw new Exception("Upload failed.");
}
}
Console.WriteLine("Version code {0} has been uploaded.", apk.VersionCode);
Console.WriteLine("Version code {0} has been uploaded.", aab.VersionCode);
var trackRequest = service.Edits.Tracks.Update(new Track
{
TrackValue = _track,
Releases = new List<TrackRelease>
{
new TrackRelease { VersionCodes = new List<long?> { apk.VersionCode }, Status = "completed" }
new TrackRelease { VersionCodes = new List<long?> { aab.VersionCode }, Status = "completed" }
}
}, Package, edit.Id, _track);

View File

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Apis.AndroidPublisher.v3" Version="1.45.0.1908" />
<PackageReference Include="Google.Apis.AndroidPublisher.v3" Version="1.45.0.1916" />
</ItemGroup>
</Project>