From 7a90259d6a8e55c200502b1b0e5ea1d4868e867b Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 4 Jul 2024 14:47:02 +1200 Subject: [PATCH 1/8] Transitive build script now creates releases --- src/Sentry/buildTransitive/Sentry.targets | 106 +++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index 952c2e91e2..69ed893998 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -37,12 +37,14 @@ false false + false + false true @@ -92,6 +94,8 @@ "$(SentryCLI)" $(SentryCLIBaseCommand) $(SentryCLIBaseOptions.Trim()) + $(SentryReleaseOptions) --project $(SentryProject) + $(SentryCLIUploadOptions) --org $(SentryOrg) $(SentryCLIUploadOptions) --project $(SentryProject) $(SentryCLIBaseCommand) debug-files upload @@ -242,5 +246,105 @@ + + + + + + + + + + ()?.InformationalVersion; + if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(version)) + { + Release = $"{name}@{version}"; + } + } + catch + { + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + $(ApplicationId)@$(ApplicationDisplayVersion)+$(ApplicationVersion) + + + + + + + + + + + + + + + %(MainAssemblyIdentity.Name)@%(Version) + + + + + + + + + + + + + + + From 33beb92ad6773ef9b66e3d209ddcf615662cbe20 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 4 Jul 2024 15:20:48 +1200 Subject: [PATCH 2/8] Added target to set commits --- src/Sentry/buildTransitive/Sentry.targets | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index 69ed893998..3898a9dbb4 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -37,8 +37,10 @@ false false - false false + + true + false @@ -96,6 +98,8 @@ $(SentryReleaseOptions) --project $(SentryProject) + --auto + $(SentryCLIUploadOptions) --org $(SentryOrg) $(SentryCLIUploadOptions) --project $(SentryProject) $(SentryCLIBaseCommand) debug-files upload @@ -344,7 +348,16 @@ - + + + + + + + From 45e36608cabbd1706acabdbcac0167cba4594147 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 4 Jul 2024 17:24:07 +1200 Subject: [PATCH 3/8] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 742b75a37e..07fe8751e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Features + +- Added build properties to automatically create releases and associated commits ([#3462](https://github.com/getsentry/sentry-dotnet/pull/3462)) + ### Fixes - The SDK no longer fails to create a trace root ([#3453](https://github.com/getsentry/sentry-dotnet/pull/3453)) From 61cca84b41e2cdfecf04ec7cc6b103a1f2282bab Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 4 Jul 2024 17:40:44 +1200 Subject: [PATCH 4/8] Added commit hash as fallback version (when we can't get one from the assembly information) --- src/Sentry/buildTransitive/Sentry.targets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index 3898a9dbb4..bd49038376 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -334,6 +334,11 @@ %(MainAssemblyIdentity.Name)@%(Version) + + + + From 1ee0ccfb72a1037cb2e1415d3c26892905dbf8e8 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 8 Jul 2024 13:27:53 +1200 Subject: [PATCH 5/8] Update Sentry.targets --- src/Sentry/buildTransitive/Sentry.targets | 62 ++++------------------- 1 file changed, 11 insertions(+), 51 deletions(-) diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index bd49038376..2c047ea454 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -96,6 +96,7 @@ "$(SentryCLI)" $(SentryCLIBaseCommand) $(SentryCLIBaseOptions.Trim()) + $(SENTRY_RELEASE) $(SentryReleaseOptions) --project $(SentryProject) --auto @@ -250,7 +251,7 @@ - + @@ -267,10 +268,14 @@ var assemblyName = assembly.GetName(); var name = assemblyName.Name; - var version = assembly.GetCustomAttribute()?.InformationalVersion; - if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(version)) + + var infoVersionAttribute = assembly.GetCustomAttribute(); + var version = infoVersionAttribute?.InformationalVersion ?? assemblyName.Version?.ToString(); + if (!string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(version)) { - Release = $"{name}@{version}"; + Release = version.Contains('@') + ? version // Don't add name prefix if it's already set by the user + : $"{name}@{version}"; } } catch @@ -281,58 +286,13 @@ - - - - - - - - - - - - - - - - $(ApplicationId)@$(ApplicationDisplayVersion)+$(ApplicationVersion) - - - - - - - + - - - - - - - %(MainAssemblyIdentity.Name)@%(Version) - + From bab1c7933de917c0d23392d4275b74bf9e9a7e8d Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 8 Jul 2024 14:01:37 +1200 Subject: [PATCH 6/8] Update Sentry.targets --- src/Sentry/buildTransitive/Sentry.targets | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index 2c047ea454..a37136a73d 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -263,23 +263,42 @@ (); - var version = infoVersionAttribute?.InformationalVersion ?? assemblyName.Version?.ToString(); + Log.LogMessage($"Reading AssemblyInformationalVersionAttribute..."); + string? version = null; + try + { + var infoVersionAttribute = assembly.GetCustomAttribute(); + version = infoVersionAttribute?.InformationalVersion; + } + catch + { + Log.LogMessage($"Failed to read informational version attribute"); + } + version ??= assemblyName.Version?.ToString(); + Log.LogMessage($"Version: {version}"); + + Log.LogMessage($"Compiling release information..."); if (!string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(version)) { Release = version.Contains('@') ? version // Don't add name prefix if it's already set by the user : $"{name}@{version}"; } +#nullable disable } catch { + Log.LogWarning($"Failed to get version from {AssemblyPath}"); } ]]> From 630908cbd03f5959d0316a3f5911ea433f5f4b04 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 12 Jul 2024 12:37:31 +1200 Subject: [PATCH 7/8] Update CHANGELOG.md --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e52f333cb..7390862a07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Features + +- Added build properties to automatically create releases and associated commits ([#3462](https://github.com/getsentry/sentry-dotnet/pull/3462)) + ## 4.9.0 ### Fixes @@ -9,7 +15,6 @@ ### Features - Client reports now include dropped spans ([#3463](https://github.com/getsentry/sentry-dotnet/pull/3463)) -- Added build properties to automatically create releases and associated commits ([#3462](https://github.com/getsentry/sentry-dotnet/pull/3462)) ### API Changes From af740ebc0944bce71f694bbdc16c5fea0c14fb0b Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 12 Jul 2024 12:46:55 +1200 Subject: [PATCH 8/8] Made SentryRelease build property private --- src/Sentry/buildTransitive/Sentry.targets | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index a37136a73d..ae1b83a68c 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -96,9 +96,7 @@ "$(SentryCLI)" $(SentryCLIBaseCommand) $(SentryCLIBaseOptions.Trim()) - $(SENTRY_RELEASE) $(SentryReleaseOptions) --project $(SentryProject) - --auto $(SentryCLIUploadOptions) --org $(SentryOrg) @@ -305,28 +303,33 @@ + + + <_SentryRelease Condition="'$(_SentryRelease)' == '' And '$(SENTRY_RELEASE)' != ''">$(SENTRY_RELEASE) + + - - + + - - + - + - + @@ -337,7 +340,7 @@ Condition="'$(SentryCLI)' != '' and '$(SentrySetCommits)' == 'true'">