86 lines
2.4 KiB
Plaintext
86 lines
2.4 KiB
Plaintext
plugins {
|
|
java
|
|
}
|
|
dependencies {
|
|
// Testing (runs on PC without SDK)
|
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
testImplementation("org.mockito:mockito-core:5.5.0")
|
|
}
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
|
|
// Exclude FTC hardware files from PC compilation (they need Android SDK)
|
|
tasks.withType<JavaCompile> {
|
|
exclude("**/FtcDCMotor.java")
|
|
exclude("**/FtcCRServo.java")
|
|
exclude("**/FtcPotentiometer.java")
|
|
exclude("**/opmodes/ChuteOpMode.java")
|
|
}
|
|
|
|
tasks.javadoc {
|
|
// Only generate docs for chute subsystem
|
|
include("**/subsystems/chute/**")
|
|
|
|
// But exclude FTC hardware files (they need Android SDK)
|
|
exclude("**/FtcDCMotor.java")
|
|
exclude("**/FtcCRServo.java")
|
|
exclude("**/FtcPotentiometer.java")
|
|
exclude("**/opmodes/**")
|
|
|
|
// Ignore broken @see references to excluded files
|
|
options {
|
|
(this as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
|
|
}
|
|
}
|
|
|
|
tasks.test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events("passed", "skipped", "failed")
|
|
showStandardStreams = false
|
|
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
|
|
}
|
|
}
|
|
// Task to deploy code to FTC SDK
|
|
tasks.register<Copy>("deployToSDK") {
|
|
group = "ftc"
|
|
description = "Copy code to FTC SDK TeamCode for deployment"
|
|
|
|
val sdkDir = "/home/eric/.weevil/ftc-sdk"
|
|
|
|
from("src/main/java") {
|
|
include("org/firstinspires/ftc/teamcode/**/*.java")
|
|
exclude("**/mock/MockCRServo.java")
|
|
exclude("**/mock/MockDCMotor.java")
|
|
exclude("**/mock/MockPotentiometer.java")
|
|
}
|
|
|
|
into(layout.projectDirectory.dir("$sdkDir/TeamCode/src/main/java"))
|
|
|
|
doLast {
|
|
println("✓ Code deployed to TeamCode")
|
|
}
|
|
}
|
|
// Task to build APK
|
|
tasks.register<Exec>("buildApk") {
|
|
group = "ftc"
|
|
description = "Build APK using FTC SDK"
|
|
|
|
dependsOn("deployToSDK")
|
|
|
|
val sdkDir = "/home/eric/.weevil/ftc-sdk"
|
|
workingDir = file(sdkDir)
|
|
|
|
commandLine = if (System.getProperty("os.name").lowercase().contains("windows")) {
|
|
listOf("cmd", "/c", "gradlew.bat", "assembleDebug")
|
|
} else {
|
|
listOf("./gradlew", "assembleDebug")
|
|
}
|
|
|
|
doLast {
|
|
println("✓ APK built successfully")
|
|
}
|
|
} |