Skip to content

Commit 92d7e5b

Browse files
committed
Updated project to use latest versions of the tools including migration into kotlin
1 parent 8bc8d66 commit 92d7e5b

16 files changed

+140
-147
lines changed

Diff for: app/build.gradle

+33-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
24

35
android {
4-
compileSdkVersion 28
6+
compileSdkVersion 29
7+
buildToolsVersion "29.0.3"
58

69
defaultConfig {
710
applicationId "acm.androidfitnesseexample"
8-
minSdkVersion 24
9-
targetSdkVersion 28
11+
minSdkVersion 26
12+
targetSdkVersion 29
1013
versionCode 1
1114
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
compileOptions {
20+
sourceCompatibility = JavaVersion.VERSION_1_8
21+
targetCompatibility = JavaVersion.VERSION_1_8
22+
}
23+
24+
kotlinOptions {
25+
jvmTarget = JavaVersion.VERSION_1_8.toString()
1226
}
27+
1328
buildTypes {
1429
release {
1530
minifyEnabled false
16-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
1732
}
1833
}
1934
}
2035

2136
dependencies {
22-
implementation fileTree(dir: 'libs', include: ['*.jar'])
23-
implementation 'com.android.support:appcompat-v7:28.0.0'
24-
}
37+
implementation 'org.fitnesse:fitnesse:20200501'
38+
39+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
40+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7"
41+
42+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
43+
implementation 'androidx.core:core-ktx:1.3.0'
44+
implementation 'androidx.appcompat:appcompat:1.1.0'
45+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
46+
testImplementation 'junit:junit:4.13'
47+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
48+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
49+
50+
}

Diff for: app/src/androidTest/java/acm/androidfitnesseexample/ApplicationTest.java

-13
This file was deleted.

Diff for: app/src/main/java/acm/androidfitnesseexample/AndroidFitnesseExampleApplication.java

-35
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package acm.androidfitnesseexample
2+
3+
import android.app.Application
4+
import fitnesse.slim.JavaSlimFactory
5+
import fitnesse.slim.SlimService
6+
import kotlinx.coroutines.CoroutineScope
7+
import kotlinx.coroutines.Dispatchers
8+
import kotlinx.coroutines.GlobalScope
9+
import kotlinx.coroutines.launch
10+
import java.io.IOException
11+
12+
class AndroidFitnesseExampleApplication : Application() {
13+
override fun onCreate() {
14+
super.onCreate()
15+
launchFitnesseServer()
16+
}
17+
18+
private fun launchFitnesseServer() {
19+
val options = SlimService.parseCommandLine(arrayOf("-v", "-d", "8099"))
20+
GlobalScope.launch {
21+
try {
22+
SlimService.startWithFactory(JavaSlimFactory.createJavaSlimFactory(options), options)
23+
} catch (e: IOException) {
24+
e.printStackTrace()
25+
}
26+
}
27+
}
28+
}

Diff for: app/src/main/java/acm/androidfitnesseexample/DefaultActivity.java

-22
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package acm.androidfitnesseexample
2+
3+
import android.app.Activity
4+
import android.os.Bundle
5+
import android.widget.TextView
6+
7+
class DefaultActivity : Activity(), MessageInterface {
8+
9+
private var mMessage: TextView? = null
10+
11+
override fun onCreate(savedInstanceState: Bundle?) {
12+
super.onCreate(savedInstanceState)
13+
setContentView(R.layout.activity_default)
14+
mMessage = findViewById(R.id.message)
15+
}
16+
17+
override fun showMessage(text: String) {
18+
mMessage!!.text = text
19+
}
20+
}

Diff for: app/src/main/java/acm/androidfitnesseexample/MessageInterface.java

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package acm.androidfitnesseexample
2+
3+
interface MessageInterface {
4+
fun showMessage(text: String)
5+
}

Diff for: app/src/main/java/acm/androidfitnesseexample/MessagePresenter.java

-23
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package acm.androidfitnesseexample
2+
3+
class MessagePresenter(private val mMessageInterface: MessageInterface) {
4+
private var mText: String? = null
5+
fun read(text: String?) {
6+
mText = text
7+
}
8+
9+
fun produceAnswer() {
10+
mText?.let {
11+
mMessageInterface.showMessage(it)
12+
}
13+
}
14+
15+
}

Diff for: app/src/main/java/fixtures/SayHelloFixture.java

-34
This file was deleted.

Diff for: app/src/main/java/fixtures/SayHelloFixture.kt

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package fixtures
2+
3+
import acm.androidfitnesseexample.MessageInterface
4+
import acm.androidfitnesseexample.MessagePresenter
5+
6+
class SayHelloFixture : MessageInterface {
7+
8+
private var mMessage: String? = null
9+
10+
private val mMessagePresenter: MessagePresenter = MessagePresenter(this)
11+
12+
fun iSay(text: String?) {
13+
mMessagePresenter.read(text)
14+
}
15+
16+
fun waitingForAnswer() {
17+
mMessagePresenter.produceAnswer()
18+
}
19+
20+
fun answer(): String? {
21+
return mMessage
22+
}
23+
24+
override fun showMessage(text: String) {
25+
mMessage = text
26+
}
27+
28+
}

Diff for: build.gradle

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
32
buildscript {
3+
ext.kotlin_version = "1.3.72"
44
repositories {
55
google()
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.4.0-alpha10'
9+
classpath "com.android.tools.build:gradle:4.0.0"
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1011

1112
// NOTE: Do not place your application dependencies here; they belong
1213
// in the individual module build.gradle files
@@ -17,5 +18,9 @@ allprojects {
1718
repositories {
1819
google()
1920
jcenter()
20-
}
21+
}
2122
}
23+
24+
task clean(type: Delete) {
25+
delete rootProject.buildDir
26+
}

Diff for: fitnesse/fitnesse-standalone.jar

-142 KB
Binary file not shown.

Diff for: gradle.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
18+
# org.gradle.parallel=true
19+
android.useAndroidX=true

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-milestone-1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-milestone-1-all.zip
77

0 commit comments

Comments
 (0)