-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into KT-64377/maven-dev-publish
# Conflicts: # dokka-integration-tests/gradle/projects/it-android-0/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-basic-groovy/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-basic/build.gradle.kts # dokka-integration-tests/gradle/projects/it-basic/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-collector-0/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-configuration/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-js-ir-0/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-multimodule-0/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-multimodule-1/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-multimodule-inter-module-links/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-multimodule-versioning-0/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-multiplatform-0/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-sequential-tasks-execution-stress/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-wasm-basic/settings.gradle.kts # dokka-integration-tests/gradle/projects/it-wasm-js-wasi-basic/settings.gradle.kts # dokka-integration-tests/gradle/projects/template.settings.gradle.kts # dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt # dokka-integration-tests/gradle/src/testExternalProjectKotlinxSerialization/kotlin/SerializationGradleIntegrationTest.kt # dokka-integration-tests/gradle/src/testTemplateProjectBasic/kotlin/AbstractGradleCachingIntegrationTest.kt # dokka-integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt # dokka-integration-tests/utilities/src/main/kotlin/org/jetbrains/dokka/it/systemProperties.kt
- Loading branch information
Showing
26 changed files
with
198 additions
and
103 deletions.
There are no files selected for viewing
This file contains 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
107 changes: 107 additions & 0 deletions
107
build-logic/src/main/kotlin/dokkabuild/tasks/MvnExec.kt
This file contains 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,107 @@ | ||
/* | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
package dokkabuild.tasks | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.ConfigurableFileCollection | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.file.FileSystemOperations | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.ListProperty | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.* | ||
import org.gradle.api.tasks.Optional | ||
import org.gradle.api.tasks.PathSensitivity.NONE | ||
import org.gradle.api.tasks.PathSensitivity.RELATIVE | ||
import org.gradle.process.ExecOperations | ||
import org.gradle.work.NormalizeLineEndings | ||
import java.util.* | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Runs a Maven task. | ||
* | ||
* See `dokkabuild.setup-maven-cli.gradle.kts` for details on the Maven CLI installation. | ||
*/ | ||
@CacheableTask | ||
abstract class MvnExec | ||
@Inject | ||
constructor( | ||
private val exec: ExecOperations, | ||
private val fs: FileSystemOperations, | ||
) : DefaultTask() { | ||
|
||
/** | ||
* Work directory. | ||
* | ||
* Be aware that any existing content will be replaced by [inputFiles]. | ||
*/ | ||
@get:OutputDirectory | ||
abstract val workDirectory: DirectoryProperty | ||
|
||
/** Input files - will be synced to [workDirectory]. */ | ||
@get:InputFiles | ||
@get:PathSensitive(RELATIVE) | ||
@get:NormalizeLineEndings | ||
abstract val inputFiles: ConfigurableFileCollection | ||
|
||
@get:InputFile | ||
@get:PathSensitive(NONE) | ||
abstract val mvnCli: RegularFileProperty | ||
|
||
@get:Input | ||
abstract val arguments: ListProperty<String> | ||
|
||
/** `-e` - Produce execution error messages. */ | ||
@get:Input | ||
@get:Optional | ||
abstract val showErrors: Property<Boolean> | ||
|
||
/** `-B` - Run in non-interactive (batch) mode. */ | ||
@get:Input | ||
@get:Optional | ||
abstract val batchMode: Property<Boolean> | ||
|
||
@TaskAction | ||
fun exec() { | ||
fs.sync { | ||
from(inputFiles) | ||
into(workDirectory) | ||
} | ||
|
||
val arguments = buildList { | ||
addAll(arguments.get()) | ||
if (showErrors.orNull == true) add("--errors") | ||
if (batchMode.orNull == true) add("--batch-mode") | ||
} | ||
|
||
exec.exec { | ||
workingDir(workDirectory) | ||
executable(mvnCli.get()) | ||
args(arguments) | ||
} | ||
|
||
makePropertiesFilesReproducible() | ||
} | ||
|
||
/** | ||
* Remove non-reproducible timestamps from any generated [Properties] files. | ||
*/ | ||
private fun makePropertiesFilesReproducible() { | ||
workDirectory.get().asFile.walk() | ||
.filter { it.isFile && it.extension == "properties" } | ||
.forEach { file -> | ||
logger.info("[MvnExec $path] removing timestamp from $file") | ||
// drop the last comment - java.util.Properties always adds a timestamp, which is not-reproducible. | ||
val comments = file.readLines() | ||
.takeWhile { it.startsWith('#') } | ||
.dropLast(1) | ||
|
||
val properties = file.readLines().dropWhile { it.startsWith('#') } | ||
|
||
val updatedProperties = (comments + properties).joinToString("\n") | ||
file.writeText(updatedProperties) | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
29 changes: 0 additions & 29 deletions
29
dokka-integration-tests/gradle/projects/template.root.gradle.kts
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.