From e469fc8e441aec238ff9604870dca4658344d9a9 Mon Sep 17 00:00:00 2001 From: Roman Gardukevich Date: Thu, 22 Aug 2024 02:27:19 -0700 Subject: [PATCH] Generate documentation for dependencies (#2262) --- .../Documentation.docc/API Catalogs/Common.md | 14 --- .../API Catalogs/CommonInternal.md | 42 -------- .../API Catalogs/CoreMaps.md | 7 +- .../API Catalogs/CoreMapsInternal.md | 7 ++ .../Documentation.docc/API Catalogs/Events.md | 2 +- .../API Catalogs/Location APIs.md | 29 ++--- .../API Catalogs/Performance.md | 9 +- .../API Catalogs/Settings and Constants.md | 17 ++- .../API Catalogs/TileStore APIs.md | 28 ++--- .../Documentation.docc/API Catalogs/Turf.md | 43 -------- .../API Catalogs/TurfAPI.md | 12 +++ .../Documentation.docc/Documentation.md | 5 +- .../Extensions/MapboxMap.md | 2 +- .../MapboxMaps/Documentation.docc/Overview.md | 11 ++ .../MapboxMaps/Foundation/MapRecorder.swift | 4 +- Sources/MapboxMaps/Foundation/MapboxMap.swift | 2 +- project.yml | 2 +- scripts/doc-generation/build-docc.sh | 3 +- scripts/doc-generation/xcode-rebuild-docc.sh | 101 ++++++++++++++++++ xcodegen/MapboxMaps.yml | 10 ++ 20 files changed, 195 insertions(+), 155 deletions(-) delete mode 100644 Sources/MapboxMaps/Documentation.docc/API Catalogs/Common.md delete mode 100644 Sources/MapboxMaps/Documentation.docc/API Catalogs/CommonInternal.md delete mode 100644 Sources/MapboxMaps/Documentation.docc/API Catalogs/Turf.md create mode 100644 Sources/MapboxMaps/Documentation.docc/API Catalogs/TurfAPI.md create mode 100644 Sources/MapboxMaps/Documentation.docc/Overview.md create mode 100755 scripts/doc-generation/xcode-rebuild-docc.sh diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Common.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Common.md deleted file mode 100644 index bd869c8cb03e..000000000000 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Common.md +++ /dev/null @@ -1,14 +0,0 @@ -# Common SDK - -Mapbox SDK to share objects and utilities across SDKs. - -## Topics - -### Symbols - -- ``DataRef`` -- ``Size`` -- ``Geometry-class`` -- ``Feature-class`` -- ``FeatureExtensionValue`` -- diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/CommonInternal.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/CommonInternal.md deleted file mode 100644 index 5d2b14a17f9f..000000000000 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/CommonInternal.md +++ /dev/null @@ -1,42 +0,0 @@ -# Common SDK - Internal - -Mapbox SDK to share objects and utilities across SDKs. These are for internal use only. - -## Topics - -### Symbols - -- ``NSExceptionHandler`` -- ``OfflineSwitch-7t81h`` -- ``StylePackError-class`` -- ``ValueConverter`` -- ``TileRegionError-class`` -- ``SdkInformationQuery`` - - -- ``MBXAccuracyAuthorizationToString(_:)`` -- ``MBXHttpMethodToString(_:)`` -- ``MBXHttpRequestErrorTypeToString(_:)`` -- ``MBXLocationErrorCodeToString(_:)`` -- ``MBXLoggingLevelToString(_:)`` -- ``MBXPermissionStatusToString(_:)`` -- ``MBXTileDataDomainToString(_:)`` -- ``MBXTileRegionErrorTypeToString(_:)`` -- ``MBXCacheClearingErrorTypeToString(_:)`` - - -- ``GeometryType_Empty`` -- ``GeometryType_GeometryCollection`` -- ``GeometryType_Line`` -- ``GeometryType_MultiLine`` -- ``GeometryType_MultiPoint`` -- ``GeometryType_MultiPolygon`` -- ``GeometryType_Point`` -- ``GeometryType_Polygon`` - - -- ``GetLocationCallback`` -- ``HttpResponseCallback`` - - -- ``TileRegionErrorType`` diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMaps.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMaps.md index f1cb701f4767..98631ad7a9ee 100644 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMaps.md +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMaps.md @@ -1,11 +1,12 @@ -# Core Maps +# Core Maps API Maps rendering SDK also known as GL-Native ## Topics ### Offline -- +- ### Free Camera -- +- + diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMapsInternal.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMapsInternal.md index bc2dfa56e23f..f858746f1501 100644 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMapsInternal.md +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/CoreMapsInternal.md @@ -5,6 +5,13 @@ Maps rendering SDK also known as GL-Native. These are for internal use only. ## Topics ### Symbols + +- ``MapRecorder-240jd`` +- ``FeatureExtensionValue`` +- ``Size`` +- ``StylePackError-class`` +- ``RequestErrorType`` + - ``MBMMapLoadingErrorTypeToString(_:)`` - ``MBMRenderModeTypeToString(_:)`` diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Events.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Events.md index 6a5921f49ca1..240b6b4f7209 100644 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Events.md +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Events.md @@ -39,7 +39,7 @@ The simplified diagram of the events emitted by the map is displayed below. - ``Signal`` - ``AnyCancelable`` -- ``Cancelable`` +- ``MapboxCommon/Cancelable`` - ``EventTimeInterval`` ### Extras diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Location APIs.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Location APIs.md index ad66b5eb5f9b..bccfa3b487a7 100644 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Location APIs.md +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Location APIs.md @@ -11,24 +11,25 @@ - ``Puck3DConfiguration`` - ``Model`` - ``PuckBearing`` -- ``Location`` -- ``LocationProvider`` +- ``MapboxCommon/Location`` +- ``MapboxCommon/LocationProvider`` - ``AppleLocationProviderDelegate`` - ``AppleLocationProvider`` -- ``LocationError`` -- ``Coordinate2D`` -- ``LocationExtraKeys`` -- ``LocationProviderRequest`` +- ``MapboxCommon/LocationError`` +- ``MapboxCommon/Coordinate2D`` +- ``MapboxCommon/LocationExtraKeys`` +- ``MapboxCommon/LocationProviderRequest`` -- ``LocationServiceFactory`` -- ``DeviceLocationProvider`` +- ``MapboxCommon/LocationServiceFactory`` +- ``MapboxCommon/DeviceLocationProvider`` - ``HeadingObserver`` - ``HeadingProvider`` -- ``LocationObserver`` -- ``LocationServiceObserver`` +- ``MapboxCommon/LocationObserver`` +- ``MapboxCommon/LocationServiceObserver`` - ``Heading`` - ``PuckRenderingData`` -- ``AccuracyAuthorization`` -- ``AccuracyLevel`` -- ``LocationErrorCode`` -- ``PermissionStatus`` +- ``MapboxCommon/AccuracyAuthorization`` +- ``MapboxCommon/AccuracyLevel`` +- ``MapboxCommon/LocationErrorCode`` +- ``MapboxCommon/PermissionStatus`` +- ``MapboxCommon/IntervalSettings`` diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Performance.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Performance.md index 0b347d18dba8..e320e3f0d4aa 100644 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Performance.md +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Performance.md @@ -8,7 +8,6 @@ ### Map Recording -- ``MapRecorder`` - ``MapRecorderOptions-struct`` - ``MapPlayerOptions-struct`` @@ -24,9 +23,9 @@ ### Logs -- ``LogConfiguration`` -- ``LogWriterBackend`` -- ``LoggingLevel`` +- ``MapboxCommon/LogConfiguration`` +- ``MapboxCommon/LogWriterBackend`` +- ``MapboxCommon/LoggingLevel`` ### Debug @@ -35,4 +34,4 @@ ### Crashes -- ``NSExceptionHandler`` +- ``MapboxCommon/NSExceptionHandler`` diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Settings and Constants.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Settings and Constants.md index cd361f0d8d76..418b3471fa83 100644 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Settings and Constants.md +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Settings and Constants.md @@ -5,20 +5,17 @@ ### Settings -- ``MapboxCommonSettings`` -- ``MapboxOptions`` +- ``MapboxCommon/MapboxCommonSettings`` +- ``MapboxCommon/MapboxOptions`` - ``MapboxMapsOptions`` ### Common Settings -- ``SettingsService`` -- ``SettingsServiceFactory`` -- ``SettingsServiceError`` -- ``SettingsServiceStorageType`` - - -- ``IntervalSettings`` -- ``SdkInformation`` +- ``MapboxCommon/SettingsService`` +- ``MapboxCommon/SettingsServiceFactory`` +- ``MapboxCommon/SettingsServiceError`` +- ``MapboxCommon/SettingsServiceStorageType`` +- ``MapboxCommon/SdkInformation`` ### Constants diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/TileStore APIs.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/TileStore APIs.md index 02390d0bf6ad..7d1282c15787 100644 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/TileStore APIs.md +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/TileStore APIs.md @@ -7,34 +7,34 @@ ### TileStore -- ``TileStore`` -- ``TileStoreOptions`` +- ``MapboxCommon/TileStore`` +- ``MapboxCommon/TileStoreOptions`` - ``TileCacheBudget`` - ``TileCacheBudgetInMegabytes`` - ``TileCacheBudgetInTiles`` - ``TileCoverOptions-struct`` - ``TileOptions`` -- ``TileRegion`` +- ``MapboxCommon/TileRegion`` - ``TileRegionError-enum`` -- ``TileRegionLoadOptions`` -- ``TileRegionLoadProgress`` +- ``MapboxCommon/TileRegionLoadOptions`` +- ``MapboxCommon/TileRegionLoadProgress`` -- ``TilesetDescriptor`` +- ``MapboxCommon/TilesetDescriptor`` - ``TilesetDescriptorOptions`` - ``CanonicalTileID`` - ``TileStoreObserver`` -- ``TileRegionLoadProgressCallback`` +- ``MapboxCommon/TileRegionLoadProgressCallback`` - ``TileStoreUsageMode`` - ``TileRegionError-enum`` -- ``TileDataDomain`` +- ``MapboxCommon/TileDataDomain`` - ``TileCacheBudgetType`` -- ``TileRegionEstimateOptions`` -- ``TileRegionEstimateProgress`` -- ``TileRegionEstimateResult`` -- ``TileRegionEstimateProgressCallback`` -- ``CacheClearingError`` -- ``CacheClearingErrorType`` +- ``MapboxCommon/TileRegionEstimateOptions`` +- ``MapboxCommon/TileRegionEstimateProgress`` +- ``MapboxCommon/TileRegionEstimateResult`` +- ``MapboxCommon/TileRegionEstimateProgressCallback`` +- ``MapboxCommon/CacheClearingError`` +- ``MapboxCommon/CacheClearingErrorType`` ### Style pack diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Turf.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/Turf.md deleted file mode 100644 index e603723fa6dd..000000000000 --- a/Sources/MapboxMaps/Documentation.docc/API Catalogs/Turf.md +++ /dev/null @@ -1,43 +0,0 @@ -# Turf - -Describes `turf-swift` dependency objects - -## Topics - -### GeoJSON - -- ``Feature-swift.typealias`` -- ``Geometry-swift.typealias`` -- ``MultiPoint`` -- ``MultiLineString`` -- ``MultiPolygon`` -- ``Point`` -- ``Polygon`` -- ``Ring`` -- ``GeoJSONObjectConvertible`` -- ``WKTConvertible`` -- ``intersection(_:_:)`` -- ``mid(_:_:)`` -- ``JSONArray`` -- ``JSONObject`` -- ``LineSegment`` -- ``LocationCoordinate2D`` -- ``LocationDegrees`` -- ``LocationDirection`` -- ``LocationDistance`` -- ``LocationRadians`` -- ``RadianDistance`` -- ``ForeignMemberContainer`` -- ``GeometryConvertible`` -- ``BoundingBox`` -- ``LineString`` -- ``RadianCoordinate2D`` -- ``Feature-struct`` -- ``FeatureCollection`` -- ``GeometryCollection`` -- ``GeometryType`` -- ``GeoJSONObject`` -- ``FeatureIdentifier`` -- ``Consumer`` -- ``Geometry-enum`` -- ``JSONValue`` diff --git a/Sources/MapboxMaps/Documentation.docc/API Catalogs/TurfAPI.md b/Sources/MapboxMaps/Documentation.docc/API Catalogs/TurfAPI.md new file mode 100644 index 000000000000..5ace9ae69b28 --- /dev/null +++ b/Sources/MapboxMaps/Documentation.docc/API Catalogs/TurfAPI.md @@ -0,0 +1,12 @@ +# Turf + +Describes `turf-swift` dependency objects + +## Topics + +### GeoJSON + +- ``Feature-swift.typealias`` +- ``Geometry-swift.typealias`` +- ``MapboxCommon/GeometryType`` +- ``Turf`` diff --git a/Sources/MapboxMaps/Documentation.docc/Documentation.md b/Sources/MapboxMaps/Documentation.docc/Documentation.md index 63fa31ad14af..eb1ae43de295 100644 --- a/Sources/MapboxMaps/Documentation.docc/Documentation.md +++ b/Sources/MapboxMaps/Documentation.docc/Documentation.md @@ -46,11 +46,10 @@ The Mapbox Maps SDK for iOS is a public library for displaying interactive, thor - - + ### Dependencies - -- -- +- ### Internal - -- diff --git a/Sources/MapboxMaps/Documentation.docc/Extensions/MapboxMap.md b/Sources/MapboxMaps/Documentation.docc/Extensions/MapboxMap.md index a88f43369644..5165384797e4 100644 --- a/Sources/MapboxMaps/Documentation.docc/Extensions/MapboxMap.md +++ b/Sources/MapboxMaps/Documentation.docc/Extensions/MapboxMap.md @@ -1,4 +1,4 @@ -# ``MapboxMap`` +# ``/MapboxMaps/MapboxMap`` ## Topics diff --git a/Sources/MapboxMaps/Documentation.docc/Overview.md b/Sources/MapboxMaps/Documentation.docc/Overview.md new file mode 100644 index 000000000000..ad7f5f59bb82 --- /dev/null +++ b/Sources/MapboxMaps/Documentation.docc/Overview.md @@ -0,0 +1,11 @@ +# MapboxMaps Documentation + +@Metadata { + @TechnologyRoot +} + +## Topics + +- ``/MapboxMaps`` +- ``/MapboxCommon`` +- ``/Turf`` diff --git a/Sources/MapboxMaps/Foundation/MapRecorder.swift b/Sources/MapboxMaps/Foundation/MapRecorder.swift index a54ec38ae2db..a638ddb14ea4 100644 --- a/Sources/MapboxMaps/Foundation/MapRecorder.swift +++ b/Sources/MapboxMaps/Foundation/MapRecorder.swift @@ -27,8 +27,8 @@ import Foundation } /// Stops the current recording session. - /// Recorded section can be replayed with ``replay()`` function. - /// Returns the ``Data`` containing the recorded sequence in raw format. + /// Recorded section can be replayed with ``replay(recordedSequence:options:completion:)`` function. + /// Returns the `Data` containing the recorded sequence in raw format. public func stop() -> Data { recorder.stopRecording().data } diff --git a/Sources/MapboxMaps/Foundation/MapboxMap.swift b/Sources/MapboxMaps/Foundation/MapboxMap.swift index 02bd70bcd5a3..a79e58ef3a27 100644 --- a/Sources/MapboxMaps/Foundation/MapboxMap.swift +++ b/Sources/MapboxMaps/Foundation/MapboxMap.swift @@ -1453,7 +1453,7 @@ extension MapboxMap { extension MapboxMap { - /// Create a ``MapRecorder`` to record the current MapboxMap + /// Create a ``MapRecorder-4soa`` to record the current MapboxMap @_spi(Experimental) public final func makeRecorder() throws -> MapRecorder { try MapRecorder(mapView: __map) } diff --git a/project.yml b/project.yml index f24434ff9c7f..37b0f6006169 100644 --- a/project.yml +++ b/project.yml @@ -46,4 +46,4 @@ targets: settings: base: RUN_DOCUMENTATION_COMPILER: YES - OTHER_DOCC_FLAGS: "--warnings-as-errors" + OTHER_DOCC_FLAGS: "--help" # Disable embedded documentation compiler in favor of custom docc behavior. That should fix missing documentation symbols issue (MAPSIOS-1467). diff --git a/scripts/doc-generation/build-docc.sh b/scripts/doc-generation/build-docc.sh index 552877803d3b..e85d68e7853a 100755 --- a/scripts/doc-generation/build-docc.sh +++ b/scripts/doc-generation/build-docc.sh @@ -23,8 +23,9 @@ process_template() { build_doc() { pushd "$public_repo_root/" + xcodegen xcodebuild docbuild -config Release -scheme MapboxMaps -destination "generic/platform=iOS" \ - COMPILER_INDEX_STORE_ENABLE=NO OTHER_DOCC_FLAGS="--warnings-as-errors --experimental-enable-custom-templates --output-path $docc_archive --hosting-base-path $hosting_base_path" + COMPILER_INDEX_STORE_ENABLE=NO OTHER_DOCC_FLAGS_UNIFIED="--experimental-enable-custom-templates --output-path $docc_archive --hosting-base-path $hosting_base_path" popd } diff --git a/scripts/doc-generation/xcode-rebuild-docc.sh b/scripts/doc-generation/xcode-rebuild-docc.sh new file mode 100755 index 000000000000..dd46f4243d14 --- /dev/null +++ b/scripts/doc-generation/xcode-rebuild-docc.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash +set -eo pipefail + +main() { + MAPBOXMAPS_PATH=${MAPBOXMAPS_PATH:-"."} + DOCC_ARCHIVE_PATH=${DOCC_ARCHIVE_PATH:-"$TARGET_BUILD_DIR/MapboxMaps.doccarchive"} + OTHER_DOCC_FLAGS_UNIFIED=${OTHER_DOCC_FLAGS_UNIFIED:-""} + + generateDependenciesFile + # Generate documentation only for certain configuration: + # - docbuild: Build Documentation action + # - build with RUN_DOCUMENTATION_COMPILER=YES: Build action with option to build documentation during build + if [[ ! ( "$ACTION" == "docbuild" || ( "$RUN_DOCUMENTATION_COMPILER" == "YES" && "$ACTION" == "build" )) ]]; then + echo "Skipping docc generation" + exit 0 + fi + + if [[ ! "$OTHER_DOCC_FLAGS" == *"--help"* ]]; then + echo "Skipping docc generation cause OTHER_DOCC_FLAGS does not contain --help" + exit 0 + fi + + generateSymbolGraphs + +# shellcheck disable=SC2086 + docc convert "$SCRIPT_INPUT_FILE_0" \ + --emit-lmdb-index \ + --ide-console-output --emit-fixits \ + --fallback-display-name MapboxMaps \ + --fallback-bundle-identifier com.mapbox.MapboxMaps \ + --fallback-bundle-version 1 \ + --diagnostics-file "$SCRIPT_OUTPUT_FILE_0" \ + --output-dir "$DOCC_ARCHIVE_PATH" \ + --additional-symbol-graph-dir "$BUILT_PRODUCTS_DIR/symbol-graphs" $OTHER_DOCC_FLAGS_UNIFIED + cp "$SCRIPT_OUTPUT_FILE_0" "$TARGET_TEMP_DIR/MapboxMaps-diagnostics.json" +} + +generateSymbolGraphs() { + triplet="${NATIVE_ARCH}-${LLVM_TARGET_TRIPLE_VENDOR}-${LLVM_TARGET_TRIPLE_OS_VERSION}${LLVM_TARGET_TRIPLE_SUFFIX}" + SYMBOL_GRAPH_DIR="$BUILT_PRODUCTS_DIR/symbol-graphs" + + CLANG_OUTPUT_DIR="$SYMBOL_GRAPH_DIR/clang/${triplet}" + SWIFTEXTRACT_OUTPUT_DIR="$SYMBOL_GRAPH_DIR/swift/$triplet" + mkdir -p "$CLANG_OUTPUT_DIR" + mkdir -p "$SWIFTEXTRACT_OUTPUT_DIR" + + SYMBOLGRAPH_TOOL="time swift symbolgraph-extract -sdk $(xcrun --sdk "$SDK_NAME" --show-sdk-path) -target $triplet -skip-inherited-docs" + clangExtractApi() { + local moduleName="$1" + local productName=${2:-$moduleName} + + FRAMEWORK_PATH="$BUILT_PRODUCTS_DIR/$moduleName.framework" + + time xcrun --sdk "$SDK_NAME" clang -extract-api -x objective-c-header -o "$CLANG_OUTPUT_DIR/$moduleName.symbols.json" \ + -I"${FRAMEWORK_PATH}/Headers" \ + "${FRAMEWORK_PATH}/Headers/"* \ + -F "${BUILT_PRODUCTS_DIR}" \ + --product-name="$productName" + } + + # Export symbol graphs for MapboxCommon + echo "Exporting symbol graphs for MapboxCommon" + clangExtractApi "MapboxCommon" + + $SYMBOLGRAPH_TOOL -module-name "MapboxCommon" -output-dir "$SWIFTEXTRACT_OUTPUT_DIR" -F "$BUILT_PRODUCTS_DIR" + + # Exporting symbol graphs for MapboxCoreMaps + echo "Exporting symbol graphs for MapboxCoreMaps" + clangExtractApi "MapboxCoreMaps" "MapboxMaps" + + # Force the product name to be MapboxMaps to merge into MapboxMaps doc + sed -i '' 's/MapboxCoreMaps/MapboxMaps/g' "$CLANG_OUTPUT_DIR/MapboxCoreMaps.symbols.json" + + $SYMBOLGRAPH_TOOL -module-name "MapboxCoreMaps" -output-dir "$SWIFTEXTRACT_OUTPUT_DIR" -F "$BUILT_PRODUCTS_DIR" + + # Rename the swift symbol-graph module name to MapboxMaps to merge into MapboxMaps doc. + sed -i '' 's/MapboxCoreMaps/MapboxMaps/g' "$SWIFTEXTRACT_OUTPUT_DIR/MapboxCoreMaps.symbols.json" + + # Exporting symbol graphs for Turf + $SYMBOLGRAPH_TOOL -module-name "Turf" -output-dir "$SWIFTEXTRACT_OUTPUT_DIR" -F "$TARGET_BUILD_DIR" + + # Exporting symbol graphs for MapboxMaps + $SYMBOLGRAPH_TOOL -module-name "MapboxMaps" -output-dir "$SWIFTEXTRACT_OUTPUT_DIR" -F "$TARGET_BUILD_DIR" +} + +# Generate a dependency file to support incremental builds +# That means that we provide a list of files (in Makefile format) that are used to generate the output file. +# As long as none of the files in the list changes, the script would not be executed again. +generateDependenciesFile() { + DEPENDENCIES_FILE="$DERIVED_FILES_DIR/MapboxMapsCustomDocumentation.d" + + echo -n "$SCRIPT_OUTPUT_FILE_0 : " > "$DEPENDENCIES_FILE" + SOURCES=$(find "$SRCROOT/$MAPBOXMAPS_PATH/Sources/MapboxMaps" "$DERIVED_FILES_DIR" -name "*.swift" -print0 | xargs -0) + DOCS=$(find "$SCRIPT_INPUT_FILE_0" -type f -print0 | sed 's/ /\\ /g' | xargs -0) + + # Add path to the script to force documentation rebuild on script updates + SCRIPT_FULL_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/$(basename "${BASH_SOURCE[0]}")" + echo -n "$SOURCES $DOCS $SCRIPT_FULL_PATH" >> "$DEPENDENCIES_FILE" +} + +time main diff --git a/xcodegen/MapboxMaps.yml b/xcodegen/MapboxMaps.yml index 9724a0731bf6..bb3174c84e22 100644 --- a/xcodegen/MapboxMaps.yml +++ b/xcodegen/MapboxMaps.yml @@ -37,3 +37,13 @@ targets: - ../.build buildPhase: none group: General + postCompileScripts: + - name: Compile unified documentation + showEnvVars: true + basedOnDependencyAnalysis: true + discoveredDependencyFile: $(DERIVED_FILES_DIR)/MapboxMapsCustomDocumentation.d + script: $SRCROOT/$MAPBOXMAPS_PATH/scripts/doc-generation/xcode-rebuild-docc.sh + inputFiles: + - $(SRCROOT)/$(MAPBOXMAPS_PATH)/Sources/MapboxMaps/Documentation.docc + outputFiles: + - $(TARGET_TEMP_DIR)/MapboxMaps-fixed-diagnostics.json