Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
`kotlin-dsl`
}

group = "dev.nextftc.suite.build"

repositories {
google()
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.0")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.2.0")
implementation("io.deepmedia.tools.deployer:deployer:0.18.0")
implementation("com.diffplug.spotless:spotless-plugin-gradle:8.1.0")
implementation("com.android.tools.build:gradle:8.7.3")
}

kotlin {
jvmToolchain(17)
}
16 changes: 16 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}

rootProject.name = "build-logic"
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
}

android {
compileSdk = 30

defaultConfig {
minSdk = 24
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

testOptions {
targetSdk = 28
}
}

kotlin {
jvmToolchain(8)
compilerOptions {
freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
}
}

tasks.withType<Test>().configureEach {
javaLauncher.set(javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(11)) })
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id("org.jetbrains.kotlin.jvm")
}

kotlin {
jvmToolchain(8)
compilerOptions {
freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
127 changes: 127 additions & 0 deletions build-logic/src/main/kotlin/dev.nextftc.suite.publishing.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import com.android.build.api.dsl.LibraryExtension
import com.diffplug.gradle.spotless.SpotlessExtension
import dev.nextftc.suite.build.NextFtcPublishingExtension
import dev.nextftc.suite.build.nextFtcKtlintEditorConfig
import org.gradle.jvm.tasks.Jar
import org.jetbrains.dokka.gradle.DokkaExtension
import org.jetbrains.dokka.gradle.engine.plugins.DokkaHtmlPluginParameters

plugins {
id("org.jetbrains.dokka")
id("io.deepmedia.tools.deployer")
id("com.diffplug.spotless")
}

val extension = extensions.create<NextFtcPublishingExtension>("nextFTCPublishing")

dependencies {
add("dokkaPlugin", "org.jetbrains.dokka:mathjax-plugin")
}

configure<SpotlessExtension> {
kotlin {
target("src/*/kotlin/**/*.kt")
ktlint().editorConfigOverride(nextFtcKtlintEditorConfig)
}
}

configure<DokkaExtension> {
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
dokkaSourceSets.named("main") {
sourceRoots.from(file("src/main/kotlin"))

sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl("https://github.com/NextFTC/NextFTCSuite/blob/main/${project.name}/src/main/kotlin")
remoteLineSuffix.set("#L")
}
}
}

moduleName.set(extension.displayName)

pluginsConfiguration.named<DokkaHtmlPluginParameters>("html") {
footerMessage.set("Copyright © 2026 NextFTC - Licensed under the BSD-3-Clause license.")
customAssets.from(extension.logoPath)
}
}

val dokkaExtension = extensions.getByType<DokkaExtension>()

val dokkaJar by tasks.registering(Jar::class) {
dependsOn(tasks.named("dokkaGenerate"))
from(dokkaExtension.basePublicationsDirectory.dir("html"))
archiveClassifier.set("html-docs")
}

deployer {
projectInfo {
url = "https://nextftc.dev/"
scm {
fromGithub("NextFTC", "NextFTCSuite")
}
license("BSD 3-Clause License", "https://opensource.org/license/bsd-3-clause")
developer("Zach Harel", "zach@zharel.me", url = "https://github.com/zachwaffle4")
developer(
"Davis Luxenberg",
"davis.luxenberg@outlook.com",
url = "https://github.com/BeepBot99",
)
developer("Rowan McAlpin", "rowan@nextftc.dev", url = "https://rowanmcalpin.com")

name.set(extension.displayName)
groupId.set(extension.group)
}

signing {
key.set(secret("MVN_GPG_KEY"))
password.set(secret("MVN_GPG_PASSWORD"))
}

content {
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
kotlinComponents {
kotlinSources()
docs(dokkaJar)
}
}

pluginManager.withPlugin("com.android.library") {
pluginManager.withPlugin("org.jetbrains.kotlin.android") {
configure<LibraryExtension> {
publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

androidComponents("release") {
docs(dokkaJar)
}
}
}
}

release {
version.set(extension.version)
}

localSpec()

nexusSpec("snapshot") {
repositoryUrl.set("https://central.sonatype.com/repository/maven-snapshots/")
auth {
user.set(secret("SONATYPE_USERNAME"))
password.set(secret("SONATYPE_PASSWORD"))
}
}

centralPortalSpec {
auth {
user.set(secret("SONATYPE_USERNAME"))
password.set(secret("SONATYPE_PASSWORD"))
}
allowMavenCentralSync.set(extension.automaticMavenCentralSync)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import dev.nextftc.suite.build.nextFtcKtlintEditorConfig

allprojects {
apply(plugin = "com.diffplug.spotless")

version = property("version") as String
group = "dev.nextftc.v2"

extensions.configure<SpotlessExtension> {
kotlinGradle {
ktlint().editorConfigOverride(nextFtcKtlintEditorConfig)
}
}
}

subprojects {
pluginManager.apply("dev.nextftc.suite.publishing")
}

tasks.register("deployCentralPortal") {
group = "publishing"
description = "Publishes all subprojects to Maven Central."
dependsOn(subprojects.map { "${it.path}:deployCentralPortal" })
}

tasks.register("deployLocal") {
group = "publishing"
description = "Publishes all subprojects to Maven Local."
dependsOn(subprojects.map { "${it.path}:deployLocal" })
}

tasks.register("deployNexusSnapshot") {
group = "publishing"
description = "Publishes all subprojects to Maven Central Snapshots."
dependsOn(subprojects.map { "${it.path}:deployNexusSnapshot" })
}
9 changes: 9 additions & 0 deletions build-logic/src/main/kotlin/dev/nextftc/suite/build/Ktlint.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package dev.nextftc.suite.build

val nextFtcKtlintEditorConfig = mapOf(
"ktlint_code_style" to "intellij_idea",
"indent_size" to "2",
"continuation_indent_size" to "2",
"ktlint_standard_no-wildcard-imports" to "disabled",
"max_line_length" to "108",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package dev.nextftc.suite.build

import org.gradle.api.Project
import org.gradle.api.model.ObjectFactory
import org.gradle.kotlin.dsl.property
import javax.inject.Inject

open class NextFtcPublishingExtension @Inject constructor(objects: ObjectFactory, project: Project) {
val displayName = objects.property<String>()
val version = objects.property<String>().convention(project.provider { project.version.toString() })
val group = objects.property<String>().convention(project.provider { project.group.toString() })
val automaticMavenCentralSync = objects.property<Boolean>()
.convention(
project.providers.gradleProperty("dev.nextftc.publishing.automaticMavenCentralSync").map(String::toBoolean),
)
val logoPath = objects.property<String>().convention("assets/logo-icon.svg")
}
71 changes: 1 addition & 70 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,80 +1,11 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import io.deepmedia.tools.deployer.DeployerExtension

plugins {
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.nextftc.publishing)
alias(libs.plugins.spotless)
id("dev.nextftc.suite.publishing.multi-module")
alias(libs.plugins.dokka)
}

allprojects {
apply(plugin = "com.diffplug.spotless")

version = property("version") as String
group = "dev.nextftc.v2"

extensions.configure<SpotlessExtension> {
kotlinGradle {
ktlint().editorConfigOverride(
mapOf(
"ktlint_code_style" to "intellij_idea",
"indent_size" to "2",
"continuation_indent_size" to "2",
"ktlint_standard_no-wildcard-imports" to "disabled",
"max_line_length" to "108",
),
)
}
}
}

subprojects {
extensions.configure<DeployerExtension> {
projectInfo {
url = "https://nextftc.dev/"
scm {
fromGithub("NextFTC", "NextFTCSuite")
}
license("BSD 3-Clause License", "https://opensource.org/license/bsd-3-clause")
developer("Zach Harel", "zach@zharel.me", url = "https://github.com/zachwaffle4")
developer(
"Davis Luxenberg",
"davis.luxenberg@outlook.com",
url = "https://github.com/BeepBot99",
)
developer("Rowan McAlpin", "rowan@nextftc.dev", url = "https://rowanmcalpin.com")
}
}

dokka {
pluginsConfiguration.html {
footerMessage.set("Copyright © 2026 NextFTC - Licensed under the BSD-3-Clause license.")
}
}

dependencies {
dokkaPlugin("org.jetbrains.dokka:mathjax-plugin")
}

extensions.configure<SpotlessExtension> {
kotlin {
target("src/*/kotlin/**/*.kt")
ktlint().editorConfigOverride(
mapOf(
"ktlint_code_style" to "intellij_idea",
"indent_size" to "2",
"continuation_indent_size" to "2",
"ktlint_standard_no-wildcard-imports" to "disabled",
"max_line_length" to "108",
),
)
}
}
}

dependencies {
dokka(project(":units"))
dokka(project(":linalg"))
Expand Down
18 changes: 1 addition & 17 deletions control/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.spotless)
id("dev.nextftc.suite.kotlin-jvm")
}

description = "A WPIMath inspired library for controls and other math classes and functions."
Expand All @@ -22,18 +21,3 @@ dokka {
includes.from("Module.md")
}
}

kotlin {
jvmToolchain(8)
compilerOptions {
freeCompilerArgs.addAll("-Xconsistent-data-class-copy-visibility")
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

tasks.withType<Test>().configureEach { useJUnitPlatform() }
Loading
Loading