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

chore(build): Add an error message when build with missing header due to APPLICATION_EXTENSION_API_ONLY=NO #4603

Merged
merged 16 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Improvements

- Improve compiler error message for missing Swift declarations due to APPLICATION_EXTENSION_API_ONLY (#4603)

## 8.42.0-beta.2

### Fixes
Expand Down
3 changes: 2 additions & 1 deletion Sentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Pod::Spec.new do |s|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
'CLANG_CXX_LIBRARY' => 'libc++',
'APPLICATION_EXTENSION_API_ONLY' => 'YES',
'SWIFT_INCLUDE_PATHS' => '${PODS_TARGET_SRCROOT}/Sources/Sentry/include'
'SWIFT_INCLUDE_PATHS' => '${PODS_TARGET_SRCROOT}/Sources/Sentry/include',
'OTHER_CFLAGS' => '$(inherited) -DAPPLICATION_EXTENSION_API_ONLY_$(APPLICATION_EXTENSION_API_ONLY)'
}
s.watchos.pod_target_xcconfig = {
'OTHER_LDFLAGS' => '$(inherited) -framework WatchKit'
Expand Down
12 changes: 0 additions & 12 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5329,7 +5329,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_ASSIGN_ENUM = NO;
Expand All @@ -5350,7 +5349,6 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
MODULEMAP_PRIVATE_FILE = "";
OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -5362,7 +5360,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_ASSIGN_ENUM = NO;
Expand All @@ -5388,7 +5385,6 @@
"@loader_path/Frameworks",
);
MODULEMAP_PRIVATE_FILE = "";
OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
USE_HEADERMAP = YES;
Expand Down Expand Up @@ -5520,7 +5516,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_ASSIGN_ENUM = NO;
Expand All @@ -5546,7 +5541,6 @@
"@loader_path/Frameworks",
);
MODULEMAP_PRIVATE_FILE = "";
OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -5646,7 +5640,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_ASSIGN_ENUM = NO;
Expand All @@ -5672,7 +5665,6 @@
"@loader_path/Frameworks",
);
MODULEMAP_PRIVATE_FILE = "";
OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -6123,7 +6115,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_ASSIGN_ENUM = NO;
Expand All @@ -6149,7 +6140,6 @@
"@loader_path/Frameworks",
);
MODULEMAP_PRIVATE_FILE = "";
OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
USE_HEADERMAP = YES;
Expand Down Expand Up @@ -6351,7 +6341,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 63AA75C51EB8B00100D153DE /* Sentry.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_ASSIGN_ENUM = NO;
Expand All @@ -6377,7 +6366,6 @@
"@loader_path/Frameworks",
);
MODULEMAP_PRIVATE_FILE = "";
OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 2 additions & 0 deletions Sources/Configuration/Sentry.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ PRODUCT_BUNDLE_IDENTIFIER = io.sentry.$(PRODUCT_MODULE_NAME)
MODULEMAP_FILE = $(SRCROOT)/Sources/Resources/$(PRODUCT_MODULE_NAME_$(CONFIGURATION)).modulemap
ARCHS = $(ARCHS_STANDARD) arm64e
ARCHS[sdk=*simulator] = $(ARCHS_STANDARD)
APPLICATION_EXTENSION_API_ONLY = YES
OTHER_CFLAGS = -DCARTHAGE_$(CARTHAGE) -DAPPLICATION_EXTENSION_API_ONLY_$(APPLICATION_EXTENSION_API_ONLY)
6 changes: 6 additions & 0 deletions Sources/Sentry/Public/SentryDefines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#import <Foundation/Foundation.h>

// SentryDefines.h is a key header and will be checked early,
// ensuring this error appears first during the compile process.
krystofwoldrich marked this conversation as resolved.
Show resolved Hide resolved
#if APPLICATION_EXTENSION_API_ONLY_NO
# error Set APPLICATION_EXTENSION_API_ONLY to YES in the Sentry build settings.
brustolin marked this conversation as resolved.
Show resolved Hide resolved
#endif
philipphofmann marked this conversation as resolved.
Show resolved Hide resolved

#ifdef __cplusplus
# define SENTRY_EXTERN extern "C" __attribute__((visibility("default")))
#else
Expand Down
1 change: 0 additions & 1 deletion Sources/Sentry/include/SentrySwift.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@
# import <Sentry/Sentry-Swift.h>
# endif
#endif // __has_include(<SentryWithoutUIKit/Sentry.h>)

#endif