-
Notifications
You must be signed in to change notification settings - Fork 0
Clean up #27
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
Merged
Merged
Clean up #27
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ddd93d6
Provide readme check.
Vladyslav-Kuksiuk 4ea56bf
Improve skills.
Vladyslav-Kuksiuk ace1103
Improve Detekt usage.
Vladyslav-Kuksiuk b61b904
Improve tests.
Vladyslav-Kuksiuk c6aa52d
Provide dokka inside javadocs.
Vladyslav-Kuksiuk ae00af2
Improve readability.
Vladyslav-Kuksiuk 9a38e88
Improve readability.
Vladyslav-Kuksiuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright 2026, TeamDev. All rights reserved. | ||
| * | ||
| * 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 | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Redistribution and use in source and/or binary forms, with or without | ||
| * modification, must retain the above copyright notice and the following | ||
| * disclaimer. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
|
|
||
| plugins { | ||
| id("org.jetbrains.dokka") | ||
| } | ||
|
|
||
| dokka { | ||
| dokkaPublications.html { | ||
| moduleName.set(project.name) | ||
| } | ||
| } | ||
130 changes: 130 additions & 0 deletions
130
buildSrc/src/main/kotlin/io/spine/embedcode/gradle/report/DependencyPomRenderer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| /* | ||
| * Copyright 2026, TeamDev. All rights reserved. | ||
| * | ||
| * 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 | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Redistribution and use in source and/or binary forms, with or without | ||
| * modification, must retain the above copyright notice and the following | ||
| * disclaimer. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| */ | ||
|
|
||
| package io.spine.embedcode.gradle.report | ||
|
|
||
| /** Coordinates that identify the project described by the aggregate POM. */ | ||
| internal data class PomCoordinates( | ||
| val group: String, | ||
| val artifact: String, | ||
| val version: String, | ||
| ) | ||
|
|
||
| /** A first-level external dependency and its representative Maven scope. */ | ||
| internal data class PomDependency( | ||
| val group: String, | ||
| val artifact: String, | ||
| val version: String, | ||
| val scope: MavenScope, | ||
| ) | ||
|
|
||
| /** Maven scope used to group dependencies in the generated report. */ | ||
| internal enum class MavenScope( | ||
| val xmlValue: String, | ||
| val outputOrder: Int, | ||
| val selectionOrder: Int, | ||
| ) { | ||
| COMPILE("compile", 0, 0), | ||
| RUNTIME("runtime", 1, 1), | ||
| TEST("test", 2, 3), | ||
| PROVIDED("provided", 3, 2), | ||
| } | ||
|
|
||
| internal fun mavenScope(configurationName: String): MavenScope = | ||
| when (configurationName) { | ||
| "implementation", | ||
| "api", | ||
| -> | ||
| MavenScope.COMPILE | ||
| "runtimeOnly", | ||
| "runtimeClasspath", | ||
| "default", | ||
| -> | ||
| MavenScope.RUNTIME | ||
| "compileOnly", | ||
| "compileOnlyApi", | ||
| "annotationProcessor", | ||
| -> | ||
| MavenScope.PROVIDED | ||
| else -> { | ||
| if ( | ||
| configurationName.startsWith("test", ignoreCase = true) || | ||
| configurationName.startsWith("functionalTest", ignoreCase = true) | ||
| ) { | ||
| MavenScope.TEST | ||
| } else { | ||
| MavenScope.PROVIDED | ||
| } | ||
| } | ||
| } | ||
|
|
||
| internal fun renderDependencyPom( | ||
| coordinates: PomCoordinates, | ||
| dependencies: List<PomDependency>, | ||
| ): String = | ||
| buildString { | ||
| appendLine("""<?xml version="1.0" encoding="UTF-8"?>""") | ||
| appendLine("""<project xmlns="http://maven.apache.org/POM/4.0.0"""") | ||
| appendLine(""" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"""") | ||
| appendLine( | ||
| """ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 """ + | ||
| """https://maven.apache.org/xsd/maven-4.0.0.xsd">""", | ||
| ) | ||
| appendLine(" <modelVersion>4.0.0</modelVersion>") | ||
| appendLine(" <!--") | ||
| appendLine(" This file is generated by the `generateDependencyReports` Gradle task.") | ||
| appendLine(" It documents first-level dependencies from all plugin-module") | ||
| appendLine(" configurations and is not suitable for Maven build tasks.") | ||
| appendLine(" -->") | ||
| appendLine(" <groupId>${coordinates.group.escapeXml()}</groupId>") | ||
| appendLine(" <artifactId>${coordinates.artifact.escapeXml()}</artifactId>") | ||
| appendLine(" <version>${coordinates.version.escapeXml()}</version>") | ||
| appendLine(" <licenses>") | ||
| appendLine(" <license>") | ||
| appendLine(" <name>The Apache License, Version 2.0</name>") | ||
| appendLine(" <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>") | ||
| appendLine(" <distribution>repo</distribution>") | ||
| appendLine(" </license>") | ||
| appendLine(" </licenses>") | ||
| appendLine(" <dependencies>") | ||
| dependencies.forEach { dependency -> | ||
| appendLine(" <dependency>") | ||
| appendLine(" <groupId>${dependency.group.escapeXml()}</groupId>") | ||
| appendLine(" <artifactId>${dependency.artifact.escapeXml()}</artifactId>") | ||
| appendLine(" <version>${dependency.version.escapeXml()}</version>") | ||
| appendLine(" <scope>${dependency.scope.xmlValue}</scope>") | ||
| appendLine(" </dependency>") | ||
| } | ||
| appendLine(" </dependencies>") | ||
| appendLine("</project>") | ||
| } | ||
|
|
||
| private fun String.escapeXml(): String = | ||
| replace("&", "&") | ||
| .replace("<", "<") | ||
| .replace(">", ">") | ||
| .replace("\"", """) | ||
| .replace("'", "'") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit — a shared convention hardcodes one module's name.
dokka-configurationlives inbuildSrcalongsidejvm-module, so it reads as reusable, butmoduleNameis pinned toembed-code-gradle-plugin. A second module applying it would publish its API documentation under the wrong name, silently.Either derive it (
base.archivesName, whichgradle-plugin/build.gradle.kts:121already sets to the same value), or leave the convention to apply and configure the plugin and move themoduleNameoverride intogradle-plugin/build.gradle.ktswhere the name belongs. Not blocking while there is exactly one consumer.