-
-
Notifications
You must be signed in to change notification settings - Fork 31
Move template AssemblyInfo generation from FAKE files to MSBuild pack-time metadata #320
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
Changes from 4 commits
4786fec
f929bdf
89e5986
ac327af
1364acb
c6c3c1a
a37a01c
ce5cc1f
0e24dd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,11 +364,39 @@ let deleteChangelogBackupFile _ = | |
| if String.isNotNullOrEmpty Changelog.changelogBackupFilename then | ||
| Shell.rm Changelog.changelogBackupFilename | ||
|
|
||
| let assemblyInfoMsBuildArgs () = | ||
| let releaseChannel = | ||
| match latestEntry.SemVer.PreRelease with | ||
| | Some pr -> pr.Name | ||
| | _ -> "release" | ||
|
|
||
| let releaseDate = latestEntry.Date.Value.ToString("o") | ||
|
|
||
| let gitHash = | ||
| try | ||
| Git.Information.getCurrentSHA1 (null) | ||
| with _ -> | ||
| "" | ||
|
|
||
| [ | ||
| $"/p:Version={latestEntry.AssemblyVersion}" | ||
| $"/p:AssemblyVersion={latestEntry.AssemblyVersion}" | ||
| $"/p:FileVersion={latestEntry.AssemblyVersion}" | ||
| $"/p:InformationalVersion={latestEntry.AssemblyVersion}" | ||
| $"/p:AssemblyMetadataReleaseDate={releaseDate}" | ||
| $"/p:AssemblyMetadataReleaseChannel={releaseChannel}" | ||
| $"/p:AssemblyMetadataGitHash={gitHash}" | ||
| ] | ||
|
|
||
|
|
||
| let dotnetBuild ctx = | ||
| let isDotnetPack = ctx.Context.TryFindTarget("DotnetPack").IsSome | ||
|
|
||
| let args = [ | ||
| sprintf "/p:PackageVersion=%s" latestEntry.NuGetVersion | ||
| "--no-restore" | ||
| if isDotnetPack then | ||
| yield! assemblyInfoMsBuildArgs () | ||
| ] | ||
|
|
||
| DotNet.build | ||
|
|
@@ -510,68 +538,18 @@ let watchTests _ = | |
| cancelEvent.Cancel <- true | ||
|
|
||
| let generateAssemblyInfo _ = | ||
| let isNoop = true | ||
|
|
||
| let (|Fsproj|Csproj|Vbproj|) (projFileName: string) = | ||
| match projFileName with | ||
| | f when f.EndsWith("fsproj") -> Fsproj | ||
| | f when f.EndsWith("csproj") -> Csproj | ||
| | f when f.EndsWith("vbproj") -> Vbproj | ||
| | _ -> | ||
| failwith (sprintf "Project file %s not supported. Unknown project type." projFileName) | ||
|
|
||
| let releaseChannel = | ||
| match latestEntry.SemVer.PreRelease with | ||
| | Some pr -> pr.Name | ||
| | _ -> "release" | ||
|
|
||
| let getAssemblyInfoAttributes projectName = [ | ||
| AssemblyInfo.Title(projectName) | ||
| AssemblyInfo.Product productName | ||
| AssemblyInfo.Version latestEntry.AssemblyVersion | ||
| AssemblyInfo.Metadata("ReleaseDate", latestEntry.Date.Value.ToString("o")) | ||
| AssemblyInfo.FileVersion latestEntry.AssemblyVersion | ||
| AssemblyInfo.InformationalVersion latestEntry.AssemblyVersion | ||
| AssemblyInfo.Metadata("ReleaseChannel", releaseChannel) | ||
| AssemblyInfo.Metadata("GitHash", Git.Information.getCurrentSHA1 (null)) | ||
| ] | ||
|
|
||
| let getProjectDetails (projectPath: string) = | ||
| let projectName = IO.Path.GetFileNameWithoutExtension(projectPath) | ||
|
|
||
| (projectPath, | ||
| projectName, | ||
| IO.Path.GetDirectoryName(projectPath), | ||
| (getAssemblyInfoAttributes projectName)) | ||
|
|
||
| !!srcGlob | ||
| |> Seq.map getProjectDetails | ||
| |> Seq.iter (fun (projFileName, _, folderName, attributes) -> | ||
| match projFileName with | ||
| | Fsproj -> | ||
| AssemblyInfoFile.createFSharp | ||
| (folderName | ||
| </> "AssemblyInfo.fs") | ||
| attributes | ||
| | Csproj -> | ||
| AssemblyInfoFile.createCSharp | ||
| ((folderName | ||
| </> "Properties") | ||
| </> "AssemblyInfo.cs") | ||
| attributes | ||
| | Vbproj -> | ||
| AssemblyInfoFile.createVisualBasic | ||
| ((folderName | ||
| </> "My Project") | ||
| </> "AssemblyInfo.vb") | ||
| attributes | ||
| ) | ||
| if isNoop then | ||
| () | ||
|
TheAngryByrd marked this conversation as resolved.
Outdated
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot This should just be deleted. What are you even doing.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in c6c3c1a. I deleted the no-op |
||
|
|
||
| let dotnetPack ctx = | ||
| // Get release notes with properly-linked version number | ||
| let releaseNotes = Changelog.mkReleaseNotes changelog latestEntry gitHubRepoUrl | ||
|
|
||
| let args = [ | ||
| $"/p:PackageVersion={latestEntry.NuGetVersion}" | ||
| yield! assemblyInfoMsBuildArgs () | ||
| $"/p:PackageReleaseNotes=\"{releaseNotes}\"" | ||
| ] | ||
|
|
||
|
|
@@ -620,15 +598,6 @@ let gitRelease _ = | |
| Git.Staging.stageFile "" "CHANGELOG.md" | ||
| |> ignore | ||
|
|
||
| !!(rootDirectory | ||
| </> "src/**/AssemblyInfo.fs") | ||
| ++ (rootDirectory | ||
| </> "tests/**/AssemblyInfo.fs") | ||
| |> Seq.iter ( | ||
| Git.Staging.stageFile "" | ||
| >> ignore | ||
| ) | ||
|
|
||
| let msg = | ||
| sprintf "Bump version to %s\n\n%s" latestEntry.NuGetVersion releaseNotesGitCommitFormat | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| <Project> | ||
| <PropertyGroup> | ||
| <PropertyGroup> | ||
| <RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild> | ||
| <FSharpAnalyzersOtherFlags>--analyzers-path "$(PkgG-Research_FSharp_Analyzers)/analyzers/dotnet/fs"</FSharpAnalyzersOtherFlags> | ||
| <FSharpAnalyzersOtherFlags>$(FSharpAnalyzersOtherFlags) --analyzers-path "$(PkgIonide_Analyzers)/analyzers/dotnet/fs"</FSharpAnalyzersOtherFlags> | ||
| </PropertyGroup> | ||
| </Project> | ||
|
|
||
| <ItemGroup Condition="'$(IsPacking)' == 'true'"> | ||
|
TheAngryByrd marked this conversation as resolved.
Outdated
|
||
| <AssemblyMetadata Include="ReleaseDate" Value="$(AssemblyMetadataReleaseDate)" Condition="'$(AssemblyMetadataReleaseDate)' != ''" /> | ||
| <AssemblyMetadata Include="ReleaseChannel" Value="$(AssemblyMetadataReleaseChannel)" Condition="'$(AssemblyMetadataReleaseChannel)' != ''" /> | ||
| <AssemblyMetadata Include="GitHash" Value="$(AssemblyMetadataGitHash)" Condition="'$(AssemblyMetadataGitHash)' != ''" /> | ||
| </ItemGroup> | ||
| </Project> | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.