Skip to content

Commit

Permalink
rs-start
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonwatson committed Jul 26, 2024
1 parent 08aa90f commit 5def7c2
Show file tree
Hide file tree
Showing 24 changed files with 562 additions and 1,018 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,8 @@ bin/
# Simulation GUI and other tools window save file
*-window.json

/src/main/java/org/frc5572/robotools/IOTypes.java
/src/main/java/org/frc5572/robotools/IOTypes.java

# Added by cargo

/target
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
294 changes: 294 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "robot-tools"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]
path = "src/main/rust/lib.rs"

[dependencies]
jni = "0.21"
44 changes: 40 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,51 @@ tasks.withType(JavaCompile) {
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED'
}

// sourceCompatibility = JavaVersion.VERSION_17
// targetCompatibility = JavaVersion.VERSION_17
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenCentral()
}

dependencies {

implementation 'org.apache.commons:commons-lang3:3.15.0'
}

task buildRustWindows(type: Exec) {
commandLine System.properties['user.home'] + '/.cargo/bin/cargo', 'build', '--target', 'x86_64-pc-windows-gnu', '--release'
}

task buildRustLinux(type: Exec) {
commandLine System.properties['user.home'] + '/.cargo/bin/cargo', 'build', '--target', 'x86_64-unknown-linux-gnu'
}

task buildRust {
dependsOn('buildRustWindows')
dependsOn('buildRustLinux')
}

task copyRustWindows(type: Copy) {
dependsOn('buildRustWindows')
from 'target/x86_64-pc-windows-gnu/release/robot_tools.dll'
into 'src/main/resources'
}

task copyRustLinux(type: Copy) {
dependsOn('buildRustLinux')
from 'target/x86_64-unknown-linux-gnu/debug/librobot_tools.so'
into 'src/main/resources'
}

task copyRust {
dependsOn('copyRustWindows')
dependsOn('copyRustLinux')
}

tasks.named('processResources') {
dependsOn('copyRust')
}

publishing {
Expand All @@ -34,7 +70,7 @@ publishing {
// Use jitpack format for publishing to mavenLocal
groupId = 'com.github.Frc5572'
artifactId = 'RobotTools'
version = 'main-SNAPSHOT'
version = 'test'

from components.java
}
Expand Down
2 changes: 0 additions & 2 deletions gen_io_types/.gitignore

This file was deleted.

Loading

0 comments on commit 5def7c2

Please sign in to comment.