Skip to content

Commit

Permalink
test: support multimodule projects
Browse files Browse the repository at this point in the history
  • Loading branch information
berezinant committed Jan 17, 2024
1 parent e6235f5 commit ee8c593
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions testDokka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ DOKKA_REPO_PATH="./"
# Port to view results
PORT=8001

#
IS_MULTIMODULE=0

# 0. Parse command line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
Expand All @@ -27,6 +30,10 @@ while [[ $# -gt 0 ]]; do
TEST_PROJECT_PATH="$2"
shift 2
;;
-m|--multimodule)
IS_MULTIMODULE=1
shift
;;
-p|--port)
PORT="$2"
shift 2
Expand All @@ -40,19 +47,36 @@ done

echo "Test locally Dokka version $NEW_VERSION"
echo "Test project path: $TEST_PROJECT_PATH"
echo "Is multimodule: $IS_MULTIMODULE"
echo "Dokka path: $DOKKA_REPO_PATH"
echo "Port: $PORT"

# 1. Publish to local Maven repository
cd "$DOKKA_REPO_PATH"
echo "Publish to local Maven repository"
./gradlew publishToMavenLocal -Pversion="$NEW_VERSION"

# 2. Update Dokka version in test project
cd "$TEST_PROJECT_PATH"
sed -i "" "s/\(id(\"org\.jetbrains\.dokka\") version\) \".*\"/\1 \"$NEW_VERSION\"/" build.gradle.kts
if [ -f "build.gradle.kts" ]; then
echo "Update version in build.gradle.kts"
sed -i "" "s/\(id(\"org\.jetbrains\.dokka\") version\) \".*\"/\1 \"$NEW_VERSION\"/" build.gradle.kts
fi

if [ -f "gradle.properties" ]; then
echo "Update version in gradle.properties"
sed -i "" "s/dokka_version=.*/dokka_version=$NEW_VERSION/" gradle.properties
fi


# 3. Build and generate documentation
./gradlew clean && ./gradlew dokkaHTML
if [ "$IS_MULTIMODULE" -eq 1 ]; then
echo "Build multimodule project"
./gradlew clean && ./gradlew dokkaHtmlMultiModule
else
echo "Build single module project"
./gradlew clean && ./gradlew dokkaHTML
fi

wait

Expand All @@ -72,11 +96,15 @@ fi
echo "Open http://localhost:$PORT in browser"

# 5.2 Start Python server to view results
cd "./build/dokka/html"
if [ "$IS_MULTIMODULE" -eq 1 ]; then
cd "./build/dokka/htmlMultiModule"
else
cd "./build/dokka/html"
fi

echo 'Start Python server in directory'
echo "$TEST_PROJECT_PATH/build/dokka/html"

python3 -m http.server $PORT
python3 -m http.server "$PORT"

echo "Done"

0 comments on commit ee8c593

Please sign in to comment.