Skip to content

Commit

Permalink
📃 Introduce buildSrc for convenience
Browse files Browse the repository at this point in the history
So that we don't have to set it up when
we need it.
  • Loading branch information
lunakoly committed Jul 30, 2023
1 parent 7cd24a0 commit 6d1dbb7
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
42 changes: 42 additions & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
24 changes: 24 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
id("java")
alias(libs.plugins.kotlin)
}

group = "org.lunakoly"
version = "1.0.7"

repositories {
mavenCentral()
}

dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}

tasks.test {
useJUnitPlatform()
}

kotlin {
jvmToolchain(11)
}
9 changes: 9 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Source:
// https://docs.gradle.org/current/userguide/platforms.html#sec:importing-catalog-from-file
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@file:Suppress("unused")

package org.lunakoly.quicklink.helpers

fun <T> pickFirstMiddleAndLast(elements: List<T>) = when {
elements.isEmpty() -> emptySet()
else -> setOf(elements.first(), elements.get(elements.lastIndex / 2), elements.last())
}

0 comments on commit 6d1dbb7

Please sign in to comment.