fix: move X-Glean header config to preserved hooks package #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the daily CI Generate workflow failures that started after #66 was merged.
Problem
PR #66 added custom fields (
excludeDeprecatedAfter,includeExperimental) toSDKConfiguration.javaandGlean.java. However, these files are auto-generated by Speakeasy and marked "DO NOT EDIT". When the SDK regenerates, these custom fields are removed, butXGleanHeadersHook.java(in the preservedhooks/package) still references them:Solution
Move the custom configuration to a dedicated class in the preserved
hooks/package:GleanCustomConfig.java- Thread-safe singleton storing custom config valuesGleanBuilder.java- Builder wrapper that delegates toGlean.Builderbut addsexcludeDeprecatedAfter()andincludeExperimental()methods that write to the singletonXGleanHeadersHook.java- Updated to read fromGleanCustomConfiginstead ofSDKConfigurationUsers now use
GleanBuilder.create()instead ofGlean.builder()when they need the custom options:Environment variables continue to work unchanged.
Test plan
./gradlew buildpasses./gradlew test --tests "XGleanHeadersHookTest"passesspeakeasy runregeneration