init research
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
## :build-settings-logic
|
||||
|
||||
This project contains all shared logic for build settings (`settings.gradle.kts` files).
|
||||
|
||||
The entire DataFrame project is built
|
||||
using [Composite Builds](https://docs.gradle.org/current/userguide/composite_builds.html)
|
||||
and [Pre-compiled Script Plugins](https://docs.gradle.org/current/userguide/implementing_gradle_plugins_precompiled.html)
|
||||
acting as [Convention Plugins](https://docs.gradle.org/current/userguide/implementing_gradle_plugins_convention.html).
|
||||
|
||||
### Plugins:
|
||||
|
||||
- `dfsettings.base`: common settings for all projects; includes setting repositories and Foojay.
|
||||
- `dfsettings.version-catalog`: makes projects that apply it use the top-level DataFrame version catalog.
|
||||
- `dfsettings.convention-catalog`: makes projects that apply it gain a `convention.plugins` catalog,
|
||||
allowing them to apply convention plugins safely.
|
||||
- `dfsettings.catalogs`: combinations of the two above.
|
||||
- `dfsettings.catalogs-inside-convention-plugins`: like `dfsettings.catalogs`, but it uses
|
||||
[`dev.panuszewski.typesafe-conventions`](https://github.com/radoslaw-panuszewski/typesafe-conventions-gradle-plugin)
|
||||
to make them work from inside build-logic convention plugins.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
description = "Conventions to use in settings.gradle.kts scripts"
|
||||
|
||||
dependencies {
|
||||
implementation(libs.gradlePlugin.gradle.foojayToolchains)
|
||||
api(libs.typesafe.conventions)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
rootProject.name = "build-settings-logic"
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
// versions should be kept in sync with `gradle/libs.versions.toml`
|
||||
plugins {
|
||||
// cannot be applied here, it's an early-evaluated included build
|
||||
id("dev.panuszewski.typesafe-conventions") version "0.10.0" apply false
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
val jupyterApiTCRepo: String? by settings
|
||||
|
||||
dependencyResolutionManagement {
|
||||
|
||||
// allows submodules to override repositories
|
||||
// Careful! Once you write `repositories {}`, the ones below are NOT included anymore
|
||||
repositoriesMode = RepositoriesMode.PREFER_PROJECT
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
jupyterApiTCRepo?.let { jupyterApiTCRepo ->
|
||||
if (jupyterApiTCRepo.isNotBlank()) maven(jupyterApiTCRepo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
// Use the Foojay Toolchains plugin to automatically download JDKs required by subprojects.
|
||||
id("org.gradle.toolchains.foojay-resolver-convention")
|
||||
}
|
||||
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import dev.panuszewski.gradle.TypesafeConventionsExtension
|
||||
|
||||
plugins {
|
||||
id("dfsettings.catalogs")
|
||||
id("dev.panuszewski.typesafe-conventions")
|
||||
}
|
||||
|
||||
extensions.getByType<TypesafeConventionsExtension>().apply {
|
||||
// prevents convention plugins being applied as `dependencies { implementation() }`
|
||||
autoPluginDependencies = false
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
plugins {
|
||||
id("dfsettings.version-catalog")
|
||||
id("dfsettings.convention-catalog")
|
||||
}
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
import dfsettings.findRootDir
|
||||
|
||||
plugins {
|
||||
id("dfsettings.base")
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a version catalog with build-logic convention plugins.
|
||||
* Files like `build-logic/src/main/kotlin/dfbuild.myConventionPlugin.gradle.kts`
|
||||
* can be applied as plugin like:
|
||||
* ```
|
||||
* plugins {
|
||||
* alias(convention.plugins.myConventionPlugin)
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
// generate type-safe accessors for convention plugins
|
||||
create("convention") {
|
||||
val buildConventionFiles = findRootDir()
|
||||
.resolve("build-logic/src/main/kotlin")
|
||||
.listFiles()
|
||||
?: emptyArray()
|
||||
|
||||
for (it in buildConventionFiles) {
|
||||
if (!it.isFile || !it.name.endsWith(".gradle.kts")) continue
|
||||
|
||||
val conventionName = it.name.removeSuffix(".gradle.kts")
|
||||
val aliasName = conventionName.removePrefix("dfbuild.")
|
||||
plugin(aliasName, conventionName).version("")
|
||||
}
|
||||
|
||||
// Additional plugins can be added here:
|
||||
// plugin("aliasName", "id")
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
import dfsettings.findRootDir
|
||||
|
||||
plugins {
|
||||
id("dfsettings.base")
|
||||
}
|
||||
|
||||
/*
|
||||
* Makes sure all Gradle projects use the same version catalog.
|
||||
*/
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
// so we can create a new 'libs' if it already exists
|
||||
defaultLibrariesExtensionName = "_default"
|
||||
create("libs") {
|
||||
try {
|
||||
from(
|
||||
files(
|
||||
findRootDir().resolve("gradle/libs.versions.toml").absolutePath,
|
||||
),
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
logger.warn(
|
||||
"Could not load version catalog (${findRootDir().absolutePath}/gradle/libs.versions.toml) from $settingsDir",
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dfsettings
|
||||
|
||||
import org.gradle.api.initialization.Settings
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Returns the root directory of the whole project
|
||||
* by finding the `gradlew` file in the parent directories.
|
||||
*/
|
||||
fun Settings.findRootDir(): File {
|
||||
var rootDir = settingsDir
|
||||
while (!rootDir.resolve("gradlew").exists()) {
|
||||
rootDir = rootDir.parentFile
|
||||
}
|
||||
return rootDir!!
|
||||
}
|
||||
Reference in New Issue
Block a user