Skip to content

Commit

Permalink
Merge pull request #95 from dotnet-campus/t/lindexi
Browse files Browse the repository at this point in the history
加上可空
  • Loading branch information
walterlv committed Aug 19, 2020
2 parents 43a7859 + 8ae268d commit 59f3e63
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 348 deletions.
2 changes: 1 addition & 1 deletion build/Version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.1.19317-alpha</Version>
<Version>0.1.19327-alpha</Version>
</PropertyGroup>
</Project>
55 changes: 27 additions & 28 deletions src/dotnetCampus.SourceYard/Cli/Options.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using CommandLine;
using CommandLine;

namespace dotnetCampus.SourceYard.Cli
{
Expand All @@ -9,19 +8,19 @@ internal class Options
/// 项目文件所在的路径
/// </summary>
[Option('p', "project", Required = true, HelpText = "The full path of the project file.")]
public string ProjectFile { get; set; }
public string ProjectFile { get; set; } = null!;

/// <summary>
/// 临时的文件夹的路径
/// </summary>
[Option('i', "intermediate-directory", Required = true, HelpText = "The relative path of the project intermediate output path, commonly the 'obj' folder and value in 'obj'.")]
public string IntermediateDirectory { get; set; }
public string IntermediateDirectory { get; set; } = null!;

/// <summary>
/// 打包输出的文件夹
/// </summary>
[Option('n', "package-output-path", Required = true, HelpText = "The package output full path of the project.")]
public string PackageOutputPath { get; set; }
public string PackageOutputPath { get; set; } = null!;

/// <summary>
/// 当前项目的打包版本
Expand All @@ -36,34 +35,34 @@ internal class Options
/// 项目进行编译的文件的列表,因为参数太多,需要将参数写到文件
/// </summary>
[Option(longName: "Compile", HelpText = "编译的文件")]
public string CompileFile { get; set; }
public string? CompileFile { get; set; }

/// <summary>
/// 存放资源文件参数的文件
/// </summary>
[Option(longName: "Resource", HelpText = "资源文件")]
public string ResourceFile { get; set; }
public string? ResourceFile { get; set; }

[Option(longName: "Content")]
public string ContentFile { get; set; }
public string? ContentFile { get; set; }

[Option(longName: "Page")]
public string Page { get; set; }
public string? Page { get; set; }

[Option(longName: "None")]
public string None { get; set; }
public string? None { get; set; }

[Option(longName: "EmbeddedResource")]
public string EmbeddedResource { get; set; }
public string? EmbeddedResource { get; set; }

/// <summary>
/// 打包的公司内容
/// </summary>
[Option(longName: "Company")]
public string Company { get; set; }
public string? Company { get; set; }

[Option(longName: "Authors")]
public string Authors { get; set; }
public string? Authors { get; set; }

// 内容放在 SourceProjectPackageFile 文件
//[Option(longName: "RepositoryUrl")]
Expand All @@ -79,48 +78,48 @@ internal class Options
/// 因为 Copyright 可能很长,有空格,写文件
/// </summary>
[Option(longName: "CopyrightFile")]
public string CopyrightFile { get; set; }
public string? CopyrightFile { get; set; }

[Option(longName: "DescriptionFile")]
public string DescriptionFile { get; set; }
public string? DescriptionFile { get; set; }

[Option(longName: "ApplicationDefinition")]
public string ApplicationDefinition { get; set; }
public string? ApplicationDefinition { get; set; }

[Option(longName: "Owner")]
public string Owner { get; set; }
public string? Owner { get; set; }

[Option(longName: "Title")]
public string Title { get; set; }
public string? Title { get; set; }

[Option(longName: "PackageLicenseUrl")]
public string PackageLicenseUrl { get; set; }
public string? PackageLicenseUrl { get; set; }

[Option(longName: "PackageIconUrl")]
public string PackageIconUrl { get; set; }
public string? PackageIconUrl { get; set; }

[Option(longName: "PackageReleaseNotesFile")]
public string PackageReleaseNotesFile { get; set; }
public string? PackageReleaseNotesFile { get; set; }

[Option(longName: "PackageTags")]
public string PackageTags { get; set; }
public string? PackageTags { get; set; }

[Option(longName: "PackageId")]
public string PackageId { get; set; }
[Option(longName: "PackageId")]
public string? PackageId { get; set; }

[Option(longName: "PackageReferenceVersion")]
public string PackageReferenceVersion { get; set; }
public string? PackageReferenceVersion { get; set; }

/// <summary>
/// 打包用到的文件夹
/// </summary>
[Option(longName: "SourcePackingDirectory")]
public string SourcePackingDirectory { get; set; }
public string? SourcePackingDirectory { get; set; }

[Option(longName: "TargetFramework")]
public string TargetFramework { get; set; }
public string? TargetFramework { get; set; }

[Option(longName: "TargetFrameworks")]
public string TargetFrameworks { get; set; }
public string? TargetFrameworks { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/dotnetCampus.SourceYard/Context/PackingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace dotnetCampus.SourceYard.Context
internal class PackingContext : IPackingContext
{
public PackingContext(ILogger logger, string projectFile,
string projectName, string packageId, string packageVersion, string packageOutputPath, string packingFolder,
string projectName, string? packageId, string packageVersion, string packageOutputPath, string packingFolder,
PackagedProjectFile packagedProjectFile, string packageReferenceVersion)
{
Logger = logger;
Expand Down Expand Up @@ -63,6 +63,6 @@ public PackingContext(ILogger logger, string projectFile,
public PackagedProjectFile PackagedProjectFile { get; }
public string PackageReferenceVersion { get; }

public BuildProps BuildProps { get; set; }
public BuildProps BuildProps { get; set; } = null!;
}
}
8 changes: 4 additions & 4 deletions src/dotnetCampus.SourceYard/Exception_/PackingException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ namespace dotnetCampus.SourceYard
internal class PackingException : Exception
{
public PackingException(string message,
string key = null,
string file = null) : base(message)
string? key = null,
string? file = null) : base(message)
{
Key = key;
File = file;
}

public string Key { get; set; }
public string? Key { get; set; }

public string File { get; set; }
public string? File { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/dotnetCampus.SourceYard/PackFlow/NuspecFileGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void Pack(IPackingContext context)
_log.Message("完成创建 nuspec 文件");
}

private ILogger _log;
private ILogger _log = null!;

private void Write(NuspecPackage nuspecPackage, string fileName)
{
Expand Down Expand Up @@ -63,7 +63,7 @@ private NuspecPackage GetNuspec(IPackingContext context)
{
var buildProps = context.BuildProps;

Repository repository = null;
Repository? repository = null;
if (!string.IsNullOrEmpty(buildProps.RepositoryType) && !string.IsNullOrEmpty(buildProps.RepositoryUrl))
{
repository = new Repository()
Expand Down
Loading

0 comments on commit 59f3e63

Please sign in to comment.