let's separate Android from not Android

This commit is contained in:
rusefillc 2022-10-15 13:30:38 -04:00
parent 28e671622a
commit f8b7470c7b
13 changed files with 50 additions and 61 deletions

View File

@ -49,7 +49,6 @@ android {
dependencies {
implementation project(':ecu_io')
implementation project(':autoupdate')
implementation project(':logging-api')
implementation project(':shared_io')
implementation project(':models')

View File

@ -13,21 +13,3 @@ include ':inifile'
project(':inifile').projectDir = new File('../java_console/inifile')
include ':models'
project(':models').projectDir = new File('../java_console/models')
include ':autoupdate'
project(':autoupdate').projectDir = new File('../java_console/autoupdate')
include ':gcc_map_reader'
project(':gcc_map_reader').projectDir = new File('../java_tools/gcc_map_reader')
include ':logicdata2c'
project(':logicdata2c').projectDir = new File('../java_tools/logicdata2c')
include ':version2header'
project(':version2header').projectDir = new File('../java_tools/version2header')
include ':enum_to_string'
project(':enum_to_string').projectDir = new File('../java_tools/enum_to_string')
include ':bin2header'
project(':bin2header').projectDir = new File('../java_tools/bin2header')
include ':config_definition'
project(':config_definition').projectDir = new File('../java_tools/configuration_definition')
include ':ts_plugin_launcher'
project(':ts_plugin_launcher').projectDir = new File('../java_tools/ts_plugin_launcher')
include ':ts_plugin'
project(':ts_plugin').projectDir = new File('../java_tools/ts_plugin')

View File

@ -2,10 +2,8 @@ package com.rusefi.autoupdate;
import com.rusefi.shared.ConnectionAndMeta;
import com.rusefi.shared.FileUtil;
import com.rusefi.ui.storage.PersistentConfiguration;
import com.rusefi.preferences.storage.PersistentConfiguration;
import com.rusefi.ui.util.FrameHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@ -22,13 +20,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class Autoupdate {
private static final String TITLE = "rusEFI Bundle Updater 20220717";
private static final String BUNDLE_NAME_FILE = "../bundle_name.txt";
private static final String AUTOUPDATE_MODE = "autoupdate";
private static final String RUSEFI_CONSOLE_JAR = "rusefi_console.jar";
private static final String COM_RUSEFI_LAUNCHER = "com.rusefi.Launcher";
public static void main(String[] args) {
String bundleFullName = readBundleFullName();
String bundleFullName = BundleUtil.readBundleFullName();
if (args.length > 0 && args[0].equalsIgnoreCase("release")) {
System.out.println("Release update requested");
@ -198,31 +195,6 @@ public class Autoupdate {
return doUpdate.get();
}
/**
* @return null in case of error
*/
@Nullable
public static String readBundleFullName() {
try {
BufferedReader r = new BufferedReader(new FileReader(BUNDLE_NAME_FILE));
String fullName = r.readLine();
fullName = fullName.trim();
if (fullName.length() < 3)
return null; // just paranoia check
return fullName;
} catch (IOException e) {
System.err.println(new Date() + ": Error reading " + BUNDLE_NAME_FILE);
return null;
}
}
@NotNull
public static String readBundleFullNameNotNull() {
String bundle = readBundleFullName();
bundle = bundle == null ? "unknown bundle" : bundle;
return bundle;
}
enum UpdateMode {
ALWAYS,
NEVER,

View File

@ -15,7 +15,6 @@ tasks.withType(Test) {
dependencies {
implementation libs.javaxJson
api project(':autoupdate')
api project(':models')
api project(':shared_io')
api project(':logging')

View File

@ -3,7 +3,7 @@ package com.rusefi.io;
import com.devexperts.logging.Logging;
import com.rusefi.RusEfiSignature;
import com.rusefi.SignatureHelper;
import com.rusefi.autoupdate.Autoupdate;
import com.rusefi.autoupdate.BundleUtil;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.config.generated.Fields;
import com.rusefi.ui.StatusConsumer;
@ -32,7 +32,7 @@ public class DfuHelper {
public static boolean sendDfuRebootCommand(JComponent parent, String signature, IoStream stream, StatusConsumer messages) {
RusEfiSignature s = SignatureHelper.parse(signature);
String bundleName = Autoupdate.readBundleFullName();
String bundleName = BundleUtil.readBundleFullName();
if (bundleName != null && s != null) {
String signatureWithPrefix;
if ("all".equals(s.getBundle())) {

View File

@ -1,10 +1,10 @@
package com.rusefi.tools;
import com.rusefi.server.SessionDetails;
import com.rusefi.ui.storage.Node;
import com.rusefi.preferences.storage.Node;
import org.jetbrains.annotations.NotNull;
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
import static com.rusefi.preferences.storage.PersistentConfiguration.getConfig;
public class VehicleToken {
private static final String VEHICLE_TOKEN = "VEHICLE_TOKEN";

View File

@ -5,7 +5,6 @@ plugins {
apply from: '../../android/dependencies.gradle'
dependencies {
api project(':autoupdate')
api project(':inifile')
api libs.snakeyaml
}

View File

@ -0,0 +1,38 @@
package com.rusefi.autoupdate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Date;
public class BundleUtil {
private static final String BUNDLE_NAME_FILE = "../bundle_name.txt";
/**
* @return null in case of error
*/
@Nullable
public static String readBundleFullName() {
try {
BufferedReader r = new BufferedReader(new FileReader(BUNDLE_NAME_FILE));
String fullName = r.readLine();
fullName = fullName.trim();
if (fullName.length() < 3)
return null; // just paranoia check
return fullName;
} catch (IOException e) {
System.err.println(new Date() + ": Error reading " + BUNDLE_NAME_FILE);
return null;
}
}
@NotNull
public static String readBundleFullNameNotNull() {
String bundle = readBundleFullName();
bundle = bundle == null ? "unknown bundle" : bundle;
return bundle;
}
}

View File

@ -1,4 +1,4 @@
package com.rusefi.ui.storage;
package com.rusefi.preferences.storage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@ -1,4 +1,4 @@
package com.rusefi.ui.storage;
package com.rusefi.preferences.storage;
import com.rusefi.shared.FileUtil;

View File

@ -2,7 +2,7 @@ package com.rusefi.ui;
import com.devexperts.logging.Logging;
import com.rusefi.auth.AuthTokenUtil;
import com.rusefi.ui.storage.PersistentConfiguration;
import com.rusefi.preferences.storage.PersistentConfiguration;
import com.rusefi.ui.util.URLLabel;
import org.jetbrains.annotations.NotNull;
@ -14,7 +14,7 @@ import java.awt.datatransfer.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
import static com.rusefi.preferences.storage.PersistentConfiguration.getConfig;
public class AuthTokenPanel {
private final static Logging log = Logging.getLogging(AuthTokenPanel.class);

View File

@ -37,7 +37,7 @@ import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
import static com.rusefi.preferences.storage.PersistentConfiguration.getConfig;
/**
* remote ECU access & control

View File

@ -1,7 +1,7 @@
package com.rusefi.ts_plugin;
import com.rusefi.tools.online.UploadResult;
import com.rusefi.ui.storage.PersistentConfiguration;
import com.rusefi.preferences.storage.PersistentConfiguration;
import org.putgemin.VerticalFlowLayout;
import javax.swing.*;