choose/when fdroid conditional on packages

This commit is contained in:
Kyle Spearrin 2018-01-11 08:36:37 -05:00
parent 916b7ee46b
commit b3573f9482
3 changed files with 21 additions and 53 deletions

View File

@ -872,12 +872,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>42.1021.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Analytics">
<Version>42.1021.1</Version>
</PackageReference>
<PackageReference Include="SimpleInjector">
<Version>4.0.12</Version>
</PackageReference>
@ -888,6 +882,18 @@
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
<PackageReference Include="Plugin.CurrentActivity" Version="1.0.1" />
</ItemGroup>
<Choose>
<When Condition="'$(Configuration)' != 'FDroid'">
<ItemGroup>
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>42.1021.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Analytics">
<Version>42.1021.1</Version>
</PackageReference>
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<AndroidResource Include="Resources\drawable\bottom_nav_bg.xml" />
</ItemGroup>

View File

@ -1,7 +1,5 @@
$rootPath = $env:APPVEYOR_BUILD_FOLDER;
$androidPath = $($rootPath + "\src\Android\Android.csproj");
$appPath = $($rootPath + "\src\App\App.csproj");
echo "##### Increment Version"
@ -33,51 +31,8 @@ $signedApkDestPath = $($rootPath + "\com.x8bit.bitwarden-" + $env:APPVEYOR_BUILD
Copy-Item $signedApkPath $signedApkDestPath
echo "##### Clean Android and App"
msbuild "$($androidPath)" "/t:Clean" "/p:Configuration=FDroid"
msbuild "$($appPath)" "/t:Clean" "/p:Configuration=FDroid"
echo "##### Backup project files"
Copy-Item $androidPath $($androidPath + ".original");
Copy-Item $appPath $($appPath + ".original");
echo "##### Uninstall from Android.csproj"
$xml=New-Object XML;
$xml.Load($androidPath);
$ns=New-Object System.Xml.XmlNamespaceManager($xml.NameTable);
$ns.AddNamespace("ns", $xml.DocumentElement.NamespaceURI);
$firebaseNode=$xml.SelectSingleNode("/ns:Project/ns:ItemGroup/ns:PackageReference[@Include='Xamarin.Firebase.Messaging']", $ns);
$firebaseNode.ParentNode.RemoveChild($firebaseNode);
$playServiceNode=$xml.SelectSingleNode("/ns:Project/ns:ItemGroup/ns:PackageReference[@Include='Xamarin.GooglePlayServices.Analytics']", $ns);
$playServiceNode.ParentNode.RemoveChild($playServiceNode);
$xml.Save($androidPath);
echo "##### Uninstall from App.csproj"
$xml=New-Object XML;
$xml.Load($appPath);
$hockeyNode=$xml.SelectSingleNode("/Project/ItemGroup/PackageReference[@Include='HockeySDK.Xamarin']");
$hockeyNode.ParentNode.RemoveChild($hockeyNode);
$xml.Save($appPath);
echo "##### Restore NuGet"
$nugetPath = $($rootPath + "\nuget.exe");
Invoke-Expression "& `"$nugetPath`" restore"
echo "##### Build and Sign FDroid Configuration"
msbuild "$($androidPath)" "/logger:C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" "/p:Configuration=FDroid"
msbuild "$($androidPath)" "/t:SignAndroidPackage" "/p:Configuration=FDroid" "/p:AndroidKeyStore=true" "/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=$($env:keystore_password)" "/p:AndroidSigningKeyStore=8bit.keystore" "/p:AndroidSigningStorePass=$($env:keystore_password)" "/v:quiet"
echo "##### Copy FDroid apk to project root"

View File

@ -11,7 +11,7 @@
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)' == 'FDroid|netstandard2.0|AnyCPU'">
<DefineConstants>TRACE;FDROID;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)' == 'FDroid|net471|AnyCPU'">
<DefineConstants>TRACE;FDROID;NET471</DefineConstants>
</PropertyGroup>
@ -25,7 +25,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="HockeySDK.Xamarin" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="PCLCrypto" Version="2.0.147" />
<PackageReference Include="Plugin.Fingerprint" Version="1.4.6-beta4" />
@ -40,6 +39,14 @@
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.1.47" />
</ItemGroup>
<Choose>
<When Condition="'$(Configuration)' != 'FDroid'">
<ItemGroup>
<PackageReference Include="HockeySDK.Xamarin" Version="5.0.0" />
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Compile Update="Resources\AppResources.cs.Designer.cs">
<DependentUpon>AppResources.cs.resx</DependentUpon>