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

Provide version information in DLL #1076

Merged
merged 12 commits into from
Nov 12, 2024

Conversation

olback
Copy link
Contributor

@olback olback commented Nov 6, 2024

When building sentry-native as a DLL, there is currently no easy way to determine what version it is.
Windows allows you to specify version information in a resource file, the version can then be found in 'Properties' from Explorer. The version can also be queried programatically with GetFileVersionInfo{A,W}.

Here's an example (in Swedish):
bild

CMakeLists.txt Outdated Show resolved Hide resolved
sentry.rc.in Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.59%. Comparing base (d241dbc) to head (36c4a58).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1076      +/-   ##
==========================================
- Coverage   82.66%   82.59%   -0.07%     
==========================================
  Files          53       53              
  Lines        7717     7717              
  Branches     1213     1213              
==========================================
- Hits         6379     6374       -5     
- Misses       1227     1230       +3     
- Partials      111      113       +2     

@olback olback marked this pull request as ready for review November 6, 2024 17:58
Copy link
Collaborator

@supervacuus supervacuus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! There are certainly some users who appreciate this very much.

sentry.rc.in Outdated Show resolved Hide resolved
sentry.rc.in Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
* moved code to utility function
* that function uses the target argument to generate all required files (only manual parameter is the file description)
* switched from manual string replacement to `configure_file()` which creates another intermediate file
* to generate the final *.rc file we use file(GENERATE) together with `TARGET_FILE_NAME` generator expression to retrieve "OriginFilename" during the generate-time (between configure and build phase).
* ensure that unit-tests don't pick up unnecessary resource-sources
Copy link
Collaborator

@supervacuus supervacuus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM. I made a few minor changes so that we can reuse your code for crashpad.

Please don't merge; I will do this soon.

Copy link
Member

@JoshuaMoelans JoshuaMoelans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@supervacuus supervacuus merged commit 7a882d3 into getsentry:master Nov 12, 2024
23 checks passed
@vaind
Copy link
Collaborator

vaind commented Nov 21, 2024

This PR broke usage of sentry-native as a submodule, e.g. in sentry-flutter:

Shell: -- The ASM compiler identification is MSVC
Shell: -- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe
Shell: -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
Shell: -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
Shell: -- Looking for pthread_create in pthreads
Shell: -- Looking for pthread_create in pthreads - not found
Shell: -- Looking for pthread_create in pthread
Shell: -- Looking for pthread_create in pthread - not found
Shell: -- Found Threads: TRUE
Shell: -- SENTRY_TRANSPORT=winhttp
Shell: -- SENTRY_BACKEND=crashpad
Shell: -- SENTRY_LIBRARY_TYPE=SHARED
Shell: -- SENTRY_SDK_NAME=sentry.native.flutter
Shell: -- Looking for sys/types.h
Shell: -- Looking for sys/types.h - found
Shell: -- Looking for stdint.h
Shell: -- Looking for stdint.h - found
Shell: -- Looking for stddef.h
Shell: -- Looking for stddef.h - found
Shell: -- Check size of long
Shell: -- Check size of long - done
Shell: CMake Error: File D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/conf/sentry.rc.in does not exist.
Shell: CMake Error at D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/build/_deps/sentry-native-src/cmake/utils.cmake:14 (configure_file):
Shell:   configure_file Problem configuring file
Shell: Call Stack (most recent call first):
Shell:   D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/build/_deps/sentry-native-src/CMakeLists.txt:374 (sentry_add_version_resource)
Shell: 
Shell: 
Shell: -- The ASM_MASM compiler identification is MSVC
Shell: -- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/ml64.exe
Shell: CMake Error: File D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/conf/sentry.rc.in does not exist.
Shell: CMake Error at D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/build/_deps/sentry-native-src/cmake/utils.cmake:14 (configure_file):
Shell:   configure_file Problem configuring file
Shell: Call Stack (most recent call first):
Shell:   D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/build/_deps/sentry-native-src/external/crashpad/handler/CMakeLists.txt:118 (sentry_add_version_resource)
Shell: 
Shell: 
Shell: CMake Error: File D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/conf/sentry.rc.in does not exist.
Shell: CMake Error at D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/build/_deps/sentry-native-src/cmake/utils.cmake:14 (configure_file):
Shell:   configure_file Problem configuring file
Shell: Call Stack (most recent call first):
Shell:   D:/a/sentry-dart/sentry-dart/flutter/temp/native-test/build/_deps/sentry-native-src/external/crashpad/handler/CMakeLists.txt:152 (sentry_add_version_resource)
Shell: 
Shell: 
Shell: -- Configuring incomplete, errors occurred!
❌ D:/a/sentry-dart/sentry-dart/flutter/test/sentry_native/sentry_native_test.dart: (setUpAll) (failed)
  Exception: cmake -B D:\a\sentry-dart\sentry-dart\flutter/temp/native-test/build D:\a\sentry-dart\sentry-dart\flutter/temp/native-test/conf failed with exit code 1
  test\sentry_native\sentry_native_test_ffi.dart 244:5  _exec

@supervacuus
Copy link
Collaborator

This PR broke usage of sentry-native as a submodule, e.g. in sentry-flutter:

Yeah, sorry. Fixed here: #1086

I will release it now.

@supervacuus
Copy link
Collaborator

Fix is out: https://github.com/getsentry/sentry-native/releases/tag/0.7.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants