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

Bundles: Flow configuration from project #26044

Merged
merged 1 commit into from
Sep 15, 2021
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
10 changes: 1 addition & 9 deletions src/EFCore.Tools/tools/EntityFrameworkCore.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ Register-TabExpansion Bundle-Migration @{
.PARAMETER TargetRuntime
The target runtime to bundle for.

.PARAMETER Configuration
The configuration to use for the bundle.

.PARAMETER Framework
The target framework. Defaults to the first one in the project.

Expand Down Expand Up @@ -153,7 +150,6 @@ function Bundle-Migration
[switch] $Force,
[switch] $SelfContained,
[string] $TargetRuntime,
[string] $Configuration,
[string] $Framework,
[string] $Context,
[string] $Project,
Expand Down Expand Up @@ -190,11 +186,6 @@ function Bundle-Migration
$params += '--target-runtime', $TargetRuntime
}

if ($Configuration)
{
$params += '--target-configuration', $Configuration
}

$params += GetParams $Context

EF $dteProject $dteStartupProject $params $Args
Expand Down Expand Up @@ -1308,6 +1299,7 @@ function EF($project, $startupProject, $params, $applicationArgs, [switch] $skip
'--startup-project', $startupProject.FullName,
'--project-dir', $projectDir,
'--language', $language,
'--configuration', $activeConfiguration.ConfigurationName,
'--working-dir', $PWD.Path

if (IsWeb $startupProject)
Expand Down
8 changes: 2 additions & 6 deletions src/dotnet-ef/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/dotnet-ef/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@
<data name="MigrationsAddDescription" xml:space="preserve">
<value>Adds a new migration.</value>
</data>
<data name="MigrationsBundleConfigurationDescription" xml:space="preserve">
<value>The configuration to use for the bundle.</value>
</data>
<data name="MigrationsBundleDescription" xml:space="preserve">
<value>Creates an executable to update the database.</value>
</data>
Expand Down
6 changes: 6 additions & 0 deletions src/dotnet-ef/RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ protected override int Execute(string[] _)
args.Add("--framework");
args.Add(startupProject.TargetFramework!);

if (_configuration.HasValue())
{
args.Add("--configuration");
args.Add(_configuration.Value()!);
}

if (string.Equals(project.Nullable, "enable", StringComparison.OrdinalIgnoreCase)
|| string.Equals(project.Nullable, "annotations", StringComparison.OrdinalIgnoreCase))
{
Expand Down
2 changes: 0 additions & 2 deletions src/ef/Commands/MigrationsBundleCommand.Configure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ internal partial class MigrationsBundleCommand : ContextCommandBase
private CommandOption? _force;
private CommandOption? _selfContained;
private CommandOption? _runtime;
private CommandOption? _configuration;

public override void Configure(CommandLineApplication command)
{
Expand All @@ -22,7 +21,6 @@ public override void Configure(CommandLineApplication command)
_force = command.Option("-f|--force", Resources.DbContextScaffoldForceDescription);
_selfContained = command.Option("--self-contained", Resources.SelfContainedDescription);
_runtime = command.Option("-r|--target-runtime <RUNTIME_IDENTIFIER>", Resources.MigrationsBundleRuntimeDescription);
_configuration = command.Option("--target-configuration <CONFIGURATION>", Resources.MigrationsBundleConfigurationDescription);

base.Configure(command);
}
Expand Down
6 changes: 4 additions & 2 deletions src/ef/Commands/MigrationsBundleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ protected override int Execute(string[] args)
? "--self-contained"
: "--no-self-contained");

if (_configuration!.HasValue())
var configuration = Configuration!.Value();
if (string.Equals(configuration, "Debug", StringComparison.OrdinalIgnoreCase)
|| string.Equals(configuration, "Release", StringComparison.OrdinalIgnoreCase))
{
publishArgs.Add("--configuration");
publishArgs.Add(_configuration!.Value()!);
publishArgs.Add(configuration!);
}

var exitCode = Exe.Run("dotnet", publishArgs, directory, interceptOutput: true);
Expand Down
2 changes: 2 additions & 0 deletions src/ef/Commands/ProjectCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ internal abstract class ProjectCommandBase : EFCommandBase
protected CommandOption? StartupProject { get; private set; }
protected CommandOption? WorkingDir { get; private set; }
protected CommandOption? Framework { get; private set; }
protected CommandOption? Configuration { get; private set; }

protected string? EFCoreVersion
=> _efcoreVersion ??= System.Reflection.Assembly.Load("Microsoft.EntityFrameworkCore.Design")
Expand All @@ -49,6 +50,7 @@ public override void Configure(CommandLineApplication command)
_nullable = command.Option("--nullable", Resources.NullableDescription);
WorkingDir = command.Option("--working-dir <PATH>", Resources.WorkingDirDescription);
Framework = command.Option("--framework <FRAMEWORK>", Resources.FrameworkDescription);
Configuration = command.Option("--configuration <CONFIGURATION>", Resources.ConfigurationDescription);

base.Configure(command);
}
Expand Down
14 changes: 8 additions & 6 deletions src/ef/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/ef/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
<data name="BuildBundleSucceeded" xml:space="preserve">
<value>Done. Migrations Bundle: {path}</value>
</data>
<data name="ConfigurationDescription" xml:space="preserve">
<value>The configuration to use.</value>
</data>
<data name="ConnectionDescription" xml:space="preserve">
<value>The connection string to the database.</value>
</data>
Expand Down Expand Up @@ -243,9 +246,6 @@
<data name="MigrationsAddDescription" xml:space="preserve">
<value>Adds a new migration.</value>
</data>
<data name="MigrationsBundleConfigurationDescription" xml:space="preserve">
<value>The configuration to use for the bundle.</value>
</data>
<data name="MigrationsBundleDescription" xml:space="preserve">
<value>Creates an executable to update the database.</value>
</data>
Expand Down