Skip to content

Commit

Permalink
work on setting up build.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
linglejack06 committed Apr 28, 2024
1 parent b4e440b commit 4b6e46d
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 66 deletions.
4 changes: 0 additions & 4 deletions lib/Libraries.kt

This file was deleted.

116 changes: 116 additions & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import java.text.SimpleDateFormat

plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id "edu.wpi.first.GradleRIO" version "2024.3.2"
id "com.peterabeles.gversion" version "1.10"
id "com.diffplug.spotless" version "6.24.0"
id 'org.ajoberstar.grgit' version "5.2.1"
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
mavenLocal()
}

def MAIN_CLASS = "coppercore"

deploy {
targets {
roborio(getTargetTypeClass("RoboRIO")) {
team = project.frc.getTeamOrDefault(401)
debug = project.frc.getDebugOrDefault(false)

artifacts {

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {

}

frcStaticFileDeploy(getArtifactTypeClass("FileTreeArtifact")) {
files = project.fileTree('lib/src/main/deploy')
directory = "/home/lvuser/deploy"
}
}
}
}
}

def deployArtifact = deploy.targets.roborio.artifacts.frcJava

def includeDesktopSupport = true

dependencies {
// Use JUnit Jupiter for testing.
testImplementation libs.junit.jupiter

testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// This dependency is exported to consumers, that is to say found on their compile classpath.
api libs.commons.math3

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation libs.guava

// WPILIB setup
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio)
roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio)

roborioRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio)
roborioRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio)

nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop)
nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop)
simulationDebug wpi.sim.enableDebug()

nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
simulationRelease wpi.sim.enableRelease()
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

wpi.sim.addGui().defaultEnabled = true
wpi.sim.addDriverstation()

tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

// adds dependency files to large jar
jar {
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
from sourceSets.main.allSource
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(MAIN_CLASS)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

// deploy jar + tasks
deployArtifact.jarTask = jar
wpi.java.configureExecutableTasks(jar)

tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}

project.compileJava.dependsOn(createVersionFile)
gversion {
srcDir = "lib/src/main/java"
classPackage = "coppercore"
dateFormat = "yyyy-MM-dd HH:mm:ss Z"
timeZone = "America/New_York"
indent = " "
}
48 changes: 0 additions & 48 deletions lib/build.gradle.kts

This file was deleted.

39 changes: 39 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import org.gradle.internal.os.OperatingSystem

// manage wpilib path structure
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2024'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
if (publicFolder == null) {
publicFolder = "C:\\Users\\Public"
}
def homeRoot = new File(publicFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
} else {
def userFolder = System.getProperty("user.home")
def homeRoot = new File(userFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
}
def frcHomeMaven = new File(frcHome, 'maven')
maven {
name 'frcHome'
url frcHomeMaven
}
}
}

plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

rootProject.name = 'coppercore'
include('lib')

Properties props = System.getProperties();
props.setProperty("org.gradle.internal.native.headers.unresolved.dependencies.ignore", "true");
14 changes: 0 additions & 14 deletions settings.gradle.kts

This file was deleted.

0 comments on commit 4b6e46d

Please sign in to comment.