Skip to content

Commit

Permalink
Merge pull request #13 from Pattonville-Robotics/java8-kotlin-support
Browse files Browse the repository at this point in the history
Java8 kotlin support
  • Loading branch information
greg-bahr authored Nov 4, 2017
2 parents b46ac65 + 82e0c18 commit faa31b1
Show file tree
Hide file tree
Showing 10 changed files with 380 additions and 390 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* It is extraordinarily rare that you will ever need to edit this file.
*/
buildscript {
ext.kotlin_version = '1.1.51'
ext.ftc_version = '3.5'

repositories {
Expand All @@ -13,6 +14,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand Down
48 changes: 12 additions & 36 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//apply from: '../build.common.gradle'

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.dcendents.android-maven'

android {
Expand All @@ -30,37 +31,30 @@ android {

defaultConfig {
minSdkVersion 19
targetSdkVersion 26
targetSdkVersion 19

versionName "$ftc_version.2"
versionCode 6
versionCode 8
}

// Advanced user code might just want to use Vuforia directly, so we set up the libs as needed
buildTypes {
release {
debuggable true
ndk {
abiFilters "armeabi-v7a"
}

//minifyEnabled true
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
ndk {
abiFilters "armeabi-v7a"
}

//minifyEnabled true
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
Expand All @@ -78,25 +72,16 @@ version = android.defaultConfig.versionName
project.archivesBaseName = 'Common-Code'

dependencies {
implementation "org.first.ftc:inspection:$ftc_version"
implementation "org.first.ftc:blocks:$ftc_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

implementation "org.first.ftc:robotcore:$ftc_version"
implementation "org.first.ftc:hardware:$ftc_version"
implementation "org.first.ftc:ftc-common:$ftc_version"
implementation "org.first.ftc:analytics:$ftc_version"
implementation "org.first.ftc:wireless-p2p:$ftc_version"

// https://mvnrepository.com/artifact/org.apache.commons/commons-math3
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'

// https://mvnrepository.com/artifact/com.annimon/stream
implementation group: 'com.annimon', name: 'stream', version: '1.1.8'

// https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'

// https://mvnrepository.com/artifact/com.google.guava/guava
implementation group: 'com.google.guava', name: 'guava', version: '23.2-android'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.annimon:stream:1.1.8'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.google.guava:guava:23.2-android'
}

//For JitPack
Expand All @@ -123,13 +108,4 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
artifacts {
archives sourcesJar
archives javadocJar
}
/*
android.libraryVariants.all { variant ->
def name = variant.buildType.name
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompiler
task.from variant.javaCompiler.destinationDir
artifacts.add 'archives', task
}
*/
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.pattonvillerobotics.commoncode.opmodes

import com.qualcomm.robotcore.eventloop.opmode.Disabled
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
import com.qualcomm.robotcore.eventloop.opmode.TeleOp
import com.qualcomm.robotcore.hardware.CRServo
import org.pattonvillerobotics.commoncode.robotclasses.gamepad.GamepadData.Button.*
import org.pattonvillerobotics.commoncode.robotclasses.gamepad.ListenableButton.ButtonState.JUST_PRESSED
import org.pattonvillerobotics.commoncode.robotclasses.gamepad.ListenableGamepad

/**
* Created by bahrg on 3/16/17.
*/
@TeleOp(name = "CRServoTest1")
@Disabled
class CRServoTest : LinearOpMode() {

private lateinit var crServo: CRServo
private lateinit var gamepad: ListenableGamepad

override fun runOpMode() {
crServo = hardwareMap.crservo.get("crservo")
gamepad = ListenableGamepad()
gamepad.getButton(A).addListener(JUST_PRESSED) { crServo.power = 1.0 }

gamepad.getButton(B).addListener(JUST_PRESSED) { crServo.power = 0.0 }

gamepad.getButton(X).addListener(JUST_PRESSED) { crServo.power = -1.0 }
waitForStart()

while (opModeIsActive()) {
gamepad.update(gamepad1)
}
}
}

This file was deleted.

Loading

0 comments on commit faa31b1

Please sign in to comment.