Split the two command implementations into separate libraries (#2012)

This will allow us at the user code side to determine to include old commands, new commands or both.
This commit is contained in:
Thad House
2019-11-01 21:58:54 -07:00
committed by Peter Johnson
parent 2ad15cae19
commit 509819d83f
271 changed files with 470 additions and 91 deletions

View File

@@ -42,6 +42,8 @@ dependencies {
compile project(':ntcore')
compile project(':cscore')
compile project(':cameraserver')
compile project(':wpilibOldCommands')
compile project(':wpilibNewCommands')
}
jar {
@@ -66,6 +68,8 @@ model {
}
}
binaries.all { binary ->
lib project: ':wpilibOldCommands', library: 'wpilibOldCommands', linkage: 'shared'
lib project: ':wpilibNewCommands', library: 'wpilibNewCommands', linkage: 'shared'
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
@@ -93,6 +97,8 @@ model {
}
}
binaries.all { binary ->
lib project: ':wpilibOldCommands', library: 'wpilibOldCommands', linkage: 'shared'
lib project: ':wpilibNewCommands', library: 'wpilibNewCommands', linkage: 'shared'
lib project: ':wpilibc', library: 'wpilibc', linkage: 'static'
lib project: ':ntcore', library: 'ntcore', linkage: 'static'
lib project: ':cscore', library: 'cscore', linkage: 'static'

View File

@@ -33,5 +33,7 @@ include 'simulation:halsim_ds_socket'
include 'simulation:halsim_gui'
include 'cameraserver'
include 'cameraserver:multiCameraServer'
include 'wpilibOldCommands'
include 'wpilibNewCommands'
include 'myRobot'
include 'docs'

View File

@@ -0,0 +1,96 @@
ext {
nativeName = 'wpilibNewCommands'
devMain = 'edu.wpi.first.wpilibj.commands.DevMain'
}
evaluationDependsOn(':ntcore')
evaluationDependsOn(':cscore')
evaluationDependsOn(':hal')
evaluationDependsOn(':wpilibc')
evaluationDependsOn(':cameraserver')
evaluationDependsOn(':wpilibj')
apply from: "${rootDir}/shared/javacpp/setupBuild.gradle"
dependencies {
compile project(':wpiutil')
compile project(':ntcore')
compile project(':cscore')
compile project(':hal')
compile project(':wpilibj')
devCompile project(':wpiutil')
devCompile project(':ntcore')
devCompile project(':cscore')
devCompile project(':hal')
devCompile project(':wpilibj')
testCompile 'com.google.guava:guava:19.0'
testCompile 'org.mockito:mockito-core:2.27.0'
}
nativeUtils.exportsConfigs {
wpilibNewCommands {
x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
'_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
'_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
}
}
apply from: "${rootDir}/shared/nilibraries.gradle"
apply plugin: DisableBuildingGTest
model {
components {}
binaries {
all {
if (!it.buildable || !(it instanceof NativeBinarySpec)) {
return
}
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
if (it.component.name == "${nativeName}Dev") {
lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared'
project(':hal').addHalJniDependency(it)
}
if (it instanceof GoogleTestTestSuiteBinarySpec) {
nativeUtils.useRequiredLibrary(it, 'opencv_shared')
lib project: ':cscore', library: 'cscore', linkage: 'shared'
}
}
}
tasks {
def c = $.components
def found = false
def systemArch = getCurrentArch()
c.each {
if (it in NativeExecutableSpec && it.name == "${nativeName}Dev") {
it.binaries.each {
if (!found) {
def arch = it.targetPlatform.name
if (arch == systemArch) {
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
found = true
}
}
}
}
}
}
}
test {
testLogging {
outputs.upToDateWhen {false}
showStandardStreams = true
}
}

View File

@@ -0,0 +1,27 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
import edu.wpi.first.hal.HALUtil;
import edu.wpi.first.networktables.NetworkTablesJNI;
import edu.wpi.first.wpiutil.RuntimeDetector;
public final class DevMain {
/**
* Main entry point.
*/
public static void main(String[] args) {
System.out.println("Hello World!");
System.out.println(RuntimeDetector.getPlatformPath());
System.out.println(NetworkTablesJNI.now());
System.out.println(HALUtil.getHALRuntimeType());
}
private DevMain() {
}
}

View File

@@ -0,0 +1,8 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
int main() {}

View File

@@ -9,7 +9,6 @@
#include <frc/RobotState.h>
#include <frc/WPIErrors.h>
#include <frc/commands/Scheduler.h>
#include <frc/smartdashboard/SendableBuilder.h>
#include <frc/smartdashboard/SendableRegistry.h>
#include <frc2/command/CommandGroupBase.h>

Some files were not shown because too many files have changed in this diff Show More