Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #2

Merged
merged 9 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.{kt,kts}]
insert_final_newline=false
max_line_length=off
ktlint_disabled_rules=no-wildcard-imports,import-ordering,trailing-comma,final-newline, package-name
40 changes: 40 additions & 0 deletions .github/workflows/pull-request-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and test

on:
pull_request:
branches:
[ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run ktlintFormat on the codebase
run: ./gradlew ktlintFormat

- name: Run ktlintCheck on the codebase
run: ./gradlew ktlintCheck

- name: Run Unit Tests
run: ./gradlew test

- name: Run debug Build
run: ./gradlew assembleDebug
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}
kotlinOptions {
jvmTarget = "17"
Expand All @@ -44,9 +45,10 @@ android {
dependencies {
implementation(project(":presentation"))
implementation(project(":designsystem"))
coreLibraryDesugaring(libs.android.desugarJdkLibs)
debugImplementation(libs.leakcanary.android)
implementation(libs.core.ktx)
implementation(libs.timber)
implementation(libs.lifecycle.runtime.ktx)
implementation(libs.activity.compose)
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".WeatherApp"
android:name=".WeatherApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand All @@ -16,7 +16,7 @@
android:theme="@style/Theme.WeatherApp"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name=".activity.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.WeatherApp">
Expand Down
48 changes: 0 additions & 48 deletions app/src/main/java/com/danielwaiguru/weatherapp/MainActivity.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class WeatherApp: Application()
class WeatherApplication : Application()
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.danielwaiguru.weatherapp.activity

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import com.danielwaiguru.weatherapp.navigation.WeatherApp
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
WeatherApp()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.danielwaiguru.weatherapp.navigation

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import com.danielwaiguru.weatherapp.designsystem.theme.WeatherAppTheme
import com.danielwaiguru.weatherapp.presentation.permissions.navigation.PermissionsScreenDestination
import com.danielwaiguru.weatherapp.presentation.permissions.navigation.permissionsScreen
import com.danielwaiguru.weatherapp.presentation.weather.navigation.weatherScreen

@Composable
fun WeatherApp() {
WeatherAppTheme {
val navController = rememberNavController()
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
NavHost(
navController = navController,
startDestination = PermissionsScreenDestination.route
) {
permissionsScreen(navController = navController)
weatherScreen()
}
}
}
}
17 changes: 0 additions & 17 deletions app/src/test/java/com/danielwaiguru/weatherapp/ExampleUnitTest.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
dependencies {
add("androidTestImplementation", kotlin("test"))
add("testImplementation", kotlin("test"))
add("coreLibraryDesugaring", libs.findLibrary("android-desugarJdkLibs").get())
"implementation"(libs.findLibrary("timber").get())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ internal fun Project.configureKotlinAndroid(
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

kotlinOptions {
Expand Down
32 changes: 31 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,35 @@ plugins {
alias(libs.plugins.org.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ktlint)
alias(libs.plugins.spotless)
}
true // Needed to make the Suppress annotation work for the plugins block

allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
ktlint {
android.set(true)
ignoreFailures.set(false)
reporters {
org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE
}
filter {
exclude { element -> element.file.path.contains("generated/") }
}
}
}

subprojects {
apply(plugin = "com.diffplug.spotless")
spotless {
kotlin {
target("**/*.kt")
targetExclude("${project.rootDir}/build-logic/**/*.kt")
}
format("kts") {
target("**/*.kts")
targetExclude("**/build/**/*.kts")
}
}
}
true // Needed to make the Suppress annotation work for the plugins block
Binary file not shown.
Binary file added buildlogic/build/intermediates/ktLint/reporters.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions codeAnalysis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

./gradlew ktlintFormat && ./gradlew ktlintCheck && ./gradlew spotlessApply

# Before use it, in the first time, you must guarantee some running permissions:
# chmod +x codeAnalysis.sh
#
# After that, you just need to run:
# ./codeAnalysis.sh
4 changes: 2 additions & 2 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dependencies {
implementation(project(":domain"))
// Networking
implementation(libs.bundles.network)
implementation(libs.play.services.location)
// Chucker
debugImplementation(libs.chucker.debug)
releaseImplementation(libs.chucker)

}
}
Loading