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

[Innovation week] Enable compilation for macOS #1711

Merged
merged 16 commits into from
Apr 24, 2024

Conversation

maciejburda
Copy link
Member

@maciejburda maciejburda commented Mar 7, 2024

What and why?

These changes enable macOS support for Core, Logs, Trace, Crash Reporting and Web View Tracking as well as add some minor tweaks for VisionOS support.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests for Core, RUM, Trace, Logs, CR and WVT
  • Run unit tests for Session Replay
  • Run integration tests
  • Run smoke tests
  • Run tests for tools/

@maciejburda maciejburda force-pushed the maciey/innovation-week-changes branch from 8371e78 to 9b0151a Compare March 22, 2024 13:04
@maciejburda maciejburda marked this pull request as ready for review April 2, 2024 11:48
@maciejburda maciejburda requested review from a team as code owners April 2, 2024 11:48
@maciejburda maciejburda force-pushed the maciey/innovation-week-changes branch 2 times, most recently from 5c55eff to 5d959ad Compare April 2, 2024 12:33
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Apr 2, 2024

Datadog Report

Branch report: maciey/innovation-week-changes
Commit report: 5d3252b
Test service: dd-sdk-ios

✅ 0 Failed, 2954 Passed, 0 Skipped, 30m 37.02s Wall Time
🔻 Test Sessions change in coverage: 12 decreased, 2 increased, 1 no change

🔻 Code Coverage Decreases vs Default Branch (12)

This report shows up to 5 code coverage decreases.

  • test DatadogInternalTests iOS 79.08% (-0.67%) - Details
  • test DatadogInternalTests tvOS 79.09% (-0.63%) - Details
  • test DatadogTraceTests tvOS 49.23% (-0.51%) - Details
  • test DatadogRUMTests iOS 79.22% (-0.49%) - Details
  • test DatadogLogsTests iOS 45.48% (-0.46%) - Details

@MaximBazarov MaximBazarov mentioned this pull request Apr 3, 2024
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

With adding so many #if <os> directives we need at least smoke tests that will verify build compatibility for macOS.

DatadogCore/Private/ObjcAppLaunchHandler.m Outdated Show resolved Hide resolved
@maciejburda maciejburda force-pushed the maciey/innovation-week-changes branch from 5d3252b to d160960 Compare April 17, 2024 12:46
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Apr 17, 2024

Datadog Report

Branch report: maciey/innovation-week-changes
Commit report: 8973121
Test service: dd-sdk-ios

✅ 0 Failed, 3053 Passed, 0 Skipped, 30m 53.18s Wall Time
🔻 Test Sessions change in coverage: 3 decreased, 12 increased

🔻 Code Coverage Decreases vs Default Branch (3)

  • test DatadogRUMTests tvOS 80.85% (-0.18%) - Details
  • test DatadogCoreTests tvOS 79.56% (-0.06%) - Details
  • test DatadogCoreTests iOS 73.48% (-0.01%) - Details

@maciejburda maciejburda force-pushed the maciey/innovation-week-changes branch from 58ac3ec to 090d4a8 Compare April 18, 2024 11:43
@maciejburda maciejburda requested a review from ncreated April 18, 2024 11:44
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

  • I think we can limit the impact of this PR if targeting a higher macOS version (more might come with official support). I left a question on this.
  • Also, let's change the title of this PR to be more descriptive. Otherwise future selves won't find it.

💪 Other than this is it looks fine - great work on adding a smoke test 🚬 🏅 🚭.

Package.swift Outdated Show resolved Hide resolved
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

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

Looks great, very nice effort! I think we should update the core context provider enablement, especially the LowPowerModePublisher which could be enabled for macOS 12 and above.

DatadogInternal/Sources/Context/DeviceInfo.swift Outdated Show resolved Hide resolved
DatadogRUM/Sources/RUMVitals/VitalRefreshRateReader.swift Outdated Show resolved Hide resolved
dependency-manager-tests/spm/App macOS/ContentView.swift Outdated Show resolved Hide resolved
@maciejburda
Copy link
Member Author

Updated the PR. Supporting macOS 12+ seems quite painless comparing to 10.15 and 11.

PTAL 🙌

@maciejburda maciejburda requested review from maxep and ncreated April 19, 2024 10:19
Copy link
Contributor

@ganeshnj ganeshnj left a comment

Choose a reason for hiding this comment

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

Compiling for macOS 11, but module 'DatadogCore' has a minimum deployment target of macOS 12.0

I tried to compile the SPM dependency manager test app with Xcode 15 and couldn't build. There seems some version mismatch.

@@ -20,7 +20,7 @@ import Network
/// We found the pulling model to not be thread-safe: accessing `currentPath` properties lead to occasional crashes.
/// The `ThreadSafeNWPathMonitor` listens to path updates and synchonizes the values on `.current` property.
/// This adds the necessary thread-safety and keeps the convenience of pulling.
@available(iOS 12, tvOS 12, *)
@available(iOS 12, tvOS 12, macOS 10.15, *)
Copy link
Contributor

Choose a reason for hiding this comment

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


why do we have different macOS support versions here as 10.15 but 10.14 somewhere down?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed it. We agreed to support 12+

guard let flags = flags, flags.contains(.isWWAN) else {
return nil
}
self = .cellular
#else
self = .other
Copy link
Contributor

Choose a reason for hiding this comment

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

There are no mac with cellular connection, this must nil for macOS.

Comment on lines +115 to +116
let build = (try? Sysctl.osVersion()) ?? ""
let model = (try? Sysctl.model()) ?? ""
Copy link
Contributor

Choose a reason for hiding this comment

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

can they just be nil?

Also, are there high level APIs for such information?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're required by schema

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, instead empty string some other string would be helpful in querying like <unknown> or <unrecognized>

@@ -5,13 +5,18 @@
| **iOS** | ✅ | `11+` |
| **tvOS** | ✅ | `11+` |
| **iPadOS** | ✅ | `11+` |
| **VisionOS** | ⚠️ | `1.1+` |
| **visionOS** | ⚠️ | `1.0+` |
| **macOS** | ⚠️ | `10.15+` |
Copy link
Contributor

Choose a reason for hiding this comment

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

What kind of support we are offering here, I see

  • Mac (I think this is most interesting)
  • Mac Catalyst
  • Mac Designed for iPad
image

Copy link
Member Author

Choose a reason for hiding this comment

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

I made some adjustment based on previous comment. Now we only support 12+

Now target destination is a pandora box.

I'd like to discuss during the SDK meeting.
I think we can simplify and have only one target with all the destinations, instead of current iOS/tvOS split


## MacOS

MacOS is not officially supported by Datadog SDK. Some features may not be fully functional. Note that `RUM`, which heavily depends on `UIKit` does not build on macOS.
Copy link
Contributor

Choose a reason for hiding this comment

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

If we know this is not going to build, we must not add RUM support in project. This will cause unnecessary friction.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can only have one Package definition and as far as I know, and we can't do selective destination (Session Replay is iOS only for example)

@@ -360,6 +360,18 @@ workflows:
-project "$BITRISE_SOURCE_DIR/dependency-manager-tests/spm/SPMProject.xcodeproj" \
-destination "platform=macOS,variant=Mac Catalyst" \
| xcpretty
- script:
title: Check macOS compatibility (build SPMProject for macOS)
Copy link
Contributor

Choose a reason for hiding this comment

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


Only SPM?

Copy link
Member Author

Choose a reason for hiding this comment

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

It follows what we did for Mac Catalyst. It's minimal effort for the smoke test, as the support is not official

@ganeshnj
Copy link
Contributor

I tried the latest version 7b094e8 but still couldn't get the sample SPM app logs and tracing working yet. I think this is minimum bar that the project not only compiles but have some basic things working.

ganeshnj
ganeshnj previously approved these changes Apr 23, 2024
@ncreated ncreated changed the title Innovation week changes [Innovation week] Enable compilation for macOS Apr 23, 2024
ncreated
ncreated previously approved these changes Apr 23, 2024
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

Looks good 👍. I changed the PR title to be more descriptive. Great initiative, thanks 🏅

Co-authored-by: Ganesh Jangir <ganesh.jangir@datadoghq.com>
@maciejburda maciejburda dismissed stale reviews from ncreated and ganeshnj via c08e66b April 23, 2024 18:17
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

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

Thanks!

@maciejburda maciejburda merged commit 79943d3 into develop Apr 24, 2024
20 checks passed
@maciejburda maciejburda deleted the maciey/innovation-week-changes branch April 24, 2024 14:28
@ganeshnj ganeshnj mentioned this pull request May 2, 2024
8 tasks
@maciejburda maciejburda mentioned this pull request May 7, 2024
8 tasks
This was referenced May 7, 2024
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.

5 participants