示例#1
0
    public void Find_Abp_Version()
    {
        const string csprojContent = "<Project Sdk=\"Microsoft.NET.Sdk\">" +
                                     "<Import Project=\"..\\..\\common.props\" />" +
                                     "<PropertyGroup>" +
                                     "<TargetFramework>net5.0</TargetFramework>" +
                                     "<RootNamespace>Blazoor.EfCore07062034</RootNamespace>" +
                                     "</PropertyGroup>" +
                                     "<ItemGroup>" +
                                     "<ProjectReference Include=\"..\\Blazoor.EfCore07062034.Domain.Shared\\Blazoor.EfCore07062034.Domain.Shared.csproj\" />" +
                                     "</ItemGroup>" +
                                     "<ItemGroup>" +
                                     "< PackageReference    Include  =  \"Volo.Abp.Emailing\"   Version  =  \"4.4.0-rc.1\"  />" +
                                     "<PackageReference  Include= \"Volo.Abp.PermissionManagement.Domain.Identity\"   Version= \"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.IdentityServer.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.PermissionManagement.Domain.IdentityServer\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.BackgroundJobs.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.AuditLogging.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.FeatureManagement.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.SettingManagement.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.BlobStoring.Database.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.Identity.Pro.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.LanguageManagement.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.LeptonTheme.Management.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Saas.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "<PackageReference Include=\"Volo.Abp.TextTemplateManagement.Domain\" Version=\"4.4.0-rc.1\" />" +
                                     "</ItemGroup>" +
                                     "</Project>";

        var success = SolutionPackageVersionFinder.TryParseVersionFromCsprojFile(csprojContent, out var version);

        success.ShouldBe(true);
        version.ShouldBe("4.4.0-rc.1");
    }
示例#2
0
    public ProjectCreationCommandBase(ConnectionStringProvider connectionStringProvider, SolutionPackageVersionFinder solutionPackageVersionFinder, ICmdHelper cmdHelper)
    {
        ConnectionStringProvider     = connectionStringProvider;
        SolutionPackageVersionFinder = solutionPackageVersionFinder;
        CmdHelper = cmdHelper;

        Logger = NullLogger <NewCommand> .Instance;
    }
示例#3
0
    protected virtual string GetAbpVersionOrNull(string projectFile)
    {
        var projectFileContent = File.ReadAllText(projectFile);

        return(SolutionPackageVersionFinder.TryParseVersionFromCsprojFile(projectFileContent, out var version)
            ? version
            : null);
    }
示例#4
0
 public NewCommand(TemplateProjectBuilder templateProjectBuilder
                   , ITemplateInfoProvider templateInfoProvider,
                   ConnectionStringProvider connectionStringProvider,
                   SolutionPackageVersionFinder solutionPackageVersionFinder,
                   ICmdHelper cmdHelper,
                   IInstallLibsService installLibsService)
     : base(connectionStringProvider, solutionPackageVersionFinder, cmdHelper, installLibsService)
 {
     TemplateProjectBuilder = templateProjectBuilder;
     TemplateInfoProvider   = templateInfoProvider;
 }
示例#5
0
    public NewCommand(TemplateProjectBuilder templateProjectBuilder
                      , ITemplateInfoProvider templateInfoProvider,
                      ConnectionStringProvider connectionStringProvider,
                      SolutionPackageVersionFinder solutionPackageVersionFinder,
                      ICmdHelper cmdHelper)
        : base(connectionStringProvider, solutionPackageVersionFinder, cmdHelper)
    {
        TemplateProjectBuilder = templateProjectBuilder;
        TemplateInfoProvider   = templateInfoProvider;

        Logger = NullLogger <NewCommand> .Instance;
    }
示例#6
0
 public NewCommand(TemplateProjectBuilder templateProjectBuilder
                   , ITemplateInfoProvider templateInfoProvider,
                   ConnectionStringProvider connectionStringProvider,
                   SolutionPackageVersionFinder solutionPackageVersionFinder,
                   ICmdHelper cmdHelper,
                   IInstallLibsService installLibsService,
                   AngularPwaSupportAdder angularPwaSupportAdder,
                   InitialMigrationCreator initialMigrationCreator,
                   ThemePackageAdder themePackageAdder,
                   ILocalEventBus eventBus)
     : base(connectionStringProvider, solutionPackageVersionFinder, cmdHelper, installLibsService, angularPwaSupportAdder, initialMigrationCreator, themePackageAdder, eventBus)
 {
     TemplateProjectBuilder = templateProjectBuilder;
     TemplateInfoProvider   = templateInfoProvider;
 }
示例#7
0
    public ProjectCreationCommandBase(
        ConnectionStringProvider connectionStringProvider,
        SolutionPackageVersionFinder solutionPackageVersionFinder,
        ICmdHelper cmdHelper,
        IInstallLibsService installLibsService,
        AngularPwaSupportAdder angularPwaSupportAdder)
    {
        ConnectionStringProvider     = connectionStringProvider;
        SolutionPackageVersionFinder = solutionPackageVersionFinder;
        CmdHelper              = cmdHelper;
        InstallLibsService     = installLibsService;
        AngularPwaSupportAdder = angularPwaSupportAdder;

        Logger = NullLogger <NewCommand> .Instance;
    }
示例#8
0
    public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
    {
        if (commandLineArgs.Target == null)
        {
            throw new CliUsageException(
                      "Module name is missing!" +
                      Environment.NewLine + Environment.NewLine +
                      GetUsageInfo()
                      );
        }

        var newTemplate    = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long);
        var template       = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long);
        var newProTemplate = !string.IsNullOrEmpty(template) && template == ModuleProTemplate.TemplateName;
        var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long);
        var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file");
        var skipDbMigrations            = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.DbMigrations.Skip);
        var solutionFile = GetSolutionFile(commandLineArgs);

        var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);

        if (version == null)
        {
            version = SolutionPackageVersionFinder.Find(solutionFile);
        }

        var moduleInfo = await SolutionModuleAdder.AddAsync(
            solutionFile,
            commandLineArgs.Target,
            version,
            skipDbMigrations,
            withSourceCode,
            addSourceCodeToSolutionFile,
            newTemplate,
            newProTemplate
            );

        _lastAddedModuleInfo = new AddModuleInfoOutput
        {
            DisplayName                 = moduleInfo.DisplayName,
            Name                        = moduleInfo.Name,
            DocumentationLinks          = moduleInfo.DocumentationLinks,
            InstallationCompleteMessage = moduleInfo.InstallationCompleteMessage
        };
    }
示例#9
0
    public ProjectCreationCommandBase(
        ConnectionStringProvider connectionStringProvider,
        SolutionPackageVersionFinder solutionPackageVersionFinder,
        ICmdHelper cmdHelper,
        IInstallLibsService installLibsService,
        AngularPwaSupportAdder angularPwaSupportAdder,
        InitialMigrationCreator initialMigrationCreator,
        ThemePackageAdder themePackageAdder,
        ILocalEventBus eventBus)
    {
        ConnectionStringProvider     = connectionStringProvider;
        SolutionPackageVersionFinder = solutionPackageVersionFinder;
        CmdHelper               = cmdHelper;
        InstallLibsService      = installLibsService;
        AngularPwaSupportAdder  = angularPwaSupportAdder;
        InitialMigrationCreator = initialMigrationCreator;
        EventBus          = eventBus;
        ThemePackageAdder = themePackageAdder;

        Logger = NullLogger <NewCommand> .Instance;
    }
示例#10
0
    public void Find_Abp_Semantic_Version()
    {
        const string csprojContent = "<Project Sdk=\"Microsoft.NET.Sdk\">" +
                                     "<Import Project=\"..\\..\\common.props\" />" +
                                     "<PropertyGroup>" +
                                     "<TargetFramework>net5.0</TargetFramework>" +
                                     "<RootNamespace>Blazoor.EfCore07062034</RootNamespace>" +
                                     "</PropertyGroup>" +
                                     "<ItemGroup>" +
                                     "<ProjectReference Include=\"..\\Blazoor.EfCore07062034.Domain.Shared\\Blazoor.EfCore07062034.Domain.Shared.csproj\" />" +
                                     "</ItemGroup>" +
                                     "<ItemGroup>" +
                                     "< PackageReference  Include =  \"Volo.Abp.Emailing\"   Version=  \"12.8.3-beta.1\"  />" +
                                     "</ItemGroup>" +
                                     "</Project>";

        var success = SolutionPackageVersionFinder.TryParseSemanticVersionFromCsprojFile(csprojContent, out var version);

        success.ShouldBe(true);
        version.Major.ShouldBe(12);
        version.Minor.ShouldBe(8);
        version.Patch.ShouldBe(3);
        version.Release.ShouldBe("beta.1");
    }
示例#11
0
    protected ProjectBuildArgs GetProjectBuildArgs(CommandLineArgs commandLineArgs, string template, string projectName)
    {
        var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);

        if (version != null)
        {
            Logger.LogInformation("Version: " + version);
        }

        var preview = commandLineArgs.Options.ContainsKey(Options.Preview.Long);

        if (preview)
        {
            Logger.LogInformation("Preview: yes");
        }

        var pwa = commandLineArgs.Options.ContainsKey(Options.ProgressiveWebApp.Short);

        if (pwa)
        {
            Logger.LogInformation("Progressive Web App: yes");
        }

        var databaseProvider = GetDatabaseProvider(commandLineArgs);

        if (databaseProvider != DatabaseProvider.NotSpecified)
        {
            Logger.LogInformation("Database provider: " + databaseProvider);
        }

        var connectionString = GetConnectionString(commandLineArgs);

        if (connectionString != null)
        {
            Logger.LogInformation("Connection string: " + connectionString);
        }

        var databaseManagementSystem = GetDatabaseManagementSystem(commandLineArgs);

        if (databaseManagementSystem != DatabaseManagementSystem.NotSpecified)
        {
            Logger.LogInformation("DBMS: " + databaseManagementSystem);
        }

        var uiFramework = GetUiFramework(commandLineArgs);

        if (uiFramework != UiFramework.NotSpecified)
        {
            Logger.LogInformation("UI Framework: " + uiFramework);
        }

        var theme = uiFramework == UiFramework.None ? (Theme?)null : GetTheme(commandLineArgs);

        if (theme.HasValue)
        {
            Logger.LogInformation("Theme: " + theme);
        }

        var publicWebSite = uiFramework != UiFramework.None && commandLineArgs.Options.ContainsKey(Options.PublicWebSite.Long);

        if (publicWebSite)
        {
            Logger.LogInformation("Public Web Site: yes");
        }

        var mobileApp = GetMobilePreference(commandLineArgs);

        if (mobileApp != MobileApp.None)
        {
            Logger.LogInformation("Mobile App: " + mobileApp);
        }

        var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long);

        if (gitHubAbpLocalRepositoryPath != null)
        {
            Logger.LogInformation("GitHub Abp Local Repository Path: " + gitHubAbpLocalRepositoryPath);
        }

        var gitHubVoloLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubVoloLocalRepositoryPath.Long);

        if (gitHubVoloLocalRepositoryPath != null)
        {
            Logger.LogInformation("GitHub Volo Local Repository Path: " + gitHubVoloLocalRepositoryPath);
        }

        var templateSource = commandLineArgs.Options.GetOrNull(Options.TemplateSource.Short, Options.TemplateSource.Long);

        if (templateSource != null)
        {
            Logger.LogInformation("Template Source: " + templateSource);
        }

        var createSolutionFolder = GetCreateSolutionFolderPreference(commandLineArgs);

        var outputFolder = commandLineArgs.Options.GetOrNull(Options.OutputFolder.Short, Options.OutputFolder.Long);

        var outputFolderRoot =
            outputFolder != null?Path.GetFullPath(outputFolder) : Directory.GetCurrentDirectory();

        SolutionName solutionName;

        if (MicroserviceServiceTemplateBase.IsMicroserviceServiceTemplate(template))
        {
            var slnPath = commandLineArgs.Options.GetOrNull(Options.MainSolution.Short, Options.MainSolution.Long);

            if (slnPath == null)
            {
                slnPath = Directory.GetFiles(outputFolderRoot, "*.sln").FirstOrDefault();
            }
            else if (slnPath.EndsWith(".sln"))
            {
                Directory.SetCurrentDirectory(Path.GetDirectoryName(slnPath));
                outputFolderRoot = Path.GetDirectoryName(slnPath);
            }
            else if (!Directory.Exists(slnPath))
            {
                slnPath = null;
            }
            else
            {
                Directory.SetCurrentDirectory(slnPath);
                outputFolderRoot = slnPath;
                slnPath          = Directory.GetFiles(outputFolderRoot, "*.sln").FirstOrDefault();
            }

            if (slnPath == null)
            {
                throw new CliUsageException($"This command should be run inside a folder that contains a microservice solution! Or use -{Options.MainSolution.Short} parameter.");
            }

            var microserviceSolutionName = Path.GetFileName(slnPath).RemovePostFix(".sln");

            version ??= SolutionPackageVersionFinder.Find(slnPath);
            solutionName = SolutionName.Parse(microserviceSolutionName, projectName);
            outputFolder = MicroserviceServiceTemplateBase.CalculateTargetFolder(outputFolderRoot, solutionName.ProjectName);
            uiFramework  = uiFramework == UiFramework.NotSpecified ? FindMicroserviceSolutionUiFramework(outputFolderRoot) : uiFramework;
        }
        else
        {
            solutionName = SolutionName.Parse(projectName);

            outputFolder = createSolutionFolder ?
                           Path.Combine(outputFolderRoot, SolutionName.Parse(projectName).FullName) :
                           outputFolderRoot;
        }

        IO.DirectoryHelper.CreateIfNotExists(outputFolder);

        Logger.LogInformation("Output folder: " + outputFolder);

        if (connectionString == null &&
            databaseManagementSystem != DatabaseManagementSystem.NotSpecified &&
            databaseManagementSystem != DatabaseManagementSystem.SQLServer)
        {
            connectionString = ConnectionStringProvider.GetByDbms(databaseManagementSystem, outputFolder);
        }

        commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command);

        return(new ProjectBuildArgs(
                   solutionName,
                   template,
                   version,
                   outputFolder,
                   databaseProvider,
                   databaseManagementSystem,
                   uiFramework,
                   mobileApp,
                   publicWebSite,
                   gitHubAbpLocalRepositoryPath,
                   gitHubVoloLocalRepositoryPath,
                   templateSource,
                   commandLineArgs.Options,
                   connectionString,
                   pwa,
                   theme
                   ));
    }
示例#12
0
 public AddModuleCommand(SolutionModuleAdder solutionModuleAdder, SolutionPackageVersionFinder solutionPackageVersionFinder)
 {
     SolutionModuleAdder          = solutionModuleAdder;
     SolutionPackageVersionFinder = solutionPackageVersionFinder;
     Logger = NullLogger <AddModuleCommand> .Instance;
 }