Skip to content

Commit

Permalink
chore: setup compose (#56)
Browse files Browse the repository at this point in the history
* chore: setup compose

* fix: remove deprecated tests
  • Loading branch information
adrielcafe authored Oct 14, 2020
1 parent bf0d4d4 commit 3ee0cea
Show file tree
Hide file tree
Showing 38 changed files with 169 additions and 1,105 deletions.
19 changes: 17 additions & 2 deletions android-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,30 @@ android {
}

testOptions {

unitTests {
includeAndroidResources = true
unitTests.returnDefaultValues = true
}
}

kotlinOptions {
useIR = true
jvmTarget = '1.8'
freeCompilerArgs = ["-Xinline-classes"]
freeCompilerArgs = ["-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn"]
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
compose true
}

composeOptions {
kotlinCompilerExtensionVersion Versions.compose
kotlinCompilerVersion '1.4.0'
}
}

Expand Down
7 changes: 7 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,10 @@ configurations.all {
forcedModules = AndroidModule.main.toArray()
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
}
}

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/test/java/com/jcaique/dialetus/ExampleUnitTest.kt

This file was deleted.

8 changes: 2 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buildscript {
jcenter()
mavenLocal()
maven { url 'https://kotlin.bintray.com/kotlinx' }
maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://dl.bintray.com/android/android-tools' }
Expand All @@ -30,18 +31,13 @@ allprojects {
jcenter()
mavenLocal()
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
maven { url 'https://jitpack.io' }
}

detekt {
config = files("${rootDir}/detekt.yml")
}

configurations.all {
resolutionStrategy {
force 'androidx.constraintlayout:constraintlayout:1.1.3'
}
}
}

task clean(type: Delete) {
Expand Down
13 changes: 10 additions & 3 deletions buildSrc/src/main/java/dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ object Versions {
const val androidxConstraintLayout = "2.0.0-beta2"

const val androidxLifecycle = "2.1.0"

const val compose = "1.0.0-alpha04"

const val firebaseCrashlytics = "2.10.1"

Expand Down Expand Up @@ -63,6 +65,10 @@ object Dependencies {
val androidxLifecycleCommonJava8 = "androidx.lifecycle:lifecycle-common-java8:${Versions.androidxLifecycle}"
val androidxLifecycleExtensions = "androidx.lifecycle:lifecycle-extensions:${Versions.androidxLifecycle}"

val composeUi = "androidx.compose.ui:ui:${Versions.compose}"
val composeMaterial = "androidx.compose.material:material:${Versions.compose}"
val composeTooling = "androidx.ui:ui-tooling:${Versions.compose}"

val androidTestCore = "androidx.test:core:${Versions.androidJUnit}"
val androidTestCoreKtx = "androidx.test:core-ktx:${Versions.androidJUnit}"
val androidTestExtJunit = "androidx.test.ext:junit:${Versions.androidJUnit}"
Expand Down Expand Up @@ -126,14 +132,15 @@ object AndroidModule {
val main = listOf(
Dependencies.kotlinStdlib,
Dependencies.androidxActivity,
Dependencies.androidxCardView,
Dependencies.androidxRecyclerView,
Dependencies.androidxLifecycleExtensions,
Dependencies.androidxLifecycleViewModel,
Dependencies.materialDesign,
Dependencies.kodein,
Dependencies.kodeinConf,
Dependencies.kodeinAndroid,
Dependencies.androidxLifecycleViewModel
Dependencies.composeUi,
Dependencies.composeMaterial,
Dependencies.composeTooling
)

val unitTesting = listOf(
Expand Down
4 changes: 2 additions & 2 deletions detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ naming:
FunctionNaming:
active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
functionPattern: '^([a-zA-Z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern: '$^'
ignoreOverridden: true
FunctionParameterNaming:
Expand Down Expand Up @@ -462,7 +462,7 @@ style:
maxJumpCount: 1
MagicNumber:
active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt/,**/*Color.kt"
ignoreNumbers: '-1,0,1,2'
ignoreHashCodeFunction: true
ignorePropertyDeclaration: false
Expand Down
2 changes: 1 addition & 1 deletion kotlin-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = ["-Xinline-classes"]
freeCompilerArgs = ["-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn"]
}
}
compileTestKotlin {
Expand Down

This file was deleted.

7 changes: 1 addition & 6 deletions presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,13 @@
<uses-permission android:name="android.permission.INTERNET" />

<application>

<activity
android:name=".regions.RegionsActivity"
android:name=".DialetusActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".dialects.DialectsActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.jcaique.dialetus.presentation

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.Text
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.setContent
import androidx.ui.tooling.preview.Preview
import com.jcaique.dialetus.presentation.ui.DialetusTheme

class DialetusActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
DialetusTheme {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colors.background) {
Greeting("Android")
}
}
}
}
}

@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}

@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
DialetusTheme {
Greeting("Android")
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
package com.jcaique.dialetus.presentation.di

import com.jcaique.dialetus.presentation.dialects.DialectsViewModel
import com.jcaique.dialetus.presentation.regions.RegionsViewModel
import org.kodein.di.DI
import org.kodein.di.bind
import org.kodein.di.instance
import org.kodein.di.provider

val presentationModule = DI.Module(name = "presentation") {

bind() from provider {
RegionsViewModel(
service = instance()
)
}

bind() from provider {
DialectsViewModel(
service = instance()
)
}
}

This file was deleted.

Loading

0 comments on commit 3ee0cea

Please sign in to comment.