Skip to content

Commit

Permalink
add spotless and bump actions/ plugins to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Dec 1, 2023
1 parent 0615da6 commit a6a3e56
Show file tree
Hide file tree
Showing 79 changed files with 4,385 additions and 3,871 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
- name: Publish to Maven Local
run: ./gradlew build publishToMavenLocal --stacktrace -PlocalPublish
- name: Check output
run: git --no-pager diff --exit-code HEAD
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Maven
path: ~/.m2/
Expand All @@ -29,12 +29,12 @@ jobs:
matrix:
language: [cpp, java, asm] #, jni, kotlin]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@va4
with:
java-version: 11
distribution: temurin
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: Maven
path: ~/.m2/
Expand All @@ -51,10 +51,10 @@ jobs:
needs: [build, test_examples]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
Expand All @@ -67,3 +67,14 @@ jobs:
./gradlew publishPlugin \
-Pgradle.publish.key=$GRADLE_PUBLISH_KEY \
-Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET
spotless:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- run: ./gradlew spotlessCheck

16 changes: 8 additions & 8 deletions _localtest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ buildscript {
}
dependencies {
classpath 'com.jcraft:jsch:0.1.53'
// classpath group: 'edu.wpi.first.deployutils', name: 'DeployUtils', version: '2018.08.21'
// classpath group: 'gradle.plugin.edu.wpi.first.deployutils', name: 'DeployTools', version: '2018.08.26'
// classpath group: 'edu.wpi.first.deployutils', name: 'DeployUtils', version: '2018.08.21'
// classpath group: 'gradle.plugin.edu.wpi.first.deployutils', name: 'DeployTools', version: '2018.08.26'
classpath group: 'edu.wpi.first', name: 'GradleRIO', version: '2019.0.0-alpha-4-pre2'
classpath group: 'de.undercouch', name: 'gradle-download-task', version: '3.1.2'
classpath group: 'com.google.code.gson', name: 'gson', version: '2.2.4'
Expand All @@ -30,8 +30,8 @@ plugins {
apply plugin: 'edu.wpi.first.GradleRIO'

buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}

repositories {
Expand All @@ -52,7 +52,7 @@ deploy {
}
artifact('frcNative', edu.wpi.first.gradlerio.frc.FRCNativeArtifact) {
targets << 'roborio5333'
// robotCommand = false
// robotCommand = false
component = 'myFrcBinary'
}
}
Expand All @@ -65,7 +65,7 @@ model {
components {
myFrcBinary(NativeExecutableSpec) {
targetPlatform 'roborio'
// targetPlatform 'desktop'
// targetPlatform 'desktop'
binaries.all {
cppCompiler.args('-g')
}
Expand All @@ -83,8 +83,8 @@ dependencies {
compile wpilib()
// CTRE Phoenix FRC Beta library
// Download from Teamforge, not currently publically available
// compile zipTree('libs/phoenix_v5.0.4.4.zip').matching { it.include('java/lib/CTRE_Phoenix.jar') }
// nativeLib zipTree('libs/phoenix_v5.0.4.4.zip').matching { it.include('java/lib/libCTRE_PhoenixCCI.so') }
// compile zipTree('libs/phoenix_v5.0.4.4.zip').matching { it.include('java/lib/CTRE_Phoenix.jar') }
// nativeLib zipTree('libs/phoenix_v5.0.4.4.zip').matching { it.include('java/lib/libCTRE_PhoenixCCI.so') }
simulation sim.nt_ds()
simulation sim.nt_readout()

Expand Down
27 changes: 13 additions & 14 deletions _localtest/src/main/java/test/MyClass.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package test;
import edu.wpi.first.wpilibj.I2C;

import edu.wpi.first.wpilibj.IterativeRobot;

public class MyClass extends IterativeRobot {

public MyClass() {
super();
}
public MyClass() {
super();
}

public void robotInit() {
System.out.println("Hello World");
}
public void robotInit() {
System.out.println("Hello World");
}

@Override
public void teleopPeriodic() {
}
@Override
public void teleopPeriodic() {}

public int onePlusOne() {
return 2;
}
}
public int onePlusOne() {
return 2;
}
}
14 changes: 6 additions & 8 deletions _localtest/src/test/java/TestMyClass.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import edu.wpi.first.wpilibj.RobotBase;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -8,10 +7,9 @@
@RunWith(JUnit4.class)
public class TestMyClass {

@Test
public void testOnePlusOne() {
// RobotBase.initializeHardwareConfiguration();
Assert.assertEquals(new MyClass().onePlusOne(), 2);
}

}
@Test
public void testOnePlusOne() {
// RobotBase.initializeHardwareConfiguration();
Assert.assertEquals(new MyClass().onePlusOne(), 2);
}
}
25 changes: 25 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'maven-publish'
id 'java'
id 'groovy'
id 'com.diffplug.spotless' version '6.12.0'
}

repositories {
Expand Down Expand Up @@ -111,3 +112,27 @@ wrapper {
gradleVersion = '8.1'
distributionType = Wrapper.DistributionType.BIN
}

spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**'
}
toggleOffOn()
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
groovy {
target fileTree('.') {
include '**/*.gradle'
exclude '**/build/**', '**/build-*/**'
}
greclipse()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit a6a3e56

Please sign in to comment.