コード例 #1
0
ファイル: SolutionModuleAdder.cs プロジェクト: zazaqiming/abp
 public SolutionModuleAdder(
     IJsonSerializer jsonSerializer,
     ProjectNugetPackageAdder projectNugetPackageAdder,
     DbContextFileBuilderConfigureAdder dbContextFileBuilderConfigureAdder,
     EfCoreMigrationAdder efCoreMigrationAdder,
     DerivedClassFinder derivedClassFinder,
     ProjectNpmPackageAdder projectNpmPackageAdder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     SourceCodeDownloadService sourceCodeDownloadService,
     SolutionFileModifier solutionFileModifier,
     NugetPackageToLocalReferenceConverter nugetPackageToLocalReferenceConverter,
     AngularModuleSourceCodeAdder angularModuleSourceCodeAdder,
     NewCommand newCommand)
 {
     JsonSerializer                        = jsonSerializer;
     ProjectNugetPackageAdder              = projectNugetPackageAdder;
     DbContextFileBuilderConfigureAdder    = dbContextFileBuilderConfigureAdder;
     EfCoreMigrationAdder                  = efCoreMigrationAdder;
     DerivedClassFinder                    = derivedClassFinder;
     ProjectNpmPackageAdder                = projectNpmPackageAdder;
     NpmGlobalPackagesChecker              = npmGlobalPackagesChecker;
     RemoteServiceExceptionHandler         = remoteServiceExceptionHandler;
     SourceCodeDownloadService             = sourceCodeDownloadService;
     SolutionFileModifier                  = solutionFileModifier;
     NugetPackageToLocalReferenceConverter = nugetPackageToLocalReferenceConverter;
     AngularModuleSourceCodeAdder          = angularModuleSourceCodeAdder;
     NewCommand = newCommand;
     Logger     = NullLogger <SolutionModuleAdder> .Instance;
 }
コード例 #2
0
 public SolutionModuleAdder(
     IJsonSerializer jsonSerializer,
     ProjectNugetPackageAdder projectNugetPackageAdder,
     ProjectNpmPackageAdder projectNpmPackageAdder)
 {
     JsonSerializer           = jsonSerializer;
     ProjectNugetPackageAdder = projectNugetPackageAdder;
     ProjectNpmPackageAdder   = projectNpmPackageAdder;
     Logger = NullLogger <SolutionModuleAdder> .Instance;
 }
コード例 #3
0
 public ProjectNugetPackageAdder(
     IJsonSerializer jsonSerializer,
     ProjectNpmPackageAdder npmPackageAdder,
     AbpModuleClassFinder moduleClassFinder,
     ModuleClassDependcyAdder moduleClassDependcyAdder)
 {
     JsonSerializer           = jsonSerializer;
     NpmPackageAdder          = npmPackageAdder;
     ModuleClassFinder        = moduleClassFinder;
     ModuleClassDependcyAdder = moduleClassDependcyAdder;
     Logger = NullLogger <ProjectNugetPackageAdder> .Instance;
 }
コード例 #4
0
        private async Task AddNugetAndNpmReferences(ModuleWithMastersInfo module, string[] projectFiles,
                                                    bool useDotnetCliToInstall)
        {
            var webPackagesWillBeAddedToBlazorServerProject = SouldWebPackagesBeAddedToBlazorServerProject(module, projectFiles);

            foreach (var nugetPackage in module.NugetPackages)
            {
                var nugetTarget =
                    await IsProjectTiered(projectFiles) && nugetPackage.TieredTarget != NuGetPackageTarget.Undefined
                        ? nugetPackage.TieredTarget
                        : nugetPackage.Target;

                if (webPackagesWillBeAddedToBlazorServerProject && nugetTarget == NuGetPackageTarget.Web)
                {
                    nugetTarget = NuGetPackageTarget.BlazorServer;
                }

                var targetProjectFile = ProjectFinder.FindNuGetTargetProjectFile(projectFiles, nugetTarget);
                if (targetProjectFile == null)
                {
                    Logger.LogDebug($"Target project is not available for this NuGet package '{nugetPackage.Name}'");
                    continue;
                }

                await ProjectNugetPackageAdder.AddAsync(null, targetProjectFile, nugetPackage, null, useDotnetCliToInstall);
            }

            var mvcNpmPackages = module.NpmPackages?.Where(p => p.ApplicationType.HasFlag(NpmApplicationType.Mvc))
                                 .ToList();

            if (!mvcNpmPackages.IsNullOrEmpty())
            {
                var targetProjects = ProjectFinder.FindNpmTargetProjectFile(projectFiles);
                if (targetProjects.Any())
                {
                    NpmGlobalPackagesChecker.Check();

                    foreach (var targetProject in targetProjects)
                    {
                        foreach (var npmPackage in mvcNpmPackages)
                        {
                            await ProjectNpmPackageAdder.AddMvcPackageAsync(Path.GetDirectoryName(targetProject), npmPackage);
                        }
                    }
                }
                else
                {
                    Logger.LogDebug("Target project is not available for NPM packages.");
                }
            }
        }
コード例 #5
0
        public virtual async Task AddAsync(
            [NotNull] string solutionFile,
            [NotNull] string moduleName,
            string startupProject,
            bool skipDbMigrations = false)
        {
            Check.NotNull(solutionFile, nameof(solutionFile));
            Check.NotNull(moduleName, nameof(moduleName));

            var module = await FindModuleInfoAsync(moduleName).ConfigureAwait(false);

            Logger.LogInformation($"Installing module '{module.Name}' to the solution '{Path.GetFileNameWithoutExtension(solutionFile)}'");

            var projectFiles = ProjectFinder.GetProjectFiles(solutionFile);

            foreach (var nugetPackage in module.NugetPackages)
            {
                var targetProjectFile = ProjectFinder.FindNuGetTargetProjectFile(projectFiles, nugetPackage.Target);
                if (targetProjectFile == null)
                {
                    Logger.LogDebug($"Target project is not available for this NuGet package '{nugetPackage.Name}'");
                    continue;
                }

                await ProjectNugetPackageAdder.AddAsync(targetProjectFile, nugetPackage).ConfigureAwait(false);
            }

            if (!module.NpmPackages.IsNullOrEmpty())
            {
                var targetProjects = ProjectFinder.FindNpmTargetProjectFile(projectFiles);
                if (targetProjects.Any())
                {
                    NpmGlobalPackagesChecker.Check();

                    foreach (var targetProject in targetProjects)
                    {
                        foreach (var npmPackage in module.NpmPackages.Where(p => p.ApplicationType.HasFlag(NpmApplicationType.Mvc)))
                        {
                            await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage).ConfigureAwait(false);
                        }
                    }
                }
                else
                {
                    Logger.LogDebug("Target project is not available for NPM packages.");
                }
            }

            ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations);
        }
コード例 #6
0
 public ProjectNugetPackageAdder(
     IJsonSerializer jsonSerializer,
     ProjectNpmPackageAdder npmPackageAdder,
     DerivedClassFinder moduleClassFinder,
     ModuleClassDependcyAdder moduleClassDependcyAdder,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler)
 {
     JsonSerializer                = jsonSerializer;
     NpmPackageAdder               = npmPackageAdder;
     ModuleClassFinder             = moduleClassFinder;
     ModuleClassDependcyAdder      = moduleClassDependcyAdder;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     Logger = NullLogger <ProjectNugetPackageAdder> .Instance;
 }
コード例 #7
0
 public SolutionModuleAdder(
     IJsonSerializer jsonSerializer,
     ProjectNugetPackageAdder projectNugetPackageAdder,
     DbContextFileBuilderConfigureAdder dbContextFileBuilderConfigureAdder,
     EfCoreMigrationAdder efCoreMigrationAdder,
     DerivedClassFinder derivedClassFinder,
     ProjectNpmPackageAdder projectNpmPackageAdder)
 {
     EfCoreMigrationAdder               = efCoreMigrationAdder;
     DerivedClassFinder                 = derivedClassFinder;
     JsonSerializer                     = jsonSerializer;
     ProjectNugetPackageAdder           = projectNugetPackageAdder;
     DbContextFileBuilderConfigureAdder = dbContextFileBuilderConfigureAdder;
     ProjectNpmPackageAdder             = projectNpmPackageAdder;
     Logger = NullLogger <SolutionModuleAdder> .Instance;
 }
コード例 #8
0
 public ProjectNugetPackageAdder(
     IJsonSerializer jsonSerializer,
     ProjectNpmPackageAdder npmPackageAdder,
     DerivedClassFinder moduleClassFinder,
     ModuleClassDependcyAdder moduleClassDependcyAdder,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     BundleCommand bundleCommand,
     CliHttpClientFactory cliHttpClientFactory)
 {
     JsonSerializer                = jsonSerializer;
     NpmPackageAdder               = npmPackageAdder;
     ModuleClassFinder             = moduleClassFinder;
     ModuleClassDependcyAdder      = moduleClassDependcyAdder;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     BundleCommand         = bundleCommand;
     _cliHttpClientFactory = cliHttpClientFactory;
     Logger = NullLogger <ProjectNugetPackageAdder> .Instance;
 }
コード例 #9
0
ファイル: SolutionModuleAdder.cs プロジェクト: dellins/abp
        private async Task AddAngularPackages(string solutionFilePath, ModuleWithMastersInfo module)
        {
            var angularPath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(solutionFilePath)), "angular");

            if (!Directory.Exists(angularPath))
            {
                return;
            }

            var angularPackages = module.NpmPackages?.Where(p => p.ApplicationType.HasFlag(NpmApplicationType.Angular)).ToList();

            if (!angularPackages.IsNullOrEmpty())
            {
                foreach (var npmPackage in angularPackages)
                {
                    await ProjectNpmPackageAdder.AddAsync(angularPath, npmPackage, true);
                }
            }
        }
コード例 #10
0
 public SolutionModuleAdder(
     IJsonSerializer jsonSerializer,
     ProjectNugetPackageAdder projectNugetPackageAdder,
     DbContextFileBuilderConfigureAdder dbContextFileBuilderConfigureAdder,
     EfCoreMigrationAdder efCoreMigrationAdder,
     DerivedClassFinder derivedClassFinder,
     ProjectNpmPackageAdder projectNpmPackageAdder,
     NpmGlobalPackagesChecker npmGlobalPackagesChecker,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler)
 {
     JsonSerializer                     = jsonSerializer;
     ProjectNugetPackageAdder           = projectNugetPackageAdder;
     DbContextFileBuilderConfigureAdder = dbContextFileBuilderConfigureAdder;
     EfCoreMigrationAdder               = efCoreMigrationAdder;
     DerivedClassFinder                 = derivedClassFinder;
     ProjectNpmPackageAdder             = projectNpmPackageAdder;
     NpmGlobalPackagesChecker           = npmGlobalPackagesChecker;
     RemoteServiceExceptionHandler      = remoteServiceExceptionHandler;
     Logger = NullLogger <SolutionModuleAdder> .Instance;
 }
コード例 #11
0
        private async Task AddNugetAndNpmReferences(ModuleWithMastersInfo module, string[] projectFiles)
        {
            foreach (var nugetPackage in module.NugetPackages)
            {
                var nugetTarget =
                    await IsProjectTiered(projectFiles) && nugetPackage.TieredTarget != NuGetPackageTarget.Undefined
                        ? nugetPackage.TieredTarget
                        : nugetPackage.Target;

                var targetProjectFile = ProjectFinder.FindNuGetTargetProjectFile(projectFiles, nugetTarget);
                if (targetProjectFile == null)
                {
                    Logger.LogDebug($"Target project is not available for this NuGet package '{nugetPackage.Name}'");
                    continue;
                }

                await ProjectNugetPackageAdder.AddAsync(targetProjectFile, nugetPackage);
            }

            if (!module.NpmPackages.IsNullOrEmpty())
            {
                var targetProjects = ProjectFinder.FindNpmTargetProjectFile(projectFiles);
                if (targetProjects.Any())
                {
                    NpmGlobalPackagesChecker.Check();

                    foreach (var targetProject in targetProjects)
                    {
                        foreach (var npmPackage in module.NpmPackages.Where(p =>
                                                                            p.ApplicationType.HasFlag(NpmApplicationType.Mvc)))
                        {
                            await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage);
                        }
                    }
                }
                else
                {
                    Logger.LogDebug("Target project is not available for NPM packages.");
                }
            }
        }
コード例 #12
0
 public ProjectNugetPackageAdder(
     IJsonSerializer jsonSerializer,
     ProjectNpmPackageAdder npmPackageAdder,
     DerivedClassFinder moduleClassFinder,
     ModuleClassDependcyAdder moduleClassDependcyAdder,
     IRemoteServiceExceptionHandler remoteServiceExceptionHandler,
     BundleCommand bundleCommand,
     CliHttpClientFactory cliHttpClientFactory,
     SourceCodeDownloadService sourceCodeDownloadService,
     SolutionFileModifier solutionFileModifier)
 {
     JsonSerializer                = jsonSerializer;
     NpmPackageAdder               = npmPackageAdder;
     ModuleClassFinder             = moduleClassFinder;
     ModuleClassDependcyAdder      = moduleClassDependcyAdder;
     RemoteServiceExceptionHandler = remoteServiceExceptionHandler;
     BundleCommand             = bundleCommand;
     SourceCodeDownloadService = sourceCodeDownloadService;
     SolutionFileModifier      = solutionFileModifier;
     _cliHttpClientFactory     = cliHttpClientFactory;
     Logger = NullLogger <ProjectNugetPackageAdder> .Instance;
 }