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

Is it possible to run jazzy as a phase of XCode Build Phases? #1387

Closed
satroschenko opened this issue May 9, 2024 · 3 comments
Closed

Is it possible to run jazzy as a phase of XCode Build Phases? #1387

satroschenko opened this issue May 9, 2024 · 3 comments
Labels

Comments

@satroschenko
Copy link

If I add a new Run script phase in XCode to run jazzy I get an error:

error: unable to attach DB: error: accessing build database ".../Build/Intermediates.noindex/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.

Is it possible to run jazzy in this way?

@johnfairh
Copy link
Collaborator

Well, jazzy does run xcodebuild under the covers to figure out what to document so I guess I can understand where the Xcode error message here is coming from.

You could maybe explore having jazzy use a different DerivedData directory than your main build with --build-tool-arguments and -derivedDataPath but it's kind of a shame to build it again; or try using jazzy in symbol graph mode against your swiftmodule?

@satroschenko
Copy link
Author

satroschenko commented May 10, 2024

Thanks a lot. Yes, the first variant with different DerivedData works with some improvements.
Initially I added new Build Phase. It runs jazzy. Jazzy run new build. New build runs jazzy again and I had infinite recursion.

Had to add some checking for it.

As result I have following script:

#!/bin/bash

# Check is jazzy already running to remove recursion.
if [ -z $(printenv SKIP_JAZZY) ]; then
    echo "jazzy starts..."
else
    echo "Jazzy is already running. Skip this step."
    exit 0
fi

export SKIP_JAZZY=1

TEMP_DERIVED_DIR=$(mktemp -d)
# Clean temp dir when script exits.
trap "rm -rf $TEMP_DERIVED_DIR" EXIT

jazzy --xcodebuild-arguments -derivedDataPath,$TEMP_DERIVED_DIR

@johnfairh
Copy link
Collaborator

infinite recursion

Oh haha, should have seen that coming! Glad you got it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants