Browse Source

Improve studio

pull/11157/head
Yunus Emre Kalkan 5 years ago
parent
commit
dceb36b1d9
  1. 40
      studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/CsprojFileManager.cs
  2. 4
      studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/ICsprojFileManager.cs
  3. 2
      studio/src/Volo.Abp.Studio.ModuleInstaller/Volo/Abp/Studio/ModuleInstalling/ModuleInstallingPipelineBuilderBase.cs
  4. 9
      studio/src/Volo.Abp.Studio.ModuleInstaller/Volo/Abp/Studio/ModuleInstalling/Steps/AddEfCoreConfigurationMethodStep.cs
  5. 5
      studio/src/Volo.Abp.Studio.ModuleInstaller/Volo/Abp/Studio/ModuleInstalling/Steps/AssemblyVersionStep.cs

40
studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/CsprojFileManager.cs

@ -92,6 +92,46 @@ public class CsprojFileManager : XmlFileManagerBase, ICsprojFileManager, ITransi
await SaveXmlDocumentAsync(filePath, document);
}
public async Task AddAssemblyVersionAsync(string filePath, string version)
{
var document = await GetXmlDocumentAsync(filePath);
var matchedNodes = document.SelectNodes($"/Project/PropertyGroup");
if (matchedNodes.Count == 0)
{
return;
}
var versionNode = document.CreateElement("Version");
versionNode.InnerText = version;
matchedNodes[0].AppendChild(versionNode);
await SaveXmlDocumentAsync(filePath, document);
}
public async Task AddCopyLocalLockFileAssembliesAsync(string filePath)
{
var document = await GetXmlDocumentAsync(filePath);
var matchedNodes = document.SelectNodes($"/Project/PropertyGroup");
if (matchedNodes.Count == 0)
{
return;
}
var versionNode = document.CreateElement("CopyLocalLockFileAssemblies");
versionNode.InnerText = "True";
matchedNodes[0].AppendChild(versionNode);
await SaveXmlDocumentAsync(filePath, document);
}
public async Task ConvertPackageReferenceToProjectReferenceAsync(string filePath, string projectToReference)
{
var document = await GetXmlDocumentAsync(filePath);

4
studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/ICsprojFileManager.cs

@ -12,6 +12,10 @@ public interface ICsprojFileManager
Task AddImportAsync(string filePath, string importFilePath);
Task AddAssemblyVersionAsync(string filePath, string version);
Task AddCopyLocalLockFileAssembliesAsync(string filePath);
Task ConvertPackageReferenceToProjectReferenceAsync(string filePath, string projectToReference);

2
studio/src/Volo.Abp.Studio.ModuleInstaller/Volo/Abp/Studio/ModuleInstalling/ModuleInstallingPipelineBuilderBase.cs

@ -12,7 +12,7 @@ public abstract class ModuleInstallingPipelineBuilderBase
if (context.WithSourceCode)
{
pipeline.Add(new SourceCodeDownloadStep());
pipeline.Add(new CommonPropsStep());
pipeline.Add(new AssemblyVersionStep());
if (context.AddToSolutionFile)
{

9
studio/src/Volo.Abp.Studio.ModuleInstaller/Volo/Abp/Studio/ModuleInstalling/Steps/AddEfCoreConfigurationMethodStep.cs

@ -36,7 +36,14 @@ public class AddEfCoreConfigurationMethodStep : ModuleInstallingPipelineStep
foreach (var declaration in context.EfCoreConfigurationMethodDeclarations)
{
_dbContextFileBuilderConfigureAdder.Add(dbContextFile, declaration.Namespace + ":" + declaration.MethodName);
try
{
_dbContextFileBuilderConfigureAdder.Add(dbContextFile, declaration.Namespace + ":" + declaration.MethodName);
}
catch (Exception e)
{
continue;
}
}
}
}

5
studio/src/Volo.Abp.Studio.ModuleInstaller/Volo/Abp/Studio/ModuleInstalling/Steps/CommonPropsStep.cs → studio/src/Volo.Abp.Studio.ModuleInstaller/Volo/Abp/Studio/ModuleInstalling/Steps/AssemblyVersionStep.cs

@ -5,7 +5,7 @@ using Volo.Abp.Studio.Packages.Modifying;
namespace Volo.Abp.Studio.ModuleInstalling.Steps;
public class CommonPropsStep : ModuleInstallingPipelineStep
public class AssemblyVersionStep : ModuleInstallingPipelineStep
{
public async override Task ExecuteAsync(ModuleInstallingContext context)
{
@ -23,7 +23,8 @@ public class CommonPropsStep : ModuleInstallingPipelineStep
foreach (var csProjFile in csProjFiles)
{
await _csprojFileManager.AddImportAsync(csProjFile, commonPropsFilePath);
await _csprojFileManager.AddAssemblyVersionAsync(csProjFile, context.Version);
await _csprojFileManager.AddCopyLocalLockFileAssembliesAsync(csProjFile);
}
}
}
Loading…
Cancel
Save