{"id":19412154,"url":"https://github.com/polyfrost/buildformat","last_synced_at":"2026-04-16T01:32:29.709Z","repository":{"id":103990667,"uuid":"601410730","full_name":"Polyfrost/BuildFormat","owner":"Polyfrost","description":"Our Gradle build logic/documentation styling etc.","archived":false,"fork":false,"pushed_at":"2024-04-21T01:42:01.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-18T00:49:03.891Z","etag":null,"topics":["checkstyle","detekt","dokka","editorconfig","gradle","gradle-plugin","lint","linting","spotless","style"],"latest_commit_sha":null,"homepage":"https://contributing.polyfrost.org/stylistic","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Polyfrost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-14T02:09:44.000Z","updated_at":"2024-05-27T12:18:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7218ec5-34d5-4362-bd33-d01a3a2eeea6","html_url":"https://github.com/Polyfrost/BuildFormat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyfrost%2FBuildFormat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyfrost%2FBuildFormat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyfrost%2FBuildFormat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyfrost%2FBuildFormat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Polyfrost","download_url":"https://codeload.github.com/Polyfrost/BuildFormat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240593159,"owners_count":19825929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checkstyle","detekt","dokka","editorconfig","gradle","gradle-plugin","lint","linting","spotless","style"],"created_at":"2024-11-10T12:25:18.516Z","updated_at":"2026-04-16T01:32:24.653Z","avatar_url":"https://github.com/Polyfrost.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Polyfrost Build Logic Shared Code\n\nThis repository contains shared build logic for Polyfrost projects. It is intended to be used as a git submodule in other projects. It is only intended for use within the Polyfrost organization, so support for other projects is not guaranteed.\nIf you are having problems with this repository, please contact the Polyfrost team via [Discord](https://polyfrost.cc/discord).\n\nSome files may need to be symlinked or copied from this repository if they require being at the root of the file stucture to work.\n\n## Spotless + Checkstyle\n\nDo not use spotless if you are already using Kotlinter. Add the following to your `build.gradle.kts` file:\n\n```kotlin\nplugins {\n    alias(libs.plugins.spotless)\n    alias(libs.plugins.checkstyle)\n}\n\nallprojects {\n    apply(plugin = rootProject.libs.plugins.spotless.get().pluginId)\n    apply(plugin = rootProject.libs.plugins.checkstyle.get().pluginId)\n\n    repositories {\n        mavenCentral()\n        maven(\"https://repo.polyfrost.org/releases\")\n    }\n\n    checkstyle {\n        configFile = rootProject.file(\"format/checkstyle.xml\") // replace this with your buildformat submodule path\n        toolVersion = rootProject.libs.plugins.checkstyle.get().pluginVersion\n    }\n\n    spotless {\n        java {\n            licenseHeaderFile(rootProject.file(\"HEADER\")) // replace this with your header\n            removeUnusedImports()\n            importOrder('java', 'javax', '', 'net.minecraft', 'org.polyfrost')\n            indentWithTabs()\n            trimTrailingWhitespace()\n        }\n    }\n}\n\nspotless {\n    groovyGradle {\n        target 'src/**/*.gradle', '*.gradle', 'gradle/*.gradle'\n        greclipse()\n    }\n}\n```\n\nFeel free to add git hooks or manage the Spotless and Checkstyle hooks if wanted.\n\n## Kotlinter + Licenser\n\nDo not use Kotlinter if you are already using Spotless. Add the following to your `build.gradle.kts` file:\n\n```kotlin\nplugins {\n    alias(libs.plugins.kotlinter)\n    alias(libs.plugins.licenser)\n}\n\nallprojects {\n    apply(plugin = rootProject.libs.plugins.kotlinter.get().pluginId)\n    apply(plugin = rootProject.libs.plugins.licenser.get().pluginId)\n\n    repositories {\n        mavenCentral()\n        maven(\"https://repo.polyfrost.org/releases\")\n    }\n\n    kotlinter {\n        ignoreFailures = false\n        reporters = arrayOf(\"checkstyle\", \"plain\")\n    }\n\n    license {\n        rule(\"${rootProject.projectDir}/HEADER\") // replace this with your hearder\n        include(\"**/*.kt\")\n    }\n}\n```\n\n## Dokka\n\nAdd the following to your `build.gradle.kts` file to enable Dokka documentation generation:\n\n```kotlin\nimport org.jetbrains.dokka.base.DokkaBase\nimport org.jetbrains.dokka.base.DokkaBaseConfiguration\nimport org.jetbrains.dokka.gradle.AbstractDokkaTask\n\nplugins {\n    alias(libs.plugins.dokka)\n}\n\nbuildscript {\n    dependencies {\n        classpath(libs.dokka.base)\n    }\n}\n\nallprojects {\n    apply(plugin = rootProject.libs.plugins.dokka.get().pluginId)\n\n    repositories {\n        mavenCentral()\n        maven(\"https://repo.polyfrost.cc/releases\")\n    }\n\n    tasks {\n        withType\u003cAbstractDokkaTask\u003e {\n            pluginConfiguration\u003cDokkaBase, DokkaBaseConfiguration\u003e {\n                val rootPath = \"${rootProject.projectDir.absolutePath}/{BUILDFORMAT_DIR}/dokka\"\n                customStyleSheets = file(\"$rootPath/styles\").listFiles()!!.toList()\n                customAssets = file(\"$rootPath/assets\").listFiles()!!.toList()\n                templatesDir = file(\"$rootPath/templates\")\n\n                footerMessage = \"© ${Year.now().value} Polyfrost\"\n            }\n\n            doLast {\n                // Script overriding does not work, so we have to do it manually\n                val scriptsOut = outputDirectory.get().resolve(\"scripts\")\n                val scriptsIn = file(\"${rootProject.projectDir}/{BUILDFORMAT_DIR}/dokka/scripts\")\n                if (project != rootProject) return@doLast\n                scriptsIn.listFiles()!!.forEach {\n                    it.copyTo(scriptsOut.resolve(it.name), overwrite = true)\n                }\n            }\n        }\n\n        val dokkaJavadocJar by creating(Jar::class.java) {\n            group = \"documentation\"\n            archiveClassifier.set(\"javadoc\")\n            from(dokkaJavadoc)\n        }\n    }\n\n    // If you want to integrate with the `maven-publish` plugin, add this to your publishing config, but DO NOT replace\n    // your existing config -- this will make it so your actual jar isn't published to maven.\n    publishing {\n        publications {\n            create\u003cMavenPublication\u003e(\"Maven\") {\n                artifactId = project.name\n                version = projectVersion\n\n                artifact(tasks.getByName\u003cJar\u003e(\"dokkaJavadocJar\").archiveFile) {\n                    builtBy(tasks.getByName(\"dokkaJavadocJar\"))\n                    this.classifier = \"javadoc\"\n                }\n            }\n        }\n\n        repositories {\n            mavenLocal()\n            // replace this with your own maven repo/maven publishing config :D\n            if (System.getenv(\"MAVEN_URL\") != null) {\n                maven {\n                    setUrl(System.getenv(\"MAVEN_URL\"))\n                    credentials {\n                        username = System.getenv(\"MAVEN_USERNAME\")\n                        password = System.getenv(\"MAVEN_PASSWORD\")\n                    }\n                    name = \"Maven\"\n                }\n            } else if (System.getenv(\"SNAPSHOTS_URL\") != null) {\n                maven {\n                    setUrl(System.getenv(\"SNAPSHOTS_URL\"))\n                    credentials {\n                        username = System.getenv(\"SNAPSHOTS_USERNAME\")\n                        password = System.getenv(\"SNAPSHOTS_PASSWORD\")\n                    }\n                    name = \"Maven\"\n                }\n            }\n        }\n    }\n}\n\nsubprojects {\n    tasks {\n        named\u003cJar\u003e(\"dokkaJavadocJar\") {\n            archiveBaseName.set(\"${rootProject.name}-${project.name}\")\n        }\n    }\n}\n\ntasks {\n    create(\"dokkaHtmlJar\", Jar::class.java) {\n        group = \"documentation\"\n        archiveBaseName.set(rootProject.name)\n        archiveClassifier.set(\"dokka\")\n        from(dokkaHtmlMultiModule.get().outputDirectory)\n        duplicatesStrategy = DuplicatesStrategy.FAIL\n    }\n}\n\n// If you want to integrate with the `maven-publish` plugin\npublishing {\n    publications {\n        getByName\u003cMavenPublication\u003e(\"Maven\") {\n            val dokka = rootProject.tasks.getByName\u003cJar\u003e(\"dokkaHtmlJar\")\n            artifact(dokka.archiveFile) {\n                builtBy(dokka)\n                classifier = \"dokka\"\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyfrost%2Fbuildformat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolyfrost%2Fbuildformat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyfrost%2Fbuildformat/lists"}