From a6c7789b5e9414c576ea70c57cf8463ae2f5228b Mon Sep 17 00:00:00 2001 From: Thad House Date: Sat, 14 Oct 2017 21:57:53 -0700 Subject: [PATCH] Removes specific raspbian, armv7 and armv8 cross builds (#41) Will make the cross platform build case easier. A bit more difficult to consume, but will be easier in the long run. --- config.gradle | 42 +++++++------------ .../wpi/first/wpiutil/RuntimeDetector.java | 34 +-------------- 2 files changed, 16 insertions(+), 60 deletions(-) diff --git a/config.gradle b/config.gradle index ac67a11fa8..9ed83b4e8a 100644 --- a/config.gradle +++ b/config.gradle @@ -175,34 +175,17 @@ if (!project.hasProperty('onlyAthena')) { compilerFamily = 'Clang' detectPlatform = mac64PlatformDetect } - raspbian(CrossBuildConfig) { - architecture = 'raspbian' + } + } +} + +if (project.hasProperty('linuxCross')) { + model { + buildConfigs { + linuxArm(CrossBuildConfig) { + architecture = 'nativearm' operatingSystem = 'linux' - toolChainPrefix = 'arm-linux-gnueabihf-' - compilerArgs = linuxCompilerArgs - linkerArgs = linuxLinkerArgs - debugCompilerArgs = linuxDebugCompilerArgs - releaseCompilerArgs = linuxReleaseCompilerArgs - skipByDefault = true - compilerFamily = 'Gcc' - exclude << 'gmock' - } - armhf(CrossBuildConfig) { - architecture = 'armhf' - operatingSystem = 'linux' - toolChainPrefix = 'arm-linux-gnueabihf-' - compilerArgs = linuxCompilerArgs - linkerArgs = linuxLinkerArgs - debugCompilerArgs = linuxDebugCompilerArgs - releaseCompilerArgs = linuxReleaseCompilerArgs - skipByDefault = true - compilerFamily = 'Gcc' - exclude << 'gmock' - } - aarch(CrossBuildConfig) { - architecture = 'aarch' - operatingSystem = 'linux' - toolChainPrefix = 'aarch-linux-gnu-' + toolChainPrefix = 'PLEASE_PROVIDE_A_COMPILER_NAME' compilerArgs = linuxCompilerArgs linkerArgs = linuxLinkerArgs debugCompilerArgs = linuxDebugCompilerArgs @@ -211,6 +194,11 @@ if (!project.hasProperty('onlyAthena')) { compilerFamily = 'Gcc' exclude << 'gmock' } + } + } +} else { + model { + buildConfigs { linuxArm(BuildConfig) { architecture = 'nativearm' operatingSystem = 'linux' diff --git a/src/main/java/edu/wpi/first/wpiutil/RuntimeDetector.java b/src/main/java/edu/wpi/first/wpiutil/RuntimeDetector.java index 05b06eb8ca..e7b39680c6 100644 --- a/src/main/java/edu/wpi/first/wpiutil/RuntimeDetector.java +++ b/src/main/java/edu/wpi/first/wpiutil/RuntimeDetector.java @@ -44,14 +44,8 @@ public class RuntimeDetector { filePath = "/linux/x86-64/"; } else if (isAthena()) { filePath = "/linux/athena/"; - } else if (isRaspbian()) { - filePath = "/linux/raspbian/"; - } else if (isArmV7()) { - filePath = "/linux/armhf/"; - } else if (isAarch64()) { - filePath = "/linux/aarch/"; } else { - filePath = "/linux/arm/"; + filePath = "/linux/nativearm/"; } } else { throw new RuntimeException("Failed to determine OS"); @@ -87,32 +81,6 @@ public class RuntimeDetector { return runRobotFile.exists(); } - public static boolean isRaspbian() { - try { - Process p = Runtime.getRuntime().exec("uname -a"); - BufferedReader in = new BufferedReader( - new InputStreamReader(p.getInputStream())); - return in.readLine().contains("raspberrypi"); - } catch (IOException e) { - return false; - } - } - - public static boolean isArmV7() { - try { - Process p = Runtime.getRuntime().exec("uname -a"); - BufferedReader in = new BufferedReader( - new InputStreamReader(p.getInputStream())); - return in.readLine().contains("armv7"); - } catch (IOException e) { - return false; - } - } - - public static boolean isAarch64() { - return false; - } - public static boolean isLinux() { return System.getProperty("os.name").startsWith("Linux"); }