@@ -321,37 +321,60 @@ sr-snapshot-tests-open:
321321 @$(ECHO_TITLE ) " make sr-snapshot-tests-open"
322322 ./tools/sr-snapshot-test.sh --open-project
323323
324- # Generate api-surface files for Datadog.
324+ # ## API-SURFACE
325+
326+ # Define default paths for API output files
327+ SWIFT_OUTPUT_PATH ?= api-surface-swift
328+ OBJC_OUTPUT_PATH ?= api-surface-objc
329+
330+ # Use different paths when running in CI
331+ ifeq ($(ENV ) ,ci)
332+ SWIFT_OUTPUT_PATH := api-surface-swift-generated
333+ OBJC_OUTPUT_PATH := api-surface-objc-generated
334+ endif
335+
336+ # Define the list of Datadog modules for API surface generation
337+ DATADOG_MODULES := DatadogCore DatadogLogs DatadogTrace DatadogRUM DatadogCrashReporting DatadogWebViewTracking DatadogSessionReplay
338+
339+ # Generate api-surface files for Datadog APIs
325340api-surface :
326- @echo " Generating api-surface-swift"
327- @cd tools/api-surface && \
328- swift run api-surface spm \
329- --path ../../ \
330- --language swift \
331- --library-name DatadogCore \
332- --library-name DatadogLogs \
333- --library-name DatadogTrace \
334- --library-name DatadogRUM \
335- --library-name DatadogCrashReporting \
336- --library-name DatadogWebViewTracking \
337- --library-name DatadogSessionReplay \
338- > ../../api-surface-swift && \
339- cd -
340-
341- @echo "Generating api-surface-objc"
342- @cd tools/api-surface && \
343- swift run api-surface spm \
344- --path ../../ \
345- --language objc \
346- --library-name DatadogCore \
347- --library-name DatadogLogs \
348- --library-name DatadogTrace \
349- --library-name DatadogRUM \
350- --library-name DatadogCrashReporting \
351- --library-name DatadogWebViewTracking \
352- --library-name DatadogSessionReplay \
353- > ../../api-surface-objc && \
354- cd -
341+ @$(ECHO_TITLE ) " make api-surface"
342+ @echo " Generating api-surface-swift"
343+ @cd tools/api-surface && \
344+ swift run api-surface generate \
345+ --path ../../ \
346+ --language swift \
347+ $(foreach module,$(DATADOG_MODULES ) ,--library-name $(module ) ) \
348+ --output-file ../../$(SWIFT_OUTPUT_PATH )
349+
350+ @echo "Generating api-surface-objc"
351+ @cd tools/api-surface && \
352+ swift run api-surface generate \
353+ --path ../../ \
354+ --language objc \
355+ $(foreach module,$(DATADOG_MODULES),--library-name $(module)) \
356+ --output-file ../../$(OBJC_OUTPUT_PATH)
357+
358+ # Verify API surface files for Datadog APIs
359+ api-surface-verify :
360+ @$(ECHO_TITLE ) " make api-surface-verify"
361+ @echo " Verifying api-surface-swift"
362+ @cd tools/api-surface && \
363+ swift run api-surface verify \
364+ --path ../../ \
365+ --language swift \
366+ $(foreach module,$(DATADOG_MODULES ) ,--library-name $(module ) ) \
367+ --output-file /tmp/api-surface-swift-generated \
368+ ../../api-surface-swift
369+
370+ @echo "Verifying api-surface-objc"
371+ @cd tools/api-surface && \
372+ swift run api-surface verify \
373+ --path ../../ \
374+ --language objc \
375+ $(foreach module,$(DATADOG_MODULES),--library-name $(module)) \
376+ --output-file /tmp/api-surface-objc-generated \
377+ ../../api-surface-objc
355378
356379# Builds API documentation using the same process as Swift Package Index.
357380spi-docs-build :
0 commit comments