From 1f5ecf47a41379937110e7acf174ab10adf2f7dc Mon Sep 17 00:00:00 2001 From: Naveed Jooma Date: Wed, 26 Jun 2024 13:48:06 -0400 Subject: [PATCH] Move kotlin files into their own directory --- build.gradle | 2 +- .../main/java/com/viam/sdk/core/resource/ResourceManager.java | 4 ++-- .../com/viam/sdk/core/component/board/Board.kt | 2 +- .../com/viam/sdk/core/component/board/BoardRPCClient.kt | 0 .../com/viam/sdk/core/component/board/BoardRPCService.kt | 2 +- .../com/viam/sdk/core/component/motor/Motor.kt | 3 +-- .../com/viam/sdk/core/component/motor/MotorRPCClient.kt | 0 .../com/viam/sdk/core/component/motor/MotorRPCService.kt | 2 +- .../main/{java => kotlin}/com/viam/sdk/core/util/Durations.kt | 0 .../src/main/{java => kotlin}/com/viam/sdk/core/util/Media.kt | 0 .../com/viam/sdk/core/component/board/BoardRPCClientTest.kt | 0 .../com/viam/sdk/core/component/board/BoardRPCServiceTest.kt | 0 .../com/viam/sdk/core/component/board/BoardTest.kt | 0 .../com/viam/sdk/core/component/gripper/GripperTest.kt | 0 .../com/viam/sdk/core/component/motor/MotorRPCClientTest.kt | 0 .../com/viam/sdk/core/component/motor/MotorRPCServiceTest.kt | 0 .../com/viam/sdk/core/component/motor/MotorTest.kt | 0 17 files changed, 7 insertions(+), 8 deletions(-) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/component/board/Board.kt (99%) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/component/board/BoardRPCClient.kt (100%) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/component/board/BoardRPCService.kt (98%) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/component/motor/Motor.kt (99%) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/component/motor/MotorRPCClient.kt (100%) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/component/motor/MotorRPCService.kt (97%) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/util/Durations.kt (100%) rename core/sdk/src/main/{java => kotlin}/com/viam/sdk/core/util/Media.kt (100%) rename core/sdk/src/test/{java => kotlin}/com/viam/sdk/core/component/board/BoardRPCClientTest.kt (100%) rename core/sdk/src/test/{java => kotlin}/com/viam/sdk/core/component/board/BoardRPCServiceTest.kt (100%) rename core/sdk/src/test/{java => kotlin}/com/viam/sdk/core/component/board/BoardTest.kt (100%) rename core/sdk/src/test/{java => kotlin}/com/viam/sdk/core/component/gripper/GripperTest.kt (100%) rename core/sdk/src/test/{java => kotlin}/com/viam/sdk/core/component/motor/MotorRPCClientTest.kt (100%) rename core/sdk/src/test/{java => kotlin}/com/viam/sdk/core/component/motor/MotorRPCServiceTest.kt (100%) rename core/sdk/src/test/{java => kotlin}/com/viam/sdk/core/component/motor/MotorTest.kt (100%) diff --git a/build.gradle b/build.gradle index f2426b091..5086ecde5 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { } group 'com.viam' -version '0.0.4' +version '0.0.5-SNAPSHOT' repositories { google() diff --git a/core/sdk/src/main/java/com/viam/sdk/core/resource/ResourceManager.java b/core/sdk/src/main/java/com/viam/sdk/core/resource/ResourceManager.java index eb432bda3..a8815d59f 100644 --- a/core/sdk/src/main/java/com/viam/sdk/core/resource/ResourceManager.java +++ b/core/sdk/src/main/java/com/viam/sdk/core/resource/ResourceManager.java @@ -54,7 +54,7 @@ public class ResourceManager implements Closeable { // register well-known subtypes // COMPONENTS Registry.registerSubtype(new ResourceRegistration<>( - Board.getSUBTYPE(), + Board.SUBTYPE, BoardServiceGrpc.SERVICE_NAME, BoardRPCService::new, BoardRPCClient::new @@ -78,7 +78,7 @@ public class ResourceManager implements Closeable { GripperRPCClient::new )); Registry.registerSubtype(new ResourceRegistration<>( - Motor.getSUBTYPE(), + Motor.SUBTYPE, MotorServiceGrpc.SERVICE_NAME, MotorRPCService::new, MotorRPCClient::new diff --git a/core/sdk/src/main/java/com/viam/sdk/core/component/board/Board.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/Board.kt similarity index 99% rename from core/sdk/src/main/java/com/viam/sdk/core/component/board/Board.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/Board.kt index d262ac9ce..252546551 100644 --- a/core/sdk/src/main/java/com/viam/sdk/core/component/board/Board.kt +++ b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/Board.kt @@ -20,7 +20,7 @@ typealias Tick = StreamTicksResponse */ abstract class Board(name: String) : Component(SUBTYPE, named(name)) { companion object { - @JvmStatic + @JvmField val SUBTYPE = Subtype(Subtype.NAMESPACE_RDK, Subtype.RESOURCE_TYPE_COMPONENT, "board") diff --git a/core/sdk/src/main/java/com/viam/sdk/core/component/board/BoardRPCClient.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/BoardRPCClient.kt similarity index 100% rename from core/sdk/src/main/java/com/viam/sdk/core/component/board/BoardRPCClient.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/BoardRPCClient.kt diff --git a/core/sdk/src/main/java/com/viam/sdk/core/component/board/BoardRPCService.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/BoardRPCService.kt similarity index 98% rename from core/sdk/src/main/java/com/viam/sdk/core/component/board/BoardRPCService.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/BoardRPCService.kt index 8cc83df18..4f3581a19 100644 --- a/core/sdk/src/main/java/com/viam/sdk/core/component/board/BoardRPCService.kt +++ b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/board/BoardRPCService.kt @@ -13,7 +13,7 @@ import java.util.* import kotlin.time.DurationUnit import kotlin.time.toDuration -class BoardRPCService(private val manager: ResourceManager) : BoardServiceGrpc.BoardServiceImplBase(), +internal class BoardRPCService(private val manager: ResourceManager) : BoardServiceGrpc.BoardServiceImplBase(), ResourceRPCService { override fun setGPIO( diff --git a/core/sdk/src/main/java/com/viam/sdk/core/component/motor/Motor.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/Motor.kt similarity index 99% rename from core/sdk/src/main/java/com/viam/sdk/core/component/motor/Motor.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/Motor.kt index b0b274568..9f864e1d6 100644 --- a/core/sdk/src/main/java/com/viam/sdk/core/component/motor/Motor.kt +++ b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/Motor.kt @@ -6,7 +6,6 @@ import com.viam.sdk.core.component.Component import com.viam.sdk.core.resource.Resource import com.viam.sdk.core.resource.Subtype import com.viam.sdk.core.robot.RobotClient -import java.util.* /** * A [Motor] represents a physical motor @@ -17,7 +16,7 @@ abstract class Motor(name: String) : Component(SUBTYPE, named(name)) { value class Properties(val positionReporting: Boolean) companion object { - @JvmStatic + @JvmField val SUBTYPE = Subtype(Subtype.NAMESPACE_RDK, Subtype.RESOURCE_TYPE_COMPONENT, "motor") /** diff --git a/core/sdk/src/main/java/com/viam/sdk/core/component/motor/MotorRPCClient.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/MotorRPCClient.kt similarity index 100% rename from core/sdk/src/main/java/com/viam/sdk/core/component/motor/MotorRPCClient.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/MotorRPCClient.kt diff --git a/core/sdk/src/main/java/com/viam/sdk/core/component/motor/MotorRPCService.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/MotorRPCService.kt similarity index 97% rename from core/sdk/src/main/java/com/viam/sdk/core/component/motor/MotorRPCService.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/MotorRPCService.kt index 30ab7aa64..a3f052877 100644 --- a/core/sdk/src/main/java/com/viam/sdk/core/component/motor/MotorRPCService.kt +++ b/core/sdk/src/main/kotlin/com/viam/sdk/core/component/motor/MotorRPCService.kt @@ -8,7 +8,7 @@ import com.viam.sdk.core.resource.ResourceRPCService import io.grpc.stub.StreamObserver import java.util.* -class MotorRPCService(private val manager: ResourceManager) : MotorServiceGrpc.MotorServiceImplBase(), +internal class MotorRPCService(private val manager: ResourceManager) : MotorServiceGrpc.MotorServiceImplBase(), ResourceRPCService { override fun setPower( diff --git a/core/sdk/src/main/java/com/viam/sdk/core/util/Durations.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/util/Durations.kt similarity index 100% rename from core/sdk/src/main/java/com/viam/sdk/core/util/Durations.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/util/Durations.kt diff --git a/core/sdk/src/main/java/com/viam/sdk/core/util/Media.kt b/core/sdk/src/main/kotlin/com/viam/sdk/core/util/Media.kt similarity index 100% rename from core/sdk/src/main/java/com/viam/sdk/core/util/Media.kt rename to core/sdk/src/main/kotlin/com/viam/sdk/core/util/Media.kt diff --git a/core/sdk/src/test/java/com/viam/sdk/core/component/board/BoardRPCClientTest.kt b/core/sdk/src/test/kotlin/com/viam/sdk/core/component/board/BoardRPCClientTest.kt similarity index 100% rename from core/sdk/src/test/java/com/viam/sdk/core/component/board/BoardRPCClientTest.kt rename to core/sdk/src/test/kotlin/com/viam/sdk/core/component/board/BoardRPCClientTest.kt diff --git a/core/sdk/src/test/java/com/viam/sdk/core/component/board/BoardRPCServiceTest.kt b/core/sdk/src/test/kotlin/com/viam/sdk/core/component/board/BoardRPCServiceTest.kt similarity index 100% rename from core/sdk/src/test/java/com/viam/sdk/core/component/board/BoardRPCServiceTest.kt rename to core/sdk/src/test/kotlin/com/viam/sdk/core/component/board/BoardRPCServiceTest.kt diff --git a/core/sdk/src/test/java/com/viam/sdk/core/component/board/BoardTest.kt b/core/sdk/src/test/kotlin/com/viam/sdk/core/component/board/BoardTest.kt similarity index 100% rename from core/sdk/src/test/java/com/viam/sdk/core/component/board/BoardTest.kt rename to core/sdk/src/test/kotlin/com/viam/sdk/core/component/board/BoardTest.kt diff --git a/core/sdk/src/test/java/com/viam/sdk/core/component/gripper/GripperTest.kt b/core/sdk/src/test/kotlin/com/viam/sdk/core/component/gripper/GripperTest.kt similarity index 100% rename from core/sdk/src/test/java/com/viam/sdk/core/component/gripper/GripperTest.kt rename to core/sdk/src/test/kotlin/com/viam/sdk/core/component/gripper/GripperTest.kt diff --git a/core/sdk/src/test/java/com/viam/sdk/core/component/motor/MotorRPCClientTest.kt b/core/sdk/src/test/kotlin/com/viam/sdk/core/component/motor/MotorRPCClientTest.kt similarity index 100% rename from core/sdk/src/test/java/com/viam/sdk/core/component/motor/MotorRPCClientTest.kt rename to core/sdk/src/test/kotlin/com/viam/sdk/core/component/motor/MotorRPCClientTest.kt diff --git a/core/sdk/src/test/java/com/viam/sdk/core/component/motor/MotorRPCServiceTest.kt b/core/sdk/src/test/kotlin/com/viam/sdk/core/component/motor/MotorRPCServiceTest.kt similarity index 100% rename from core/sdk/src/test/java/com/viam/sdk/core/component/motor/MotorRPCServiceTest.kt rename to core/sdk/src/test/kotlin/com/viam/sdk/core/component/motor/MotorRPCServiceTest.kt diff --git a/core/sdk/src/test/java/com/viam/sdk/core/component/motor/MotorTest.kt b/core/sdk/src/test/kotlin/com/viam/sdk/core/component/motor/MotorTest.kt similarity index 100% rename from core/sdk/src/test/java/com/viam/sdk/core/component/motor/MotorTest.kt rename to core/sdk/src/test/kotlin/com/viam/sdk/core/component/motor/MotorTest.kt