init research

This commit is contained in:
2026-02-08 11:20:43 -10:00
commit bdf064f54d
3041 changed files with 1592200 additions and 0 deletions
@@ -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")
@@ -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
}
@@ -0,0 +1,4 @@
plugins {
id("dfsettings.version-catalog")
id("dfsettings.convention-catalog")
}
@@ -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")
}
}
}
@@ -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!!
}