[nonet migration] permit to build nonet on master branch through NoNet Flavor

To select the NoNet Flavor, call MSBuild with the 'Flavor' Parameter.
For example MSBuild.exe ....... -p:Flavor=NoNet

For the "net" build, flavor value is "Net"

See: https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-build-the-same-source-files-with-different-options?view=vs-2019
This commit is contained in:
tenzap
2022-12-06 22:00:32 +01:00
parent 7b6ff73fb9
commit 06bd468658
8 changed files with 80 additions and 45 deletions

View File

@@ -14,6 +14,7 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<Flavor Condition=" '$(Flavor)' != '' ">$(Flavor)</Flavor>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
@@ -37,6 +38,13 @@
<JavaMaximumHeapSize>4G</JavaMaximumHeapSize>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup>
<Choose>
<When Condition=" '$(Flavor)'=='NoNet' ">
<PropertyGroup>
<DefineConstants>$(DefineConstants);NoNet;EXCLUDE_JAVAFILESTORAGE</DefineConstants>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseNoNet|AnyCPU'">
<OutputPath>bin\ReleaseNoNet\</OutputPath>
<DefineConstants>TRACE;NoNet;EXCLUDE_JAVAFILESTORAGE</DefineConstants>
@@ -54,10 +62,26 @@
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup Condition=" '$(Flavor)'!='NoNet' ">
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Condition=" '$(Flavor)'!='NoNet' ">
<Compile Include="Io\DropboxFileStorage.cs" />
<Compile Include="Io\DropboxFileStorageKeys.cs" />
<Compile Include="Io\GDriveFileStorage.cs" />
<Compile Include="Io\JavaFileStorage.cs" />
<Compile Include="Io\MegaFileStorage.cs" />
<Compile Include="Io\NetFtpFileStorage.cs" />
<Compile Include="Io\OneDrive2FileStorage.cs" />
<Compile Include="Io\OneDrive2PrefixContainer.cs" />
<Compile Include="Io\PCloudFileStorage.cs" />
<Compile Include="Io\SftpFileStorage.cs" />
<Compile Include="Io\OneDriveFileStorage.cs" />
<Compile Include="Io\WebDavFileStorage.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="database\CheckDatabaseForChanges.cs" />
<Compile Include="database\edit\AddTemplateEntries.cs" />
@@ -78,24 +102,12 @@
<Compile Include="Io\AndroidContentStorage.cs" />
<Compile Include="Io\BuiltInFileStorage.cs" />
<Compile Include="Io\CachingFileStorage.cs" />
<Compile Include="Io\DropboxFileStorage.cs" />
<Compile Include="Io\DropboxFileStorageKeys.cs" />
<Compile Include="Io\FileDescription.cs" />
<Compile Include="Io\FileStorageSetupActivity.cs" />
<Compile Include="Io\FileStorageSetupInitiatorActivity.cs" />
<Compile Include="Io\GDriveFileStorage.cs" />
<Compile Include="Io\IFileStorage.cs" />
<Compile Include="Io\IoUtil.cs" />
<Compile Include="Io\JavaFileStorage.cs" />
<Compile Include="Io\MegaFileStorage.cs" />
<Compile Include="Io\NetFtpFileStorage.cs" />
<Compile Include="Io\OfflineSwitchableFileStorage.cs" />
<Compile Include="Io\OneDrive2FileStorage.cs" />
<Compile Include="Io\OneDrive2PrefixContainer.cs" />
<Compile Include="Io\PCloudFileStorage.cs" />
<Compile Include="Io\SftpFileStorage.cs" />
<Compile Include="Io\OneDriveFileStorage.cs" />
<Compile Include="Io\WebDavFileStorage.cs" />
<Compile Include="IProgressDialog.cs" />
<Compile Include="PreferenceKey.cs" />
<Compile Include="SelectStorageLocationActivityBase.cs" />
@@ -130,7 +142,7 @@
<Compile Include="Utils\Spr\SprEngine.cs" />
<Compile Include="Utils\Spr\SprEngine.PickChars.cs" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition=" '$(Flavor)'!='NoNet' ">
<ProjectReference Include="..\AndroidFileChooserBinding\AndroidFileChooserBinding.csproj">
<Project>{3c0f7fe5-639f-4422-a087-8b26cf862d1b}</Project>
<Name>AndroidFileChooserBinding</Name>
@@ -139,6 +151,12 @@
<Project>{48574278-4779-4b3a-a9e4-9cf1bc285d0b}</Project>
<Name>JavaFileStorageBindings</Name>
</ProjectReference>
<ProjectReference Include="..\PCloudBindings\PCloudBindings.csproj">
<Project>{2db80c77-d46f-4970-b967-e9ffa9b2ac2e}</Project>
<Name>PCloudBindings</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">
<Project>{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}</Project>
<Name>KeePassLib2Android</Name>
@@ -147,10 +165,6 @@
<Project>{70D3844A-D9FA-4A64-B205-A84C6A822196}</Project>
<Name>KP2AKdbLibraryBinding</Name>
</ProjectReference>
<ProjectReference Include="..\PCloudBindings\PCloudBindings.csproj">
<Project>{2db80c77-d46f-4970-b967-e9ffa9b2ac2e}</Project>
<Name>PCloudBindings</Name>
</ProjectReference>
<ProjectReference Include="..\TwofishCipher\TwofishCipher.csproj">
<Project>{5CF675A5-9BEE-4720-BED9-D5BF14A2EBF9}</Project>
<Name>TwofishCipher</Name>
@@ -162,7 +176,7 @@
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition=" '$(Flavor)'!='NoNet' ">
<PackageReference Include="FluentFTP">
<Version>31.3.1</Version>
</PackageReference>
@@ -178,6 +192,8 @@
<PackageReference Include="Microsoft.Identity.Client">
<Version>4.8.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Android.Arch.Core.Common">
<Version>1.1.1.3</Version>
</PackageReference>
@@ -292,4 +308,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View File

@@ -87,7 +87,8 @@ namespace keepass2android
if (context.Intent.GetBooleanExtra(AllowThirdPartyAppSend, false))
_displayedProtocolIds.Add("androidsend");
#if NoNet
_displayedProtocolIds.Add("kp2a");
//don't display "get regular version", is classified as deceptive ad by Google. Haha.
//_displayedProtocolIds.Add("kp2a");
#endif
_displayedProtocolIds = _displayedProtocolIds.GroupBy(p => App.Kp2a.GetStorageMainTypeDisplayName(p))
.Select(g => string.Join(",", g)).ToList();
@@ -272,4 +273,4 @@ namespace keepass2android
_design.ReapplyTheme();
}
}
}
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="93"
android:versionName="1.01-g"
android:versionCode="186"
android:versionName="1.09d-r0"
package="keepass2android.keepass2android_nonet"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">
@@ -40,9 +40,9 @@
</intent>
</queries>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="30" />
<permission android:description="@string/permission_desc2" android:icon="@drawable/ic_launcher" android:label="KP2A entry search" android:name="keepass2android.keepass2android_nonet.permission.KP2aInternalSearch" android:protectionLevel="signature" />
<permission android:description="@string/permission_desc3" android:icon="@drawable/ic_launcher" android:label="KP2A choose autofill dataset" android:name="keepass2android.keepass2android_nonet.permission.Kp2aChooseAutofill" android:protectionLevel="signature" />
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="30" />
<permission android:description="@string/permission_desc2" android:icon="@drawable/ic_launcher_offline" android:label="KP2A entry search" android:name="keepass2android.keepass2android_nonet.permission.KP2aInternalSearch" android:protectionLevel="signature" />
<permission android:description="@string/permission_desc3" android:icon="@drawable/ic_launcher_offline" android:label="KP2A choose autofill dataset" android:name="keepass2android.keepass2android_nonet.permission.Kp2aChooseAutofill" android:protectionLevel="signature" />
<application
android:label="keepass2android"
android:icon="@mipmap/ic_launcher_offline"
@@ -241,10 +241,9 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="keepass2android.keepass2android.permission.KP2aInternalFileBrowsing" />
<uses-permission android:name="keepass2android.keepass2android.permission.KP2aInternalSearch" />
<uses-permission android:name="keepass2android.keepass2android_nonet.permission.KP2aInternalFileBrowsing" />
<uses-permission android:name="keepass2android.keepass2android_nonet.permission.KP2aInternalSearch" />
<!-- Samsung Pass permission -->
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -26,14 +26,8 @@
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<Flavor Condition=" '$(Flavor)' != '' ">$(Flavor)</Flavor>
</PropertyGroup>
<Choose>
<When Condition=" '$(Configuration)'=='Release' ">
<PropertyGroup>
<AndroidManifest>Properties\AndroidManifest_net.xml</AndroidManifest>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>portable</DebugType>
@@ -74,6 +68,24 @@
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
</PropertyGroup>
<Choose>
<When Condition=" '$(Flavor)'=='Net' ">
<PropertyGroup>
<AndroidManifest>Properties\AndroidManifest_net.xml</AndroidManifest>
</PropertyGroup>
</When>
<When Condition=" '$(Flavor)'=='NoNet' ">
<PropertyGroup>
<AndroidManifest>Properties\AndroidManifest_nonet.xml</AndroidManifest>
<DefineConstants>$(DefineConstants);NoNet;EXCLUDE_JAVAFILESTORAGE</DefineConstants>
</PropertyGroup>
</When>
</Choose>
<ItemGroup Condition=" '$(Flavor)'=='NoNet' ">
<PackageReference Include="Newtonsoft.Json">
<Version>11.0.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Core">
<Version>1.5.0</Version>
@@ -632,8 +644,11 @@
<AndroidResource Include="Resources\drawable-xhdpi\ic_menu_download.png" />
<AndroidResource Include="Resources\drawable-xhdpi\ic_menu_share.png" />
<AndroidResource Include="Resources\drawable-xhdpi\ic_menu_upload.png" />
<AndroidResource Include="Resources\drawable-mdpi-v4\ic_launcher_offline.png" />
<AndroidResource Include="Resources\drawable-mdpi-v4\ic_launcher.png" />
<AndroidResource Include="Resources\drawable-hdpi-v4\ic_launcher_offline.png" />
<AndroidResource Include="Resources\drawable-hdpi-v4\ic_launcher.png" />
<AndroidResource Include="Resources\drawable-xhdpi-v4\ic_launcher_offline.png" />
<AndroidResource Include="Resources\drawable-xhdpi-v4\ic_launcher.png" />
</ItemGroup>
<ItemGroup>
@@ -1903,15 +1918,21 @@
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
</ItemGroup>
<ItemGroup Condition=" '$(Flavor)'!='NoNet' ">
<ProjectReference Include="..\JavaFileStorageBindings\JavaFileStorageBindings.csproj">
<Project>{48574278-4779-4b3a-a9e4-9cf1bc285d0b}</Project>
<Name>JavaFileStorageBindings</Name>
</ProjectReference>
<ProjectReference Include="..\PCloudBindings\PCloudBindings.csproj">
<Project>{2db80c77-d46f-4970-b967-e9ffa9b2ac2e}</Project>
<Name>PCloudBindings</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AndroidFileChooserBinding\AndroidFileChooserBinding.csproj">
<Project>{3c0f7fe5-639f-4422-a087-8b26cf862d1b}</Project>
<Name>AndroidFileChooserBinding</Name>
</ProjectReference>
<ProjectReference Include="..\JavaFileStorageBindings\JavaFileStorageBindings.csproj">
<Project>{48574278-4779-4b3a-a9e4-9cf1bc285d0b}</Project>
<Name>JavaFileStorageBindings</Name>
</ProjectReference>
<ProjectReference Include="..\KeePassLib2Android\KeePassLib2Android.csproj">
<Project>{545b4a6b-8bba-4fbe-92fc-4ac060122a54}</Project>
<Name>KeePassLib2Android</Name>
@@ -1928,10 +1949,6 @@
<Project>{a8779d4d-7c49-4c2f-82bd-2cdc448391da}</Project>
<Name>Kp2aKeyboardBinding</Name>
</ProjectReference>
<ProjectReference Include="..\PCloudBindings\PCloudBindings.csproj">
<Project>{2db80c77-d46f-4970-b967-e9ffa9b2ac2e}</Project>
<Name>PCloudBindings</Name>
</ProjectReference>
<ProjectReference Include="..\PluginSdkBinding\PluginSdkBinding.csproj">
<Project>{3da3911e-36de-465e-8f15-f1991b6437e5}</Project>
<Name>PluginSdkBinding</Name>

View File

@@ -12,7 +12,9 @@ using Java.Util;
using keepass2android.services.AutofillBase.model;
using System.Linq;
using Android.Content.PM;
#if !NoNet
using Com.Dropbox.Core.V2.Teamlog;
#endif
using AlertDialog = Android.App.AlertDialog;
namespace keepass2android.services.AutofillBase