public override async Task ExecuteAsync(ModuleInstallingContext context) { var _nugetSourceCodeStoreManager = context.ServiceProvider.GetRequiredService <INugetSourceCodeStore>(); var zipFilePath = await _nugetSourceCodeStoreManager.GetCachedSourceCodeFilePathAsync( context.ModuleName, SourceCodeTypes.Module, context.Version); if (zipFilePath == null) { throw new AbpStudioException(message: $"Source code not found for {context.ModuleName} (v{context.Version})"); } var targetFolder = context.GetTargetSourceCodeFolder(); if (Directory.Exists(targetFolder)) { return; } Directory.CreateDirectory(targetFolder); ZipFile.ExtractToDirectory(zipFilePath, targetFolder); }
public override async Task ExecuteAsync(ModuleInstallingContext context) { var efCoreProject = context.TargetModulePackages.FirstOrDefault(p => p.Role == PackageTypes.EntityFrameworkCore); if (efCoreProject == null) { return; } var efCoreProjectCsprojPath = efCoreProject.Path.RemovePostFix(PackageConsts.FileExtension) + ".csproj"; var _derivedClassFinder = context.ServiceProvider.GetRequiredService <DerivedClassFinder>(); var _dbContextFileBuilderConfigureAdder = context.ServiceProvider.GetRequiredService <DbContextFileBuilderConfigureAdder>(); var dbContextFile = _derivedClassFinder.Find(efCoreProjectCsprojPath, "AbpDbContext").FirstOrDefault(); if (dbContextFile == null) { return; } foreach (var declaration in context.EfCoreConfigurationMethodDeclarations) { _dbContextFileBuilderConfigureAdder.Add(dbContextFile, declaration.Namespace + ":" + declaration.MethodName); } }
private async Task AddReferenceAsync( ModuleInstallingContext context, PackageInfo targetPackage, PackageInfoWithAnalyze referencePackage) { var _csprojFileManager = context.ServiceProvider.GetRequiredService <ICsprojFileManager>(); var csprojFilePath = targetPackage.Path.RemovePostFix(PackageConsts.FileExtension) + ".csproj"; if (context.WithSourceCode) { var referenceProjectPath = Directory.GetFiles(context.GetTargetSourceCodeFolder(), $"*{referencePackage.Name}.csproj", SearchOption.AllDirectories).FirstOrDefault(); if (referenceProjectPath == null) { return; } await _csprojFileManager.AddProjectReferenceAsync( csprojFilePath, referenceProjectPath); } else { await _csprojFileManager.AddPackageReferenceAsync( csprojFilePath, referencePackage.Name, context.Version); } }
public async Task <ModuleInstallingPipeline> BuildAsync(ModuleInstallingContext context) { context.AddEfCoreConfigurationMethodDeclaration( new EfCoreConfigurationMethodDeclaration( "Volo.Abp.IdentityServer.EntityFrameworkCore", "ConfigureIdentityServer" ) ); return(GetBasePipeline(context)); }
public async Task <ModuleInstallingPipeline> BuildAsync(ModuleInstallingContext context) { context.AddEfCoreConfigurationMethodDeclaration( new EfCoreConfigurationMethodDeclaration( "Volo.Abp.BlobStoring.Database.EntityFrameworkCore", "ConfigureBlobStoring" ) ); return(GetBasePipeline(context)); }
public override async Task ExecuteAsync(ModuleInstallingContext context) { var _abpModuleFileManager = context.ServiceProvider.GetRequiredService <IAbpModuleFileManager>(); foreach (var referencePackage in context.ReferenceModulePackages) { var targetPackages = GetTargetPackages(context.TargetModulePackages, referencePackage); foreach (var targetPackage in targetPackages) { await AddReferenceAsync(context, targetPackage, referencePackage); var targetAbpModulePath = FindAbpModuleFile(targetPackage.Path); await _abpModuleFileManager.AddDependency(targetAbpModulePath, FindAbpModuleName(referencePackage)); } } }
public async override Task ExecuteAsync(ModuleInstallingContext context) { var moduleFolder = Path.GetDirectoryName(context.TargetModule); var commonPropsFilePath = Path.Combine(moduleFolder, "common.props"); if (!File.Exists(commonPropsFilePath)) { return; } var _csprojFileManager = context.ServiceProvider.GetRequiredService <ICsprojFileManager>(); var csProjFiles = Directory.GetFiles(context.GetTargetSourceCodeFolder(), "*.csproj", SearchOption.AllDirectories); foreach (var csProjFile in csProjFiles) { await _csprojFileManager.AddAssemblyVersionAsync(csProjFile, context.Version); await _csprojFileManager.AddCopyLocalLockFileAssembliesAsync(csProjFile); } }
protected ModuleInstallingPipeline GetBasePipeline(ModuleInstallingContext context) { var pipeline = new ModuleInstallingPipeline(context); if (context.WithSourceCode) { pipeline.Add(new SourceCodeDownloadStep()); if (context.AddToSolutionFile) { pipeline.Add(new AddToSolutionFileStep()); } } pipeline.Add(new PackageReferencingStep()); if (context.EfCoreConfigurationMethodDeclarations.Any()) { pipeline.Add(new AddEfCoreConfigurationMethodStep()); } return(pipeline); }
public abstract Task ExecuteAsync(ModuleInstallingContext context);
public async Task <ModuleInstallingPipeline> BuildAsync(ModuleInstallingContext context) { return(GetBasePipeline(context)); }
public ModuleInstallingPipeline(ModuleInstallingContext context) { Context = context; Steps = new List <ModuleInstallingPipelineStep>(); }
public override async Task ExecuteAsync(ModuleInstallingContext context) { var _solutionFileModuleAdder = context.ServiceProvider.GetRequiredService <ISolutionFileModuleAdder>(); await _solutionFileModuleAdder.AddAsync(context.TargetModule, context.ModuleName); }