diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..0dd4b35 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Kotlin2JvmCompilerArguments"> + <option name="jvmTarget" value="1.8" /> + </component> +</project> \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f05af3a..031fc3e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,7 +31,7 @@ android { dependencies { implementation project(':common') implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:design:26.1.0' diff --git a/build.gradle b/build.gradle index 0c22bfe..aefd73b 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.junit.platform:junit-platform-gradle-plugin:+" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -22,24 +23,31 @@ allprojects { } ext.kotlin_version = '1.2.21' - ext.commonJunitCompile = [ - "junit:junit:+", - "org.junit.jupiter:junit-jupiter-api:+", - "org.junit.platform:junit-platform-runner:+" - ] - - ext.commonJunitRuntime = [ - "org.junit.jupiter:junit-jupiter-engine:+", - ] } -//subprojects.findAll { !it.name.contains("app")}.each { p -> -// configure(p) { -// test { -// useJUnitPlatform() -// } -// } -//} +subprojects.findAll { it.name.equalsIgnoreCase("common") or it.name.equalsIgnoreCase("server")}.each { p -> + configure(p) { + apply plugin: 'kotlin' + apply plugin: 'org.junit.platform.gradle.plugin' + + dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"){ + because 'This is the latest version of kotlin?' + } + + implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"){ + because 'This is required by Jackson' + } + + testImplementation 'org.junit.jupiter:junit-jupiter-api:+' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:+' + } + + junitPlatform { + details 'tree' + } + } +} task clean(type: Delete) { delete rootProject.buildDir diff --git a/common/build.gradle b/common/build.gradle index 73bc9a7..853a778 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -4,26 +4,21 @@ buildscript { } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.junit.platform:junit-platform-gradle-plugin:+" } } group 'online.anthonycicchetti' version '0.1.0' +apply plugin: 'java-library' apply plugin: 'kotlin' -apply plugin: 'org.junit.platform.gradle.plugin' repositories { mavenCentral() } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.0' - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - testCompile commonJunitCompile - testRuntime commonJunitRuntime + api 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.+' } compileKotlin { @@ -32,7 +27,3 @@ compileKotlin { compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } - -junitPlatform { - details 'tree' -} \ No newline at end of file diff --git a/common/src/main/kotlin/Transaction.kt b/common/src/main/kotlin/Transaction.kt index 0df1e6b..2238e42 100644 --- a/common/src/main/kotlin/Transaction.kt +++ b/common/src/main/kotlin/Transaction.kt @@ -1,5 +1,3 @@ -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.* data class Transaction(val cost: Money, diff --git a/server/build.gradle b/server/build.gradle index 43ebd4b..1605ed9 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -25,11 +25,8 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile project(":common") - - testCompile commonJunitCompile - testRuntime commonJunitRuntime + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation project(":common") } compileKotlin { diff --git a/server/src/main/kotlin/Main.kt b/server/src/main/kotlin/Main.kt index 25c035f..a89c953 100644 --- a/server/src/main/kotlin/Main.kt +++ b/server/src/main/kotlin/Main.kt @@ -1,6 +1,3 @@ -import com.fasterxml.jackson.core.JsonFactory -import com.fasterxml.jackson.core.JsonGenerator - fun main(args: Array<String>) { println(Transaction(Money(3020), category = "Transportation", location = "Arian's", timestamp = "Jan 01, 2018 00:00"))