shadowJar & docs

This commit is contained in:
rusefillc 2024-01-14 08:47:51 -05:00
parent 833c3056b9
commit b9aa256c38
6 changed files with 29 additions and 11 deletions

View File

@ -1,3 +1,5 @@
# CAN decoding
CAN log file utilities to help me work with https://github.com/brent-stone/CAN_Reverse_Engineering and https://github.com/HeinrichG-V12/E65_ReverseEngineering
@ -10,4 +12,11 @@ CAN log file utilities to help me work with https://github.com/brent-stone/CAN_R
* ignition on, engine not running, brake pedal three times
* ignition on, engine not running, throttle pedal from 0% to 50%, to 0%, to 100%, to 0%
* engine running, rev from 1500 rpm to 3000 rpm
*
# CAN playback
``
gradlew :playback:shadowJar
java -jar playback/build/libs/playback-all.jar playback/src/main/resources/atlas.trc
``

View File

@ -1 +1,4 @@
javaCanVersion=3.2.4
javaCanVersion=3.2.4
shadowVersion=8.1.1
org.gradle.warning.mode=all

View File

@ -1,6 +1,7 @@
plugins {
id 'java'
id 'java-library'
id 'com.github.johnrengelman.shadow' version "${shadowVersion}"
}
dependencies {
@ -9,4 +10,12 @@ dependencies {
api libs.annotations
api group: 'tel.schich', name: 'javacan-core', version: "$javaCanVersion"
api group: 'tel.schich', name: 'javacan-core', version: "$javaCanVersion", classifier: 'x86_64'
}
shadowJar {
manifest {
attributes(
'Main-Class': 'com.rusefi.io.can.SenderSandbox'
)
}
}

View File

@ -7,15 +7,17 @@ import org.jetbrains.annotations.NotNull;
import peak.can.basic.HackLoadLibraryFlag;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.List;
import java.util.Objects;
public class SenderSandbox {
public static void main(String[] args) throws Exception {
List<CANPacket> packets = readResource("atlas.trc");
String fileName = args.length > 0 ? args[0] : getFullResourceFileName("resources/atlas.trc");
List<CANPacket> packets = CANLineReader.getReader().readFile(fileName);
System.out.println("Got " + packets.size() + " packet(s)");
if (isWindows()) {
@ -31,16 +33,10 @@ public class SenderSandbox {
}
}
static List<CANPacket> readResource(String resourceName) throws URISyntaxException, IOException {
String fullResourceFileName = getFullResourceFileName(resourceName);
return CANLineReader.getReader().readFile(fullResourceFileName);
}
@NotNull
private static String getFullResourceFileName(String resourceName) throws URISyntaxException {
URL resource = SenderSandbox.class.getResource("/" + resourceName);
System.out.println(resource);
System.out.println(Objects.requireNonNull(resource, "URL for " + resourceName));
String fullResourceFileName = Paths.get(resource.toURI()).toString();
return fullResourceFileName;
}

View File

@ -1,5 +1,6 @@
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version "${shadowVersion}"
}
dependencies {