Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix --useSqlite for mac scenarios #2241

Merged
merged 16 commits into from Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions NuGet.config
Expand Up @@ -4,10 +4,10 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-aspnetcore -->
<add key="darc-pub-dotnet-aspnetcore-b6bd323" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-aspnetcore-b6bd3236/nuget/v3/index.json" />
<add key="darc-pub-dotnet-aspnetcore-26e3dfc" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-aspnetcore-26e3dfc7/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-aspnetcore -->
<!-- Begin: Package sources from dotnet-efcore -->
<add key="darc-pub-dotnet-efcore-00e218a" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-efcore-00e218a9/nuget/v3/index.json" />
<add key="darc-pub-dotnet-efcore-09261bb" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-efcore-09261bb9/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-efcore -->
<!-- Package sources from dotnet-efcore -->
<!-- Package sources from dotnet-runtime -->
Expand Down
36 changes: 18 additions & 18 deletions eng/Version.Details.xml
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.23060.4">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22561.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ac5977ebf05451c1adcf24a15d16263e4d25fd0c</Sha>
<Sha>f36ea231c234560514ede4c2747897a737ced28f</Sha>
</Dependency>
</ToolsetDependencies>
<ProductDependencies>
<Dependency Name="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
<Dependency Name="Microsoft.EntityFrameworkCore.Design" Version="7.0.1">
<Uri>https://github.com/dotnet/efcore</Uri>
<Sha>00e218a90498c21ec14bbaf730a8954c03b42a34</Sha>
<Sha>09261bb997c0d82e121cd348d2e43f2b37a65848</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore" Version="7.0.3">
<Dependency Name="Microsoft.EntityFrameworkCore" Version="7.0.1">
<Uri>https://github.com/dotnet/efcore</Uri>
<Sha>00e218a90498c21ec14bbaf730a8954c03b42a34</Sha>
<Sha>09261bb997c0d82e121cd348d2e43f2b37a65848</Sha>
</Dependency>
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.3">
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.1">
deepchoudhery marked this conversation as resolved.
Show resolved Hide resolved
<Uri>https://github.com/dotnet/efcore</Uri>
<Sha>00e218a90498c21ec14bbaf730a8954c03b42a34</Sha>
<Sha>09261bb997c0d82e121cd348d2e43f2b37a65848</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.DependencyInjection" Version="7.0.2">
<Uri>https://github.com/dotnet/runtime</Uri>
Expand All @@ -27,9 +27,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha />
</Dependency>
<Dependency Name="Microsoft.Extensions.Identity.Stores" Version="7.0.3">
<Dependency Name="Microsoft.Extensions.Identity.Stores" Version="7.0.1">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>b6bd3236cda202c27f0f8b40900ba49aa725519e</Sha>
<Sha>26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.2">
<Uri>https://github.com/dotnet/runtime</Uri>
Expand All @@ -51,9 +51,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha />
</Dependency>
<Dependency Name="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.3">
<Dependency Name="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.1">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>b6bd3236cda202c27f0f8b40900ba49aa725519e</Sha>
<Sha>26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging.Console" Version="7.0.2">
<Uri>https://github.com/dotnet/runtime</Uri>
Expand All @@ -71,17 +71,17 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha />
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.3">
<Dependency Name="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.1">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>b6bd3236cda202c27f0f8b40900ba49aa725519e</Sha>
<Sha>26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.3">
<Dependency Name="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.1">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>b6bd3236cda202c27f0f8b40900ba49aa725519e</Sha>
<Sha>26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Identity.UI" Version="7.0.3">
<Dependency Name="Microsoft.AspNetCore.Identity.UI" Version="7.0.1">
<Uri>https://github.com/dotnet/aspnetcore</Uri>
<Sha>b6bd3236cda202c27f0f8b40900ba49aa725519e</Sha>
<Sha>26e3dfc7f3f3a91ba445ec0f8b1598d12542fb9f</Sha>
</Dependency>
</ProductDependencies>
</Dependencies>
18 changes: 9 additions & 9 deletions eng/Versions.props
Expand Up @@ -12,17 +12,17 @@
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>
<!-- Ref packages from darc subscriptions-->
<!-- Microsoft.EntityFrameworkCore.Design -->
<MicrosoftEntityFrameworkCoreDesignPackageVersion>7.0.3</MicrosoftEntityFrameworkCoreDesignPackageVersion>
<MicrosoftEntityFrameworkCoreDesignPackageVersion>7.0.1</MicrosoftEntityFrameworkCoreDesignPackageVersion>
<!-- Microsoft.EntityFrameworkCore -->
<MicrosoftEntityFrameworkCorePackageVersion>7.0.3</MicrosoftEntityFrameworkCorePackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>7.0.1</MicrosoftEntityFrameworkCorePackageVersion>
<!-- Microsoft.EntityFrameworkCore.SqlServer -->
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>7.0.3</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>7.0.1</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftExtensionsDependencyInjectionPackageVersion>
</MicrosoftExtensionsDependencyInjectionPackageVersion>
<MicrosoftExtensionsFileProvidersPhysicalPackageVersion>
</MicrosoftExtensionsFileProvidersPhysicalPackageVersion>
<!-- Microsoft.Extensions.Identity.Stores -->
<MicrosoftExtensionsIdentityStoresPackageVersion>7.0.3</MicrosoftExtensionsIdentityStoresPackageVersion>
<MicrosoftExtensionsIdentityStoresPackageVersion>7.0.1</MicrosoftExtensionsIdentityStoresPackageVersion>
<MicrosoftExtensionsConfigurationAbstractionsPackageVersion>
</MicrosoftExtensionsConfigurationAbstractionsPackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
Expand All @@ -34,7 +34,7 @@
<MicrosoftExtensionsDependencyModelPackageVersion>
</MicrosoftExtensionsDependencyModelPackageVersion>
<!-- Microsoft.Extensions.FileProviders.Embedded -->
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>7.0.3</MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>
<MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>7.0.1</MicrosoftExtensionsFileProvidersEmbeddedPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>
</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingDebugPackageVersion>
Expand All @@ -44,14 +44,14 @@
<MicrosoftExtensionsOptionsConfigurationExtensionsPackageVersion>
</MicrosoftExtensionsOptionsConfigurationExtensionsPackageVersion>
<!-- Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore -->
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>7.0.3</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>7.0.1</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<!-- Microsoft.AspNetCore.Identity.EntityFrameworkCore -->
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>7.0.3</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>7.0.1</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<!-- Microsoft.AspNetCore.Identity.UI -->
<MicrosoftAspNetCoreIdentityUIPackageVersion>7.0.3</MicrosoftAspNetCoreIdentityUIPackageVersion>
<MicrosoftAspNetCoreIdentityUIPackageVersion>7.0.1</MicrosoftAspNetCoreIdentityUIPackageVersion>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>7.0.2</VersionPrefix>
<VersionPrefix>7.0.3</VersionPrefix>
<PreReleaseVersionLabel>rtm</PreReleaseVersionLabel>
<IncludeSourceRevisionInInformationalVersion>False</IncludeSourceRevisionInInformationalVersion>
<IsServicingBuild Condition="'$(PreReleaseVersionLabel)' == 'servicing'">true</IsServicingBuild>
Expand Down
7 changes: 0 additions & 7 deletions eng/common/cross/toolchain.cmake
@@ -1,12 +1,5 @@
set(CROSS_ROOTFS $ENV{ROOTFS_DIR})

# reset platform variables (e.g. cmake 3.25 sets LINUX=1)
unset(LINUX)
unset(FREEBSD)
unset(ILLUMOS)
unset(ANDROID)
unset(TIZEN)

set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH})
if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version)
set(CMAKE_SYSTEM_NAME FreeBSD)
Expand Down
2 changes: 1 addition & 1 deletion eng/common/sdk-task.ps1
Expand Up @@ -64,7 +64,7 @@ try {
$GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty
}
if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) {
$GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.4.1" -MemberType NoteProperty
$GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.3.1" -MemberType NoteProperty
}
if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") {
$xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true
Expand Down
6 changes: 0 additions & 6 deletions eng/common/templates/steps/source-build.yml
Expand Up @@ -63,11 +63,6 @@ steps:
targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
fi

runtimeOsArgs=
if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then
runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}'
fi

publishArgs=
if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then
publishArgs='--publish'
Expand All @@ -80,7 +75,6 @@ steps:
$internalRuntimeDownloadArgs \
$internalRestoreArgs \
$targetRidArgs \
$runtimeOsArgs \
/p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
/p:ArcadeBuildFromSource=true
displayName: Build
Expand Down
4 changes: 2 additions & 2 deletions eng/common/tools.ps1
Expand Up @@ -365,8 +365,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =

# If the version of msbuild is going to be xcopied,
# use this version. Version matches a package here:
# https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.4.1&view=overview
$defaultXCopyMSBuildVersion = '17.4.1'
# https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.3.1view=overview
$defaultXCopyMSBuildVersion = '17.3.1'

if (!$vsRequirements) {
if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') {
Expand Down
2 changes: 1 addition & 1 deletion eng/common/tools.sh
Expand Up @@ -511,7 +511,7 @@ global_json_file="${repo_root}global.json"
# determine if global.json contains a "runtimes" entry
global_json_has_runtimes=false
if command -v jq &> /dev/null; then
if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then
if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then
global_json_has_runtimes=true
fi
elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then
Expand Down
6 changes: 3 additions & 3 deletions global.json
@@ -1,12 +1,12 @@
{
"tools": {
"dotnet": "7.0.102"
"dotnet": "7.0.100"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23060.4"
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22561.2"
},
"sdk": {
"version": "7.0.102",
"version": "7.0.100",
"allowPrerelease": true
}
}
@@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.DotNet.Scaffolding.Shared;
using Microsoft.VisualStudio.Web.CodeGeneration.CommandLine;
using System;

namespace Microsoft.VisualStudio.Web.CodeGenerators.Mvc
{
Expand All @@ -20,6 +20,11 @@ public abstract class CommonCommandLineModel
[Option(Name = "useSqLite", ShortName = "sqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
public bool UseSqlite { get; set; }

//adding UseSqlite2 for backwards compat. for VS Mac scenarios (casing issue).
[Obsolete("Use --databaseProvider or -dbProvider to configure database type instead")]
[Option(Name = "useSqlite", ShortName = "sqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
public bool UseSqlite2 { get; set; }

[Option(Name = "databaseProvider", ShortName = "dbProvider", Description = "Database provider to use. Options include 'sqlserver' (default), 'sqlite', 'cosmos', 'postgres'.")]
public string DatabaseProviderString { get; set; }
public DbProvider DatabaseProvider { get; set; }
Expand Down Expand Up @@ -72,7 +77,7 @@ public static void ValidateCommandline(this CommonCommandLineModel model, ILogge
}

#pragma warning disable CS0618 // Type or member is obsolete
if (model.UseSqlite)
if (model.UseSqlite || model.UseSqlite2)
{
#pragma warning restore CS0618 // Type or member is obsolete
//instead of throwing an error, letting the devs know that its obsolete.
Expand Down
@@ -1,6 +1,6 @@
using System;
using Microsoft.DotNet.Scaffolding.Shared;
using Microsoft.VisualStudio.Web.CodeGeneration.CommandLine;
using System;

namespace Microsoft.VisualStudio.Web.CodeGenerators.Mvc.Identity
{
Expand All @@ -13,6 +13,11 @@ public class IdentityGeneratorCommandLineModel
[Option(Name = "useSqLite", ShortName = "sqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
public bool UseSqlite { get; set; }

//adding UseSqlite2 for backwards compat. for VS Mac scenarios (casing issue).
[Obsolete("Use --databaseProvider or -dbProvider to configure database type instead")]
[Option(Name = "useSqlite", ShortName = "sqlite", Description = "Flag to specify if DbContext should use SQLite instead of SQL Server.")]
public bool UseSqlite2 { get; set; }

[Option(Name = "databaseProvider", ShortName = "dbProvider", Description = "Database provider to use. Options include 'sqlserver' (default), 'sqlite', 'cosmos', 'postgres'.")]
public string DatabaseProviderString { get; set; }
public DbProvider DatabaseProvider { get; set; }
Expand Down
Expand Up @@ -53,7 +53,7 @@ internal class IdentityGeneratorTemplateModelBuilder
internal string UserClassNamespace { get; private set; }

private Type _userType;
internal Type UserType
internal Type UserType
{
get
{
Expand Down Expand Up @@ -182,7 +182,7 @@ public async Task<IdentityGeneratorTemplateModel> ValidateAndBuild()
{
NamedFiles = _commandlineModel.Files.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
}
else if(!string.IsNullOrEmpty(_commandlineModel.ExcludeFiles))
else if (!string.IsNullOrEmpty(_commandlineModel.ExcludeFiles))
{
string contentVersion;
if (templateModel is IdentityGeneratorTemplateModel2 templateModel2)
Expand All @@ -208,7 +208,7 @@ public async Task<IdentityGeneratorTemplateModel> ValidateAndBuild()
{
throw new InvalidOperationException(string.Join(Environment.NewLine, errors));
}

//get files to overwrite
NamedFiles = allFiles.Except(excludedFiles);
}
Expand Down Expand Up @@ -448,12 +448,12 @@ private bool HasExistingNonEmptyWwwRootDirectory
}
}

private void ValidateIndividualFileOptions()
private void ValidateIndividualFileOptions()
{
//Both options should not be selected. Users should either scaffold a particular set of files OR exclude a particular set of files.
if(IsFilesSpecified && IsExcludeSpecificed)
if (IsFilesSpecified && IsExcludeSpecificed)
{
throw new InvalidOperationException(string.Format(MessageStrings.InvalidOptionCombination,"--files", "--excludeFiles"));
throw new InvalidOperationException(string.Format(MessageStrings.InvalidOptionCombination, "--files", "--excludeFiles"));
}
}
private void ValidateDefaultUIOption()
Expand All @@ -462,12 +462,12 @@ private void ValidateDefaultUIOption()

if (IsFilesSpecified)
{
errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination,"--files", "--useDefaultUI"));
errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination, "--files", "--useDefaultUI"));
}

if(IsExcludeSpecificed)
if (IsExcludeSpecificed)
{
errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination,"--excludeFiles", "--useDefaultUI"));
errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination, "--excludeFiles", "--useDefaultUI"));
}

if (IsUsingExistingDbContext)
Expand Down Expand Up @@ -533,7 +533,7 @@ private string GetNamespaceFromTypeName(string dbContext)

private string GetClassNameFromTypeName(string dbContext)
{
return dbContext.Split(new char[] {'.'}, StringSplitOptions.RemoveEmptyEntries).Last();
return dbContext.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Last();
}

private void ValidateExistingDbContext(Type existingDbContext)
Expand Down Expand Up @@ -669,7 +669,7 @@ private async Task<Type> FindExistingType(string type)
Environment.NewLine,
string.Join(Environment.NewLine, _reflectedTypesProvider.GetCompilationErrors())));
}

}
//get all types and return the one with the same name. There should be no duplicates so only one should match.
return _reflectedTypesProvider.GetAllTypesInProject().FirstOrDefault(
Expand All @@ -691,7 +691,7 @@ private void ValidateCommandLine(IdentityGeneratorCommandLineModel model)
}

#pragma warning disable CS0618 // Type or member is obsolete
if (model.UseSqlite)
if (model.UseSqlite || model.UseSqlite2)
{
#pragma warning restore CS0618 // Type or member is obsolete
//instead of throwing an error, letting the devs know that its obsolete.
Expand All @@ -710,15 +710,15 @@ private void ValidateCommandLine(IdentityGeneratorCommandLineModel model)
errorStrings.Add(string.Format(MessageStrings.InvalidDatabaseProvider, model.DatabaseProviderString));
errorStrings.Add($"Supported database providers include : {dbList}");
}

if (!string.IsNullOrEmpty(model.RootNamespace) && !RoslynUtilities.IsValidNamespace(model.RootNamespace))
{
errorStrings.Add(string.Format(MessageStrings.InvalidNamespaceName, model.RootNamespace));
}

if (!string.IsNullOrEmpty(model.Layout) && model.GenerateLayout)
{
errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination,"--layout", "--generateLayout"));
errorStrings.Add(string.Format(MessageStrings.InvalidOptionCombination, "--layout", "--generateLayout"));
}

if (!string.IsNullOrEmpty(model.BootstrapVersion) && !IdentityGenerator.ValidBootstrapVersions.Contains(model.BootstrapVersion.Trim(' ', '\n')))
Expand Down