aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts')
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts104
1 files changed, 0 insertions, 104 deletions
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts
deleted file mode 100644
index f07ff98d..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-import org.gradle.kotlin.dsl.support.serviceOf
-
-/**
- * Utility for downloading and installing a Maven binary.
- *
- * Provides the `setupMavenProperties` extension that contains the default versions and locations
- * of the Maven binary.
- *
- * The task [installMavenBinary] will download and unzip the Maven bianry.
- */
-
-plugins {
- base
-}
-
-abstract class MavenCliSetupExtension {
- abstract val mavenVersion: Property<String>
- abstract val mavenPluginToolsVersion: Property<String>
-
- /** Directory that will contain the unpacked Apache Maven dependency */
- abstract val mavenInstallDir: DirectoryProperty
-
- /**
- * Path to the Maven executable.
- *
- * This should be different per OS:
- *
- * * Windows: `$mavenInstallDir/bin/mvn.cmd`
- * * Unix: `$mavenInstallDir/bin/mvn`
- */
- abstract val mvn: RegularFileProperty
-}
-
-val mavenCliSetupExtension =
- extensions.create("mavenCliSetup", MavenCliSetupExtension::class).apply {
- mavenVersion.convention(libs.versions.apacheMaven.core)
- mavenPluginToolsVersion.convention(libs.versions.apacheMaven.pluginTools)
-
- mavenInstallDir.convention(layout.buildDirectory.dir("apache-maven"))
-
- val isWindowsProvider =
- providers.systemProperty("os.name").map { "win" in it.toLowerCase() }
-
- mvn.convention(
- providers.zip(mavenInstallDir, isWindowsProvider) { mavenInstallDir, isWindows ->
- mavenInstallDir.file(
- when {
- isWindows -> "bin/mvn.cmd"
- else -> "bin/mvn"
- }
- )
- }
- )
- }
-
-val mavenBinary by configurations.registering {
- description = "used to download the Maven binary"
- isCanBeResolved = true
- isCanBeConsumed = false
- isVisible = false
-
- defaultDependencies {
- addLater(mavenCliSetupExtension.mavenVersion.map { mavenVersion ->
- project.dependencies.create(
- group = "org.apache.maven",
- name = "apache-maven",
- version = mavenVersion,
- classifier = "bin",
- ext = "zip"
- )
- })
- }
-}
-
-tasks.clean {
- delete(mavenCliSetupExtension.mavenInstallDir)
-}
-
-val installMavenBinary by tasks.registering(Sync::class) {
- val archives = serviceOf<ArchiveOperations>()
- from(
- mavenBinary.flatMap { conf ->
- @Suppress("UnstableApiUsage")
- val resolvedArtifacts = conf.incoming.artifacts.resolvedArtifacts
-
- resolvedArtifacts.map { artifacts ->
- artifacts.map { archives.zipTree(it.file) }
- }
- }
- ) {
- eachFile {
- // drop the first directory inside the zipped Maven bin (apache-maven-$version)
- relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
- }
- includeEmptyDirs = false
- }
- into(mavenCliSetupExtension.mavenInstallDir)
-}