From 5247406d0737e33b203ec60c4ab53adb439f9dbf Mon Sep 17 00:00:00 2001 From: jsonbailey Date: Fri, 16 May 2025 11:16:13 -0500 Subject: [PATCH 1/4] chore: Update SDK client to net8 --- .github/actions/ci/action.yml | 4 +--- .github/actions/xcode-select/action.yml | 22 +++++++++++++++++++ .github/workflows/release-sdk-client.yml | 10 ++++++++- .github/workflows/sdk-client-ci.yml | 6 ++++- pkgs/sdk/client/CONTRIBUTING.md | 4 ++-- pkgs/sdk/client/README.md | 12 +++++----- pkgs/sdk/client/contract-tests/README.md | 2 +- .../client/contract-tests/TestService.csproj | 2 +- pkgs/sdk/client/github_actions.env | 2 +- .../scripts/start-contract-test-service.sh | 2 +- pkgs/sdk/client/src/Internal/SdkPackage.cs | 14 ++++++------ .../client/src/LaunchDarkly.ClientSdk.csproj | 16 +++++++------- ...LaunchDarkly.ClientSdk.Device.Tests.csproj | 8 +++---- .../LaunchDarkly.ClientSdk.Tests.csproj | 2 +- 14 files changed, 69 insertions(+), 37 deletions(-) create mode 100644 .github/actions/xcode-select/action.yml diff --git a/.github/actions/ci/action.yml b/.github/actions/ci/action.yml index 7fe9fa7a..caf9b3e0 100644 --- a/.github/actions/ci/action.yml +++ b/.github/actions/ci/action.yml @@ -22,9 +22,7 @@ runs: - name: Setup dotnet build tools uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 6.0 - 7.0 + dotnet-version: 8.0 - name: Copy global.json in place shell: bash diff --git a/.github/actions/xcode-select/action.yml b/.github/actions/xcode-select/action.yml new file mode 100644 index 00000000..0ff50aae --- /dev/null +++ b/.github/actions/xcode-select/action.yml @@ -0,0 +1,22 @@ +name: 'Xcode Version Selector' +description: 'Lists available Xcode versions, selects a specific version, and shows the current version' +inputs: + xcode-version: + description: 'The version of Xcode to select' + required: true + default: '16.2' + +runs: + using: composite + steps: + - name: List Available Xcode Versions + shell: bash + run: ls -la /Applications/ | grep "Xcode" + + - name: Select Xcode Version + shell: bash + run: sudo xcode-select -switch /Applications/Xcode_${{ inputs.xcode-version }}.app + + - name: Show Current Xcode Version + shell: bash + run: xcodebuild -version \ No newline at end of file diff --git a/.github/workflows/release-sdk-client.yml b/.github/workflows/release-sdk-client.yml index a0abd37a..0af6e5c4 100644 --- a/.github/workflows/release-sdk-client.yml +++ b/.github/workflows/release-sdk-client.yml @@ -30,6 +30,10 @@ jobs: with: fetch-depth: 0 # fetch all history, useful for docs + - uses: ./.github/actions/xcode-select + with: + xcode-version: '16.2' + - name: Setup Env from project's Env file shell: bash run: echo "$(cat pkgs/sdk/client/github_actions.env)" >> $GITHUB_ENV @@ -45,7 +49,7 @@ jobs: with: project_file: ${{ env.PROJECT_FILE }} test_project_file: ${{ env.TEST_PROJECT_FILE }} - target_test_framework: "net7.0" + target_test_framework: "8.0" - name: Release build uses: ./.github/actions/build-release @@ -122,6 +126,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/xcode-select + with: + xcode-version: '16.2' + - name: Setup Env from project's Env file shell: bash run: echo "$(cat pkgs/sdk/client/github_actions.env)" >> $GITHUB_ENV diff --git a/.github/workflows/sdk-client-ci.yml b/.github/workflows/sdk-client-ci.yml index 0f43f8b1..60ca3dc9 100644 --- a/.github/workflows/sdk-client-ci.yml +++ b/.github/workflows/sdk-client-ci.yml @@ -22,6 +22,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/xcode-select + with: + xcode-version: '16.2' + - name: Setup Env from project's Env file shell: bash run: echo "$(cat pkgs/sdk/client/github_actions.env)" >> $GITHUB_ENV @@ -36,7 +40,7 @@ jobs: with: project_file: ${{ env.PROJECT_FILE}} test_project_file: ${{ env.TEST_PROJECT_FILE}} - target_test_framework: "net7.0" + target_test_framework: "net8.0" - uses: ./.github/actions/contract-tests with: diff --git a/pkgs/sdk/client/CONTRIBUTING.md b/pkgs/sdk/client/CONTRIBUTING.md index 61c63d4d..2ccc03a6 100644 --- a/pkgs/sdk/client/CONTRIBUTING.md +++ b/pkgs/sdk/client/CONTRIBUTING.md @@ -28,10 +28,10 @@ dotnet build src/LaunchDarkly.ClientSdk.csproj Currently this command can only be run on MacOS, because that is the only platform that allows building for all of the targets (.NET Standard, Android, and iOS). -To build the SDK for only one of the supported platforms, add `/p:TargetFramework=X` where `X` is one of the items in the `` list of `LaunchDarkly.ClientSdk.csproj`: `netstandard2.0` for .NET Standard 2.0, `net7.0-android` for Android, etc.: +To build the SDK for only one of the supported platforms, add `/p:TargetFramework=X` where `X` is one of the items in the `` list of `LaunchDarkly.ClientSdk.csproj`: `netstandard2.0` for .NET Standard 2.0, `net8.0-android` for Android, etc.: ``` -dotnet build /p:TargetFramework=net7.0-ios src/LaunchDarkly.ClientSdk.csproj +dotnet build /p:TargetFramework=net8.0-ios src/LaunchDarkly.ClientSdk.csproj ``` Note that the main project, `src/LaunchDarkly.ClientSdk`, contains source files that are built for all platforms (ending in just `.cs`, or `.shared.cs`), and also a smaller amount of code that is conditionally compiled for platform-specific functionality. The latter is all in the `PlatformSpecific` folder. We use `#ifdef` directives only for small sections that differ slightly between platform versions; otherwise the conditional compilation is done according to filename suffix (`.android.cs`, etc.) based on rules in the `.csproj` file. diff --git a/pkgs/sdk/client/README.md b/pkgs/sdk/client/README.md index 009c4498..031d7f5b 100644 --- a/pkgs/sdk/client/README.md +++ b/pkgs/sdk/client/README.md @@ -15,13 +15,13 @@ For using LaunchDarkly in *server-side* .NET applications, refer to our [Server- This version of the SDK is built for the following targets: * .Net Standard 2.0 -* .Net 7 Android, for use with Android 5.0 (Android API 21) and higher. -* .Net 7 iOS, for use with iOS 11 and higher. -* .Net 7 macOS (using Mac Catalyst), for use with macOS 10.15 and higher. -* .Net 7 Windows (using WinUI), for Windows 11 and Windows 10 version 1809 or higher. -* .NET 7 +* .Net 8 Android, for use with Android 5.0 (Android API 21) and higher. +* .Net 8 iOS, for use with iOS 11 and higher. +* .Net 8 macOS (using Mac Catalyst), for use with macOS 10.15 and higher. +* .Net 8 Windows (using WinUI), for Windows 11 and Windows 10 version 1809 or higher. +* .NET 8 -The .Net Standard and .Net 7.0 targets have no OS-specific code. This allows the SDK to be used in a desktop .NET Framework or .NET 7.0 application. However, due to the lack of OS-specific integration, SDK functionality will be limited in those environments: for instance, the SDK will not be able to detect whether networking is turned on or off. +The .Net Standard and .Net 8.0 targets have no OS-specific code. This allows the SDK to be used in a desktop .NET Framework or .NET 8.0 application. However, due to the lack of OS-specific integration, SDK functionality will be limited in those environments: for instance, the SDK will not be able to detect whether networking is turned on or off. The .NET build tools should automatically load the most appropriate build of the SDK for whatever platform your application or library is targeted to. diff --git a/pkgs/sdk/client/contract-tests/README.md b/pkgs/sdk/client/contract-tests/README.md index 03caa44c..b75f5fbb 100644 --- a/pkgs/sdk/client/contract-tests/README.md +++ b/pkgs/sdk/client/contract-tests/README.md @@ -6,4 +6,4 @@ To run these tests locally, run `make contract-tests` from the SDK project root Or, to test against an in-progress local version of the test harness, run `make start-contract-test-service` from the SDK project root directory; then, in the root directory of the `sdk-test-harness` project, build the test harness and run it from the command line. -Currently, the project does _not_ automatically detect the available target frameworks. It will default to building and running for .NET Core 2.1. To use a different target framework, set the environment variable `TESTFRAMEWORK` to the name of the application runtime framework (such as `netcoreapp3.1`), and set the environment variable `BUILDFRAMEWORKS` (note the S at the end) to the target framework that the SDK should be built for (which may or may not be the same). +Currently, the project does _not_ automatically detect the available target frameworks. It will default to building and running for .NET 8.0. To use a different target framework, set the environment variable `TESTFRAMEWORK` to the name of the application runtime framework (such as `net8.0`), and set the environment variable `BUILDFRAMEWORKS` (note the S at the end) to the target framework that the SDK should be built for (which may or may not be the same). diff --git a/pkgs/sdk/client/contract-tests/TestService.csproj b/pkgs/sdk/client/contract-tests/TestService.csproj index 81fd297d..912937a9 100644 --- a/pkgs/sdk/client/contract-tests/TestService.csproj +++ b/pkgs/sdk/client/contract-tests/TestService.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 $(TESTFRAMEWORK) portable ContractTestService diff --git a/pkgs/sdk/client/github_actions.env b/pkgs/sdk/client/github_actions.env index 08d358ad..2aa97f98 100644 --- a/pkgs/sdk/client/github_actions.env +++ b/pkgs/sdk/client/github_actions.env @@ -4,4 +4,4 @@ BUILD_OUTPUT_PATH=pkgs/sdk/client/src/bin/Release/ BUILD_OUTPUT_DLL_NAME=LaunchDarkly.ClientSdk.dll TEST_PROJECT_FILE=pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj CONTRACT_TEST_PROJECT_FILE=pkgs/sdk/client/contract-tests/TestService.csproj -CONTRACT_TEST_DLL_FILE=pkgs/sdk/client/contract-tests/bin/debug/net7.0/ContractTestService.dll +CONTRACT_TEST_DLL_FILE=pkgs/sdk/client/contract-tests/bin/debug/net8.0/ContractTestService.dll diff --git a/pkgs/sdk/client/scripts/start-contract-test-service.sh b/pkgs/sdk/client/scripts/start-contract-test-service.sh index 392d2a1c..3d99e4cd 100755 --- a/pkgs/sdk/client/scripts/start-contract-test-service.sh +++ b/pkgs/sdk/client/scripts/start-contract-test-service.sh @@ -1,2 +1,2 @@ #!/bin/bash -cd contract-tests && dotnet bin/Debug/${TESTFRAMEWORK:-net7.0}/ContractTestService.dll +cd contract-tests && dotnet bin/Debug/${TESTFRAMEWORK:-net8.0}/ContractTestService.dll diff --git a/pkgs/sdk/client/src/Internal/SdkPackage.cs b/pkgs/sdk/client/src/Internal/SdkPackage.cs index f0adcd98..bbc61b93 100644 --- a/pkgs/sdk/client/src/Internal/SdkPackage.cs +++ b/pkgs/sdk/client/src/Internal/SdkPackage.cs @@ -39,17 +39,17 @@ internal static class SdkPackage /// internal static string DotNetTargetFramework => // We'll need to update this whenever we add or remove supported target frameworks in the .csproj file. - // Order of these conditonals matters. Specific frameworks come before net7.0 intentionally. + // Order of these conditonals matters. Specific frameworks come before net8.0 intentionally. #if ANDROID - "net7.0-android"; + "net8.0-android"; #elif IOS - "net7.0-ios"; + "net8.0-ios"; #elif MACCATALYST - "net7.0-maccatalyst"; + "net8.0-maccatalyst"; #elif WINDOWS - "net7.0-windows"; -#elif NET7_0 - "net7.0"; + "net8.0-windows"; +#elif NET8_0 + "net8.0"; #else "unknown"; #endif diff --git a/pkgs/sdk/client/src/LaunchDarkly.ClientSdk.csproj b/pkgs/sdk/client/src/LaunchDarkly.ClientSdk.csproj index fabf0e8b..7ce3eea1 100644 --- a/pkgs/sdk/client/src/LaunchDarkly.ClientSdk.csproj +++ b/pkgs/sdk/client/src/LaunchDarkly.ClientSdk.csproj @@ -10,9 +10,8 @@ that doesn't have the MAUI tools installed. That is currently the case in the release phase where we build HTML documentation. --> - netstandard2.0;net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst;net7.0-windows + netstandard2.0;net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-windows $(BUILDFRAMEWORKS) - true Library LaunchDarkly.ClientSdk LaunchDarkly.ClientSdk @@ -47,17 +46,18 @@ + - - + + - + @@ -65,7 +65,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -88,7 +88,7 @@ - + diff --git a/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Device.Tests/LaunchDarkly.ClientSdk.Device.Tests.csproj b/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Device.Tests/LaunchDarkly.ClientSdk.Device.Tests.csproj index 2928110f..402dfde0 100644 --- a/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Device.Tests/LaunchDarkly.ClientSdk.Device.Tests.csproj +++ b/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Device.Tests/LaunchDarkly.ClientSdk.Device.Tests.csproj @@ -1,10 +1,10 @@  - net7.0-android; net7.0-ios - $(TargetFrameworks);net7.0-windows10.0.19041.0 + 8.0-android; net8.0-ios + $(TargetFrameworks);net8.0-windows10.0.19041.0 - + Exe true true @@ -32,7 +32,7 @@ - + false diff --git a/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj b/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj index ca3de204..c530e450 100644 --- a/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj +++ b/pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj @@ -4,7 +4,7 @@ single framework that we are testing; this allows us to test with older SDK versions that would error out if they saw any newer target frameworks listed here, even if we weren't running those. --> - net7.0 + net8.0 $(TESTFRAMEWORK) LaunchDarkly.ClientSdk.Tests LaunchDarkly.Sdk.Client From a8c31b5869882ef55df6b4bb3b92c2176938c4ca Mon Sep 17 00:00:00 2001 From: jsonbailey Date: Fri, 16 May 2025 11:19:22 -0500 Subject: [PATCH 2/4] update example global --- global.example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.example.json b/global.example.json index 8a39bd94..3fea262b 100644 --- a/global.example.json +++ b/global.example.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.410", + "version": "8.0.0", "rollForward": "latestFeature" } } From 651dd6eab0e4af0b94b4fb0a28a5133fb459017c Mon Sep 17 00:00:00 2001 From: jsonbailey Date: Fri, 16 May 2025 11:34:25 -0500 Subject: [PATCH 3/4] remove redundant xcode check --- .github/workflows/sdk-client-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/sdk-client-ci.yml b/.github/workflows/sdk-client-ci.yml index 0a4ac2f4..60ca3dc9 100644 --- a/.github/workflows/sdk-client-ci.yml +++ b/.github/workflows/sdk-client-ci.yml @@ -20,9 +20,6 @@ jobs: id-token: write contents: read steps: - - name: Print Xcode Version - run: xcodebuild -version - - uses: actions/checkout@v4 - uses: ./.github/actions/xcode-select From 18ba8a0bd376b834550f5e1c0609154fc11c465b Mon Sep 17 00:00:00 2001 From: jsonbailey Date: Mon, 19 May 2025 08:05:23 -0500 Subject: [PATCH 4/4] Update target dependencies Based on the following doc: https://learn.microsoft.com/en-us/dotnet/maui/supported-platforms?view=net-maui-8.0 --- pkgs/sdk/client/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/sdk/client/README.md b/pkgs/sdk/client/README.md index 031d7f5b..e5e9e0df 100644 --- a/pkgs/sdk/client/README.md +++ b/pkgs/sdk/client/README.md @@ -17,7 +17,7 @@ This version of the SDK is built for the following targets: * .Net Standard 2.0 * .Net 8 Android, for use with Android 5.0 (Android API 21) and higher. * .Net 8 iOS, for use with iOS 11 and higher. -* .Net 8 macOS (using Mac Catalyst), for use with macOS 10.15 and higher. +* .Net 8 macOS (using Mac Catalyst), for use with macOS 11 and higher. * .Net 8 Windows (using WinUI), for Windows 11 and Windows 10 version 1809 or higher. * .NET 8 @@ -54,7 +54,7 @@ We encourage pull requests and other contributions from the community. Check out * Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. * Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). * Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. - * Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline. + * Grant access to certain features based on user attributes, like payment plan (eg: users on the 'gold' plan get access to more features than users in the 'silver' plan). Disable parts of your application to facilitate maintenance, without taking everything offline. * LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list. * Explore LaunchDarkly * [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information