mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Gradle build task improvements (#2164)
## Description This fixes a few problems with the Gradle `build` task and subtasks. 1. Spotless was being run on `node_modules`, resulting in errors for out-of-source files. This is now disabled. 2. All tests were running from the `build` task, resulting in unexpected windows popping up. Now only headless tests are run. 3. Headless tests were updated to run from the same root directory as the other tests. ## Meta Merge checklist: - [X] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [X] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added
This commit is contained in:
@@ -92,7 +92,7 @@ spotless {
|
||||
format 'misc', {
|
||||
target fileTree('.') {
|
||||
include '**/*.md', '**/.gitignore'
|
||||
exclude '**/build/**', '**/build-*/**'
|
||||
exclude '**/build/**', '**/build-*/**', '**/node_modules/**'
|
||||
}
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces(2)
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.photonvision.common.util.TestUtils;
|
||||
|
||||
public class NetworkConfigTest {
|
||||
@Test
|
||||
@@ -39,13 +40,13 @@ public class NetworkConfigTest {
|
||||
@Test
|
||||
public void testDeserializeTeamNumberOrNtServerAddress() {
|
||||
{
|
||||
var folder = Path.of("test-resources/network-old-team-number");
|
||||
var folder = TestUtils.getResourcesFolderPath(true).resolve("network-old-team-number");
|
||||
var configMgr = new ConfigManager(folder, new LegacyConfigProvider(folder));
|
||||
configMgr.load();
|
||||
assertEquals("9999", configMgr.getConfig().getNetworkConfig().ntServerAddress);
|
||||
}
|
||||
{
|
||||
var folder = Path.of("test-resources/network-new-team-number");
|
||||
var folder = TestUtils.getResourcesFolderPath(true).resolve("network-new-team-number");
|
||||
var configMgr = new ConfigManager(folder, new LegacyConfigProvider(folder));
|
||||
configMgr.load();
|
||||
assertEquals("9999", configMgr.getConfig().getNetworkConfig().ntServerAddress);
|
||||
|
||||
@@ -71,7 +71,7 @@ tasks.register('testHeadless', Test) {
|
||||
showStandardStreams = true
|
||||
}
|
||||
exclude '**/*BenchmarkTest*'
|
||||
workingDir = "../"
|
||||
workingDir = new File("${rootDir}")
|
||||
}
|
||||
|
||||
jacoco {
|
||||
@@ -96,3 +96,10 @@ jacocoTestReport {
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
// Only run headless tests from the build task
|
||||
gradle.taskGraph.whenReady { graph ->
|
||||
if (graph.hasTask(build)) {
|
||||
test.enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user