Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复在 Ubunut 构建 #116

Merged
merged 10 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2020 dotnet campus
Copyright (c) 2018-2022 dotnet campus

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
65 changes: 33 additions & 32 deletions src/dotnetCampus.SourceYard/Assets/Current/Core.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<PropertyGroup>
<!-- 用于给多框架存放各个框架的信息的文件的文件夹,各个框架将会在写入到各自的文件里面 -->
<!-- 选择 BaseIntermediateOutputPath 是因为开发者可以配置不同的框架采用不同的 obj 文件夹,但是对于不同的框架,大部分都是使用相同的 BaseIntermediateOutputPath 文件夹 -->
<_SourceYardMultiTargetingPackageInfoFolder>$(BaseIntermediateOutputPath)$(Configuration)\SourceYardMultiTargetingPackageInfoFolder\</_SourceYardMultiTargetingPackageInfoFolder>
<_SourceYardMultiTargetingPackageInfoFolder>$([System.IO.Path]::Combine($(BaseIntermediateOutputPath),$(Configuration),"SourceYardMultiTargetingPackageInfoFolder"))</_SourceYardMultiTargetingPackageInfoFolder>

<!--
输出形式如:
- obj\Debug\SourceYardMultiTargetingPackageInfoFolder\net45.txt
Expand Down Expand Up @@ -41,39 +42,39 @@
<Target Name="SourceYardStep1">
<PropertyGroup>
<!-- 用于将各个框架的信息写入的文件 -->
<_SourceYardMultiTargetingPackageInfoFile>$(_SourceYardMultiTargetingPackageInfoFolder)$(TargetFramework).txt</_SourceYardMultiTargetingPackageInfoFile>
<_SourceYardMultiTargetingPackageInfoFile>$([System.IO.Path]::Combine($(_SourceYardMultiTargetingPackageInfoFolder),"$(TargetFramework).txt"))</_SourceYardMultiTargetingPackageInfoFile>

<!-- 这里不能使用 $(PackingDirectory) 属性,原因是此属性在未打包时是空 -->
<!-- 对于多框架来说,这里的 IntermediateOutputPath 路径格式如 obj\Debug\net45\ -->
<SourcePackingDirectory>$(IntermediateOutputPath)SourcePacking\</SourcePackingDirectory>
<SourcePackingDirectory>$([System.IO.Path]::Combine($(BaseIntermediateOutputPath),$(IntermediateOutputPath),"SourcePacking"))</SourcePackingDirectory>

<CompileTextFile>$(SourcePackingDirectory)CompileFile.txt</CompileTextFile>
<ResourceTextFile>$(SourcePackingDirectory)ResourceFile.txt</ResourceTextFile>
<ContentTextFile>$(SourcePackingDirectory)ContentFile.txt</ContentTextFile>
<NoneTextFile>$(SourcePackingDirectory)NoneFile.txt</NoneTextFile>
<EmbeddedResourceTextFile>$(SourcePackingDirectory)EmbeddedResourceFile.txt</EmbeddedResourceTextFile>
<PageTextFile>$(SourcePackingDirectory)PageFile.txt</PageTextFile>
<ApplicationDefinitionTextFile>$(SourcePackingDirectory)ApplicationDefinitionFile.txt</ApplicationDefinitionTextFile>
<CompileTextFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"CompileFile.txt"))</CompileTextFile>
<ResourceTextFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"ResourceFile.txt"))</ResourceTextFile>
<ContentTextFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"ContentFile.txt"))</ContentTextFile>
<NoneTextFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"NoneFile.txt"))</NoneTextFile>
<EmbeddedResourceTextFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"EmbeddedResourceFile.txt"))</EmbeddedResourceTextFile>
<PageTextFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"PageFile.txt"))</PageTextFile>
<ApplicationDefinitionTextFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"ApplicationDefinitionFile.txt"))</ApplicationDefinitionTextFile>

<DescriptionFile>$(SourcePackingDirectory)DescriptionFile.txt</DescriptionFile>
<CopyrightFile>$(SourcePackingDirectory)CopyrightFile.txt</CopyrightFile>
<PackageReleaseNotesFile>$(SourcePackingDirectory)PackageReleaseNotesFile.txt</PackageReleaseNotesFile>
<DescriptionFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"DescriptionFile.txt"))</DescriptionFile>
<CopyrightFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"CopyrightFile.txt"))</CopyrightFile>
<PackageReleaseNotesFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"PackageReleaseNotesFile.txt"))</PackageReleaseNotesFile>

<PackageReferenceVersionFile>$(SourcePackingDirectory)PackageReferenceVersionFile.txt</PackageReferenceVersionFile>
<FrameworkReferenceVersionFile>$(SourcePackingDirectory)FrameworkReferenceVersionFile.txt</FrameworkReferenceVersionFile>
<SourceProjectPackageFile>$(SourcePackingDirectory)SourceProjectPackageFile.txt</SourceProjectPackageFile>
<SourceYardPackageReferenceFile>$(SourcePackingDirectory)SourceYardPackageReferenceFile.txt</SourceYardPackageReferenceFile>
<PackageReferenceVersionFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"PackageReferenceVersionFile.txt"))</PackageReferenceVersionFile>
<FrameworkReferenceVersionFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"FrameworkReferenceVersionFile.txt"))</FrameworkReferenceVersionFile>
<SourceProjectPackageFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceProjectPackageFile.txt"))</SourceProjectPackageFile>
<SourceYardPackageReferenceFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardPackageReferenceFile.txt"))</SourceYardPackageReferenceFile>

<!-- 表示不要包含的引用依赖列表 -->
<SourceYardExcludePackageReferenceFile>$(SourcePackingDirectory)SourceYardExcludePackageReferenceFile.txt</SourceYardExcludePackageReferenceFile>
<SourceYardExcludePackageReferenceFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardExcludePackageReferenceFile.txt"))</SourceYardExcludePackageReferenceFile>
<!-- 表示不要包含的文件列表 -->
<SourceYardExcludeFileItemFile>$(SourcePackingDirectory)SourceYardExcludeFileItemFile.txt</SourceYardExcludeFileItemFile>
<SourceYardExcludeFileItemFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardExcludeFileItemFile.txt"))</SourceYardExcludeFileItemFile>

<SourceYardCompilePackageFile>$(SourcePackingDirectory)SourceYardCompilePackageFile.txt</SourceYardCompilePackageFile>
<SourceYardResourcePackageFile>$(SourcePackingDirectory)SourceYardResourcePackageFile.txt</SourceYardResourcePackageFile>
<SourceYardContentPackageFile>$(SourcePackingDirectory)SourceYardContentPackageFile.txt</SourceYardContentPackageFile>
<SourceYardNonePackageFile>$(SourcePackingDirectory)SourceYardNonePackageFile.txt</SourceYardNonePackageFile>
<SourceYardEmbeddedResourcePackageFile>$(SourcePackingDirectory)SourceYardEmbeddedResourcePackageFile.txt</SourceYardEmbeddedResourcePackageFile>
<SourceYardCompilePackageFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardCompilePackageFile.txt"))</SourceYardCompilePackageFile>
<SourceYardResourcePackageFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardResourcePackageFile.txt"))</SourceYardResourcePackageFile>
<SourceYardContentPackageFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardContentPackageFile.txt"))</SourceYardContentPackageFile>
<SourceYardNonePackageFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardNonePackageFile.txt"))</SourceYardNonePackageFile>
<SourceYardEmbeddedResourcePackageFile>$([System.IO.Path]::Combine($(SourcePackingDirectory),"SourceYardEmbeddedResourcePackageFile.txt"))</SourceYardEmbeddedResourcePackageFile>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -103,24 +104,24 @@
<SourceYardRepositoryUrl Condition="$(RepositoryUrl) != ''">RepositoryUrl "$(RepositoryUrl)"</SourceYardRepositoryUrl>
<SourceYardRepositoryType Condition="$(RepositoryType) != ''">RepositoryType "$(RepositoryType)"</SourceYardRepositoryType>
<SourceYardPackageProjectUrl Condition="$(PackageProjectUrl) != ''">PackageProjectUrl "$(PackageProjectUrl)"</SourceYardPackageProjectUrl>-->
<SourceYardPackageLicenseUrl Condition="$(PackageLicenseUrl) != ''">--PackageLicenseUrl "$(PackageLicenseUrl) "</SourceYardPackageLicenseUrl>
<SourceYardPackageLicenseUrl Condition="$(PackageLicenseUrl) != ''">--PackageLicenseUrl "$(PackageLicenseUrl)"</SourceYardPackageLicenseUrl>

<SourceYardCopyright Condition="$(Copyright) != ''">--CopyrightFile "$(CopyrightFile)"</SourceYardCopyright>

<SourceYardPackageVersion Condition="$(PackageVersion) != ''">-v $(PackageVersion)</SourceYardPackageVersion>

<SourceYardDescription Condition="$(Description) != ''">--DescriptionFile "$(DescriptionFile) "</SourceYardDescription>
<SourceYardDescription Condition="$(Description) != ''">--DescriptionFile "$(DescriptionFile)"</SourceYardDescription>

<SourceYardTitle Condition="$(Title) != ''">--Title "$(Title)"</SourceYardTitle>
<SourceYardOwner Condition="$(Owner) != ''">--Owner "$(Owner)"</SourceYardOwner>
<SourceYardPackageTags Condition="$(PackageTags) != ''">--PackageTags "$(PackageTags) "</SourceYardPackageTags>
<SourceYardPackageTags Condition="$(PackageTags) != ''">--PackageTags "$(PackageTags)"</SourceYardPackageTags>
<SourceYardPackageReleaseNotes Condition="$(PackageReleaseNotes) != ''"> --PackageReleaseNotesFile $(PackageReleaseNotesFile)</SourceYardPackageReleaseNotes>
<SourceYardPackageId Condition="'$(PackageId)' != ''">--PackageId "$(PackageId) "</SourceYardPackageId>
<SourceYardPackageId Condition="'$(PackageId)' != ''">--PackageId "$(PackageId)"</SourceYardPackageId>

<SourceMSBuildProjectFullPath>-p "$(MSBuildProjectFullPath) "</SourceMSBuildProjectFullPath>
<SourceMSBuildProjectFullPath>-p "$(MSBuildProjectFullPath)"</SourceMSBuildProjectFullPath>

<SourcePackageOutputPath Condition="'$(PackageOutputPath)' != ''">-n "$(PackageOutputPath) "</SourcePackageOutputPath>
<SourcePackageOutputPath Condition="'$(PackageOutputPath)' == '' and $(OutputPath) != ''">-n "$(OutputPath) "</SourcePackageOutputPath>
<SourcePackageOutputPath Condition="'$(SourcePackageOutputPath)' == '' and $(OutputPath) != ''">-n "$(OutputPath) "</SourcePackageOutputPath>

</PropertyGroup>

Expand Down Expand Up @@ -199,7 +200,7 @@
</PropertyGroup>

<Exec
Command="$(SourceYardApplicationFilePath) $(SourceMSBuildProjectFullPath) $(SourcePackageOutputPath) $(SourceYardPackageVersion) $(SourceYardAuthors) $(SourceYardRepositoryUrl) $(SourceYardRepositoryType) $(SourceYardPackageProjectUrl) $(SourceYardCopyright) $(SourceYardDescription) $(SourceYardTitle) $(SourceYardPackageLicenseUrl) $(SourceYardPackageReleaseNotes) $(SourceYardPackageTags) $(SourceYardOwner) $(SourceYardPackageId) --TargetFrameworks &quot;$(TargetFrameworks) &quot; --TargetFramework &quot;$(TargetFramework) &quot; --MultiTargetingPackageInfoFolder &quot;$(_SourceYardMultiTargetingPackageInfoFolder) &quot;">
Command="$(SourceYardApplicationFilePath) $(SourceMSBuildProjectFullPath) $(SourcePackageOutputPath) $(SourceYardPackageVersion) $(SourceYardAuthors) $(SourceYardRepositoryUrl) $(SourceYardRepositoryType) $(SourceYardPackageProjectUrl) $(SourceYardCopyright) $(SourceYardDescription) $(SourceYardTitle) $(SourceYardPackageLicenseUrl) $(SourceYardPackageReleaseNotes) $(SourceYardPackageTags) $(SourceYardOwner) $(SourceYardPackageId) --TargetFrameworks &quot;$(TargetFrameworks) &quot; --TargetFramework &quot;$(TargetFramework) &quot; --MultiTargetingPackageInfoFolder &quot;$(_SourceYardMultiTargetingPackageInfoFolder)&quot;">
</Exec>

<Message Text="Finish SourceYardStep3"></Message>
Expand All @@ -211,7 +212,7 @@

<Target Name="_SourceYardClean">
<PropertyGroup>
<_SourcePackingDirectory>$(IntermediateOutputPath)SourcePacking\</_SourcePackingDirectory>
<_SourcePackingDirectory>$([System.IO.Path]::Combine($(IntermediateOutputPath),"SourcePacking"))</_SourcePackingDirectory>
</PropertyGroup>
<RemoveDir Directories="$(_SourcePackingDirectory)" />
</Target>
Expand Down
6 changes: 3 additions & 3 deletions src/dotnetCampus.SourceYard/Cli/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal class Options
/// <summary>
/// 项目文件所在的路径
/// </summary>
[Option('p', "project", Description = "The full path of the project file.")]
[Option('p', "Project", Description = "The full path of the project file.")]
public string ProjectFile { get; set; } = null!;

///// <summary>
Expand All @@ -19,13 +19,13 @@ internal class Options
/// <summary>
/// 打包输出的文件夹
/// </summary>
[Option('n', "package-output-path", Description = "The package output full path of the project.")]
[Option('n', "PackageOutputPath", Description = "The package output full path of the project.")]
public string PackageOutputPath { get; set; } = null!;

/// <summary>
/// 当前项目的打包版本
/// </summary>
[Option('v', "package-version",
[Option('v', "PackageVersion",
// 默认不需要加上打包版本
Description = "The package version value.")]
public string PackageVersion { get; set; } = "1.0.0";
Expand Down
4 changes: 4 additions & 0 deletions src/dotnetCampus.SourceYard/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ private static void RunOptionsAndReturnExitCode(Options options)
// 安装的项目的兼容性无法处理?源代码包有 net45 框架,项目是 net47 框架,如何让项目能兼容使用到 net45 框架?当前没有此生成逻辑
var sourcePackingFolder = GetCommonSourcePackingFolder(multiTargetingPackageInfo, logger);
var packageOutputPath = options.PackageOutputPath;
if (!string.IsNullOrEmpty(packageOutputPath))
{
packageOutputPath = packageOutputPath.Trim();
}
var packageVersion = options.PackageVersion;

// logger.Message($@"项目文件 {projectFile}
Expand Down
3 changes: 3 additions & 0 deletions src/dotnetCampus.SourceYard/dotnetCampus.SourceYard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

<!-- 现在 CI 上没有 .NET Framework 4.5 的支持,需要手动加上 Microsoft.NETFramework.ReferenceAssemblies 才能修复构建。详细请看 https://blog.walterlv.com/post/support-old-netfx-on-vs2022-or-later -->
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework)=='net45'">
Expand Down