diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 7732d0fd9..000000000 --- a/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -plugins { - id 'com.android.application' version "4.1.0" apply false - id "org.jetbrains.kotlin.android" version "$KOTLIN_VERSION" apply false - id "org.jetbrains.kotlin.kapt" version "$KOTLIN_VERSION" apply false - id "org.jetbrains.kotlin.android.extensions" version "$KOTLIN_VERSION" apply false - id "org.jetbrains.kotlin.multiplatform" version "1.4.21" apply false - id "org.jlleitschuh.gradle.ktlint" version "9.4.1" -} - -// Needed for ktlint. Taken from: https://github.com/JLLeitschuh/ktlint-gradle/issues/181#issuecomment-443146206 -allprojects { - repositories { - mavenCentral() - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..6edb7ff9d --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + val kotlinVersion = "1.4.21" + id("com.android.application") version ("4.1.0") apply (false) + id("org.jetbrains.kotlin.android") version kotlinVersion apply (false) + id("org.jetbrains.kotlin.kapt") version kotlinVersion apply (false) + id("org.jetbrains.kotlin.android.extensions") version kotlinVersion apply (false) + id("org.jetbrains.kotlin.multiplatform") version kotlinVersion apply (false) + id("org.jlleitschuh.gradle.ktlint") version "9.4.1" +} + +allprojects { + repositories { + google() + jcenter() + mavenCentral() + maven(url = "https://plugins.gradle.org/m2/") + maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") + maven(url = "https://kotlin.bintray.com/ktor") + maven(url = "https://kotlin.bintray.com/kotlin-js-wrappers") + } +} diff --git a/gradle.properties b/gradle.properties index f961b8b49..a1f977f3b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,3 @@ -VERSION_CODE = 20001 -VERSION_NAME = 2.0.1-alpha - -MIN_SDK_VERSION = 23 -TARGET_SDK_VERSION = 29 -COMPILE_SDK_VERSION = 29 - -DAGGER_VERSION = 2.25.4 -KOTLIN_VERSION = 1.4.21 -KX_COROUTINES_VERSION = 1.4.2 -SUPPORT_LIBRARY_VERSION = 28.0.0 -AUTO_FACTORY_VERSION = 1.0-beta6 -BUILD_TOOLS_VERSION = 4.0.0 -KTOR_VERSION=1.4.2 -ESPRESSO_VERSION=3.3.0 - org.gradle.parallel=false org.gradle.daemon=true org.gradle.jvmargs=-Xms2048m -Xmx2048m -XX:MaxPermSize=2048m diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2aa714b7c..172cea8c2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 38441a14f..000000000 --- a/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - jcenter() - google() - } - resolutionStrategy { - eachPlugin { - if (requested.id.id == "com.android.application") { - useModule("com.android.tools.build:gradle:${requested.version}") - } - } - } -} - -include ':uhabits-android', ':uhabits-core', ':uhabits-server' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..82351e167 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,14 @@ +pluginManagement { + repositories { + gradlePluginPortal() + jcenter() + google() + } + resolutionStrategy.eachPlugin { + if (requested.id.id == "com.android.application") { + useModule("com.android.tools.build:gradle:${requested.version}") + } + } +} + +include(":uhabits-android", ":uhabits-core", ":uhabits-server") diff --git a/uhabits-android/build.gradle b/uhabits-android/build.gradle deleted file mode 100644 index 7e71dc4d3..000000000 --- a/uhabits-android/build.gradle +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2016-2021 Álinson Santos Xavier - * - * This file is part of Loop Habit Tracker. - * - * Loop Habit Tracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * Loop Habit Tracker is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -plugins { - id 'com.github.triplet.play' version '3.1.0' - id 'com.android.application' - id "org.jetbrains.kotlin.android" - id "org.jetbrains.kotlin.kapt" - id "org.jetbrains.kotlin.android.extensions" - id "org.jlleitschuh.gradle.ktlint" -} - -repositories { - google() - jcenter() -} - -android { - compileSdkVersion COMPILE_SDK_VERSION as Integer - - def secretPropsFile = file(".secret/gradle.properties") - if (secretPropsFile.exists()) { - def secrets = new Properties() - secretPropsFile.withInputStream { secrets.load(it) } - signingConfigs { - release { - storeFile file(secrets.LOOP_KEY_STORE) - storePassword secrets.LOOP_STORE_PASSWORD - keyAlias secrets.LOOP_KEY_ALIAS - keyPassword secrets.LOOP_KEY_PASSWORD - } - } - buildTypes.release.signingConfig signingConfigs.release - } - - defaultConfig { - versionCode VERSION_CODE as Integer - versionName "$VERSION_NAME" - minSdkVersion MIN_SDK_VERSION as Integer - targetSdkVersion TARGET_SDK_VERSION as Integer - applicationId "org.isoron.uhabits" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - - debug { - testCoverageEnabled true - } - } - - lintOptions { - checkReleaseBuilds false - abortOnError false - disable 'GoogleAppIndexingWarning' - } - - compileOptions { - coreLibraryDesugaringEnabled true - targetCompatibility JavaVersion.VERSION_1_8 - sourceCompatibility JavaVersion.VERSION_1_8 - } - - buildFeatures { - viewBinding true - } -} - -dependencies { - androidTestImplementation "androidx.test.espresso:espresso-contrib:$ESPRESSO_VERSION" - androidTestImplementation "androidx.test.espresso:espresso-core:$ESPRESSO_VERSION" - androidTestImplementation "com.google.dagger:dagger:$DAGGER_VERSION" - androidTestImplementation "com.linkedin.dexmaker:dexmaker-mockito:2.28.0" - androidTestImplementation "com.linkedin.testbutler:test-butler-library:1.3.1" - androidTestImplementation "io.ktor:ktor-client-mock:$KTOR_VERSION" - androidTestImplementation "io.ktor:ktor-jackson:$KTOR_VERSION" - androidTestImplementation "org.mockito:mockito-core:2.28.2" - androidTestImplementation 'androidx.annotation:annotation:1.1.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' - androidTestImplementation 'androidx.test:rules:1.3.0' - compileOnly "javax.annotation:jsr250-api:1.0" - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1' - implementation "com.github.paolorotolo:appintro:3.4.0" - implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation "com.google.dagger:dagger:$DAGGER_VERSION" - implementation "com.google.guava:guava:30.0-android" - implementation "io.ktor:ktor-client-android:$KTOR_VERSION" - implementation "io.ktor:ktor-client-core:$KTOR_VERSION" - implementation "io.ktor:ktor-client-jackson:$KTOR_VERSION" - implementation "io.ktor:ktor-client-json:$KTOR_VERSION" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$KX_COROUTINES_VERSION" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$KX_COROUTINES_VERSION" - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.legacy:legacy-preference-v14:1.0.0' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.google.android.material:material:1.2.1' - implementation 'com.google.zxing:core:3.4.1' - implementation 'com.opencsv:opencsv:3.10' - implementation project(":uhabits-core") - kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" - kaptAndroidTest "com.google.dagger:dagger-compiler:$DAGGER_VERSION" - testImplementation "com.google.dagger:dagger:$DAGGER_VERSION" - testImplementation "junit:junit:4.12" - testImplementation "org.mockito:mockito-core:2.28.2" - testImplementation "org.mockito:mockito-inline:2.8.9" - testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" -} - -kapt { - correctErrorTypes = true -} - -play { - serviceAccountCredentials = file("../.secret/gcp-key.json") - track = "alpha" -} diff --git a/uhabits-android/build.gradle.kts b/uhabits-android/build.gradle.kts new file mode 100644 index 000000000..ace9d2289 --- /dev/null +++ b/uhabits-android/build.gradle.kts @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2016-2021 Álinson Santos Xavier + * + * This file is part of Loop Habit Tracker. + * + * Loop Habit Tracker is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Loop Habit Tracker is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +plugins { + id("com.github.triplet.play") version "3.2.0" + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("org.jetbrains.kotlin.kapt") + id("org.jetbrains.kotlin.android.extensions") + id("org.jlleitschuh.gradle.ktlint") +} + +android { + compileSdkVersion(29) + + defaultConfig { + versionCode(20001) + versionName("2.0.1-alpha") + minSdkVersion(23) + targetSdkVersion(29) + applicationId("org.isoron.uhabits") + testInstrumentationRunner("androidx.test.runner.AndroidJUnitRunner") + } + + buildTypes { + getByName("release") { + minifyEnabled(true) + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.txt") + } + + getByName("debug") { + isTestCoverageEnabled = true + } + } + + lintOptions { + isCheckReleaseBuilds = false + isAbortOnError = false + disable("GoogleAppIndexingWarning") + } + + compileOptions { + isCoreLibraryDesugaringEnabled = true + targetCompatibility(JavaVersion.VERSION_1_8) + sourceCompatibility(JavaVersion.VERSION_1_8) + } + + buildFeatures { + viewBinding = true + } +} + +dependencies { + val daggerVersion = "2.25.4" + val kotlinVersion = "1.4.21" + val kxCoroutinesVersion = "1.4.2" + val ktorVersion = "1.4.2" + val espressoVersion = "3.3.0" + + androidTestImplementation("androidx.test.espresso:espresso-contrib:$espressoVersion") + androidTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion") + androidTestImplementation("com.google.dagger:dagger:$daggerVersion") + androidTestImplementation("com.linkedin.dexmaker:dexmaker-mockito:2.28.0") + androidTestImplementation("com.linkedin.testbutler:test-butler-library:1.3.1") + androidTestImplementation("io.ktor:ktor-client-mock:$ktorVersion") + androidTestImplementation("io.ktor:ktor-jackson:$ktorVersion") + androidTestImplementation("org.mockito:mockito-core:2.28.2") + androidTestImplementation("androidx.annotation:annotation:1.1.0") + androidTestImplementation("androidx.test.ext:junit:1.1.2") + androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0") + androidTestImplementation("androidx.test:rules:1.3.0") + compileOnly("javax.annotation:jsr250-api:1.0") + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.1") + implementation("com.github.paolorotolo:appintro:3.4.0") + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.dagger:dagger:$daggerVersion") + implementation("com.google.guava:guava:30.0-android") + implementation("io.ktor:ktor-client-android:$ktorVersion") + implementation("io.ktor:ktor-client-core:$ktorVersion") + implementation("io.ktor:ktor-client-jackson:$ktorVersion") + implementation("io.ktor:ktor-client-json:$ktorVersion") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$kxCoroutinesVersion") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kxCoroutinesVersion") + implementation("androidx.appcompat:appcompat:1.2.0") + implementation("androidx.legacy:legacy-preference-v14:1.0.0") + implementation("androidx.legacy:legacy-support-v4:1.0.0") + implementation("com.google.android.material:material:1.2.1") + implementation("com.google.zxing:core:3.4.1") + implementation("com.opencsv:opencsv:3.10") + implementation(project(":uhabits-core")) + kapt("com.google.dagger:dagger-compiler:$daggerVersion") + kaptAndroidTest("com.google.dagger:dagger-compiler:$daggerVersion") + testImplementation("com.google.dagger:dagger:$daggerVersion") + testImplementation("junit:junit:4.12") + testImplementation("org.mockito:mockito-core:2.28.2") + testImplementation("org.mockito:mockito-inline:2.8.9") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") +} + +kapt { + correctErrorTypes = true +} + +play { + serviceAccountCredentials.set(file("../.secret/gcp-key.json")) + track.set("alpha") +} diff --git a/uhabits-core/build.gradle b/uhabits-core/build.gradle deleted file mode 100644 index 2a577424a..000000000 --- a/uhabits-core/build.gradle +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2016-2021 Álinson Santos Xavier - * - * This file is part of Loop Habit Tracker. - * - * Loop Habit Tracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * Loop Habit Tracker is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -plugins { - id "org.jetbrains.kotlin.multiplatform" - id "org.jlleitschuh.gradle.ktlint" -} - -repositories { - google() - jcenter() - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } -} - -kotlin { - jvm { - withJava() - } - - sourceSets { - commonMain { - dependencies { - implementation kotlin('stdlib-common') - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.8" - } - } - - commonTest { - dependencies { - implementation kotlin('test-common') - implementation kotlin('test-annotations-common') - } - } - - jvmMain { - dependencies { - implementation kotlin('stdlib-jdk8') - compileOnly "com.google.dagger:dagger:$DAGGER_VERSION" - implementation "com.google.guava:guava:30.0-jre" - implementation "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$KX_COROUTINES_VERSION" - implementation 'androidx.annotation:annotation:1.1.0' - implementation 'com.google.code.findbugs:jsr305:3.0.2' - implementation 'com.opencsv:opencsv:3.10' - implementation 'commons-codec:commons-codec:1.15' - implementation 'org.apache.commons:commons-lang3:3.5' - } - } - - jvmTest { - dependencies { - implementation kotlin('test') - implementation kotlin('test-junit') - implementation 'org.xerial:sqlite-jdbc:3.25.2' - implementation 'org.hamcrest:hamcrest:2.1' - implementation 'nl.jqno.equalsverifier:equalsverifier:2.4.8' - implementation 'org.apache.commons:commons-io:1.3.2' - implementation 'org.mockito:mockito-core:2.28.2' - implementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" - } - } - } -} diff --git a/uhabits-core/build.gradle.kts b/uhabits-core/build.gradle.kts new file mode 100644 index 000000000..07a39523c --- /dev/null +++ b/uhabits-core/build.gradle.kts @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2016-2021 Álinson Santos Xavier + * + * This file is part of Loop Habit Tracker. + * + * Loop Habit Tracker is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Loop Habit Tracker is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +plugins { + kotlin("multiplatform") + id("org.jlleitschuh.gradle.ktlint") +} + +kotlin { + jvm().withJava() + + sourceSets { + val commonMain by getting { + dependencies { + implementation(kotlin("stdlib-common")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.8") + } + } + + val commonTest by getting { + dependencies { + implementation(kotlin("test-common")) + implementation(kotlin("test-annotations-common")) + } + } + + val jvmMain by getting { + dependencies { + implementation(kotlin("stdlib-jdk8")) + compileOnly("com.google.dagger:dagger:2.25.4") + implementation("com.google.guava:guava:30.0-jre") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.21") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.2") + implementation("androidx.annotation:annotation:1.1.0") + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.opencsv:opencsv:3.10") + implementation("commons-codec:commons-codec:1.15") + implementation("org.apache.commons:commons-lang3:3.5") + } + } + + val jvmTest by getting { + dependencies { + implementation(kotlin("test")) + implementation(kotlin("test-junit")) + implementation("org.xerial:sqlite-jdbc:3.25.2") + implementation("org.hamcrest:hamcrest:2.1") + implementation("nl.jqno.equalsverifier:equalsverifier:2.4.8") + implementation("org.apache.commons:commons-io:1.3.2") + implementation("org.mockito:mockito-core:2.28.2") + implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") + } + } + } +} diff --git a/uhabits-server/build.gradle b/uhabits-server/build.gradle deleted file mode 100644 index f108d6a21..000000000 --- a/uhabits-server/build.gradle +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2016-2021 Álinson Santos Xavier - * - * This file is part of Loop Habit Tracker. - * - * Loop Habit Tracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * Loop Habit Tracker is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -buildscript { - repositories { - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.github.jengelman.gradle.plugins:shadow:5.2.0" - classpath "com.palantir.gradle.docker:gradle-docker:0.25.0" - } -} - -apply plugin: 'kotlin' -apply plugin: "com.github.johnrengelman.shadow" -apply plugin: 'application' -apply plugin: "com.palantir.docker" -apply plugin: "com.palantir.docker-run" - -group 'org.isoron.uhabits' -version '0.0.1' -mainClassName = "io.ktor.server.netty.EngineMain" - -sourceSets { - main.kotlin.srcDirs = main.java.srcDirs = ['src'] - test.kotlin.srcDirs = test.java.srcDirs = ['test'] - main.resources.srcDirs = ['resources'] - test.resources.srcDirs = ['testresources'] -} - -repositories { - mavenLocal() - jcenter() - maven { url 'https://kotlin.bintray.com/ktor' } - maven { url 'https://kotlin.bintray.com/kotlin-js-wrappers' } -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation "io.ktor:ktor-server-netty:$ktor_version" - implementation "ch.qos.logback:logback-classic:$logback_version" - implementation "io.ktor:ktor-server-core:$ktor_version" - implementation "io.ktor:ktor-html-builder:$ktor_version" - implementation "io.ktor:ktor-jackson:$ktor_version" - implementation "org.jetbrains:kotlin-css-jvm:1.0.0-pre.31-kotlin-1.2.41" - implementation "io.prometheus:simpleclient:0.9.0" - implementation "io.prometheus:simpleclient_httpserver:0.9.0" - implementation "io.prometheus:simpleclient_hotspot:0.9.0" - testImplementation "io.ktor:ktor-server-tests:$ktor_version" - testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" -} - -shadowJar { - baseName = 'uhabits-server' - classifier = null - version = null -} - -docker { - name = "docker.axavier.org/uhabits-server:$version" - files "build/libs/uhabits-server.jar" -} - -dockerRun { - name = 'uhabits-server' - image "uhabits-server:$version" - ports '8080:8080' - daemonize false - clean true -} diff --git a/uhabits-server/build.gradle.kts b/uhabits-server/build.gradle.kts new file mode 100644 index 000000000..858446c89 --- /dev/null +++ b/uhabits-server/build.gradle.kts @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2016-2021 Álinson Santos Xavier + * + * This file is part of Loop Habit Tracker. + * + * Loop Habit Tracker is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Loop Habit Tracker is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +plugins { + application + id("kotlin") + id("com.github.johnrengelman.shadow") version "6.1.0" +} + + +application { + group = "org.isoron.uhabits" + version = "0.0.1" + mainClassName = "io.ktor.server.netty.EngineMain" +} + +dependencies { + val ktorVersion = "1.4.1" + val kotlinVersion = "1.4.21" + val logbackVersion = "1.2.1" + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") + implementation("io.ktor:ktor-server-netty:$ktorVersion") + implementation("ch.qos.logback:logback-classic:$logbackVersion") + implementation("io.ktor:ktor-server-core:$ktorVersion") + implementation("io.ktor:ktor-html-builder:$ktorVersion") + implementation("io.ktor:ktor-jackson:$ktorVersion") + implementation("org.jetbrains:kotlin-css-jvm:1.0.0-pre.31-kotlin-1.2.41") + implementation("io.prometheus:simpleclient:0.9.0") + implementation("io.prometheus:simpleclient_httpserver:0.9.0") + implementation("io.prometheus:simpleclient_hotspot:0.9.0") + testImplementation("io.ktor:ktor-server-tests:$ktorVersion") + testImplementation("org.mockito:mockito-core:2.28.2") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") +} + +tasks.withType { + archiveBaseName.set("uhabits-server") + archiveClassifier.set("") + archiveVersion.set("") +} diff --git a/uhabits-server/gradle.properties b/uhabits-server/gradle.properties deleted file mode 100644 index b7300cbf9..000000000 --- a/uhabits-server/gradle.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2016-2021 Álinson Santos Xavier -# -# This file is part of Loop Habit Tracker. -# -# Loop Habit Tracker is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# Loop Habit Tracker is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# - -ktor_version=1.4.1 -kotlin.code.style=official -kotlin_version=1.4.21 -logback_version=1.2.1 diff --git a/uhabits-server/src/org/isoron/uhabits/sync/SyncData.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/SyncData.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/SyncData.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/SyncData.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/SyncException.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/SyncException.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/SyncException.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/SyncException.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/app/LinkModule.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/LinkModule.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/app/LinkModule.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/LinkModule.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/app/MetricsModule.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/MetricsModule.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/app/MetricsModule.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/MetricsModule.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/app/RegistrationModule.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/RegistrationModule.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/app/RegistrationModule.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/RegistrationModule.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/app/StorageModule.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/StorageModule.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/app/StorageModule.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/StorageModule.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/app/SyncApplication.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/SyncApplication.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/app/SyncApplication.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/app/SyncApplication.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/links/Link.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/links/Link.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/links/Link.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/links/Link.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/links/LinkManager.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/links/LinkManager.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/links/LinkManager.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/links/LinkManager.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/repository/FileRepository.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/repository/FileRepository.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/repository/FileRepository.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/repository/FileRepository.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/repository/Repository.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/repository/Repository.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/repository/Repository.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/repository/Repository.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/server/AbstractSyncServer.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/server/AbstractSyncServer.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/server/AbstractSyncServer.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/server/AbstractSyncServer.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/server/RepositorySyncServer.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/server/RepositorySyncServer.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/server/RepositorySyncServer.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/server/RepositorySyncServer.kt diff --git a/uhabits-server/src/org/isoron/uhabits/sync/utils/String.kt b/uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/utils/String.kt similarity index 100% rename from uhabits-server/src/org/isoron/uhabits/sync/utils/String.kt rename to uhabits-server/src/main/kotlin/org/isoron/uhabits/sync/utils/String.kt diff --git a/uhabits-server/resources/application.conf b/uhabits-server/src/main/resources/application.conf similarity index 100% rename from uhabits-server/resources/application.conf rename to uhabits-server/src/main/resources/application.conf diff --git a/uhabits-server/resources/logback.xml b/uhabits-server/src/main/resources/logback.xml similarity index 100% rename from uhabits-server/resources/logback.xml rename to uhabits-server/src/main/resources/logback.xml diff --git a/uhabits-server/test/org/isoron/uhabits/sync/app/BaseApplicationTest.kt b/uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/BaseApplicationTest.kt similarity index 100% rename from uhabits-server/test/org/isoron/uhabits/sync/app/BaseApplicationTest.kt rename to uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/BaseApplicationTest.kt diff --git a/uhabits-server/test/org/isoron/uhabits/sync/app/LinksModuleTest.kt b/uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/LinksModuleTest.kt similarity index 100% rename from uhabits-server/test/org/isoron/uhabits/sync/app/LinksModuleTest.kt rename to uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/LinksModuleTest.kt diff --git a/uhabits-server/test/org/isoron/uhabits/sync/app/RegistrationModuleTest.kt b/uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/RegistrationModuleTest.kt similarity index 100% rename from uhabits-server/test/org/isoron/uhabits/sync/app/RegistrationModuleTest.kt rename to uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/RegistrationModuleTest.kt diff --git a/uhabits-server/test/org/isoron/uhabits/sync/app/StorageModuleTest.kt b/uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/StorageModuleTest.kt similarity index 100% rename from uhabits-server/test/org/isoron/uhabits/sync/app/StorageModuleTest.kt rename to uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/app/StorageModuleTest.kt diff --git a/uhabits-server/test/org/isoron/uhabits/sync/links/LinkManagerTest.kt b/uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/links/LinkManagerTest.kt similarity index 100% rename from uhabits-server/test/org/isoron/uhabits/sync/links/LinkManagerTest.kt rename to uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/links/LinkManagerTest.kt diff --git a/uhabits-server/test/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt b/uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt similarity index 100% rename from uhabits-server/test/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt rename to uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt diff --git a/uhabits-server/test/org/isoron/uhabits/sync/server/RepositorySyncServerTest.kt b/uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/server/RepositorySyncServerTest.kt similarity index 100% rename from uhabits-server/test/org/isoron/uhabits/sync/server/RepositorySyncServerTest.kt rename to uhabits-server/src/test/kotlin/org/isoron/uhabits/sync/server/RepositorySyncServerTest.kt