Skip to content

Refactor build scripts#623

Open
AbdullinAM wants to merge 4 commits into
facebook:mainfrom
AbdullinAM:abdullin/rework-build
Open

Refactor build scripts#623
AbdullinAM wants to merge 4 commits into
facebook:mainfrom
AbdullinAM:abdullin/rework-build

Conversation

@AbdullinAM
Copy link
Copy Markdown

Several fixes related to the build configuration of the project:

  • Make it so the whole project can be build via ./gradlew build
  • Add GenerateKtfmtFilePlugin plugin that replaces gen_version_file.sh
  • Update to the latest Dokka, fix Dokka/KDoc related warnings

Each commit is relatively independent, but mostly changes the same files. So I didn't split this into separate PRs for now, but can do so if necessary.

Fixes #621

The core library uses the ktfmt Gradle plugin to check its own formatting, substituting the plugin's ktfmt dependency with the locally-built jar. This creates a circular dependency: building the jar requires the format check, but the check requires the jar. Override the plugin's task ordering so ktfmtChecks runs after jar, and clear the mustRunAfter on compileKotlin.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 3, 2026
@AbdullinAM AbdullinAM force-pushed the abdullin/rework-build branch 2 times, most recently from e69f674 to 90ce6e5 Compare June 4, 2026 14:37
Copy link
Copy Markdown
Contributor

@hick209 hick209 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly good, just one nit

Comment on lines +42 to +65
"""
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.ktfmt.util

object Ktfmt {
${properties.toList().joinToString("\n") { " const val ${it.first} = \"${it.second}\"" }}
}
"""
.trimIndent()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with the indent here? Is it not covered by ktfmt? If so, could you update it so that changes?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for some reason ktfmt accept this formatting. I'll update it manually

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I know why!
It uses interpolation, so we cannot adjust the indent without risking messing up with the result.
You could extract the interpolation to add it after the trimIndent() or something like that if you want ktfmt to take care of the formatting.

* Update to latest Dokka and switch to the new default V2 plugin
* Migrate to new Dokka-Javadoc plugin
* Fix unresolved links in the KDocs
@AbdullinAM AbdullinAM force-pushed the abdullin/rework-build branch from 90ce6e5 to 170ecc1 Compare June 4, 2026 15:20
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jun 5, 2026

@hick209 has imported this pull request. If you are a Meta employee, you can view this in D107664494.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor build scripts

2 participants