Skip to content
Snippets Groups Projects
Verified Commit 63a91735 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Cleanup structure

parent 15264739
Branches
No related tags found
No related merge requests found
Pipeline #641 failed
Showing
with 410 additions and 56 deletions
......@@ -3,28 +3,5 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
[{*.mod, *.dtd, *.ent, *.elt}]
indent_style = space
indent_size = 2
[{*.jhm, *.rng, *.wsdl, *.fxml, *.xslt, *.jrxml, *.ant, *.xul, *.xsl, *.xsd, *.tld, *.jnlp, *.xml}]
indent_style = space
indent_size = 2
[*.json]
indent_style = space
indent_size = 2
[*.java]
indent_style = space
indent_size = 2
[{*.kts, *.kt}]
indent_style = space
indent_size = 2
[{*.yml, *.yaml}]
indent_style = space
indent_size = 2
max_line_length = 120
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
id("de.kuschku.justcode")
kotlin("android")
kotlin("kapt")
id("de.justjanne.git-version")
id("de.justjanne.android-signing")
}
android {
setCompileSdkVersion(30)
buildToolsVersion = "30.0.3"
defaultConfig {
applicationId = "com.iskrembilen.quasseldroid"
setMinSdkVersion(21)
setTargetSdkVersion(30)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// Disable test runner analytics
testInstrumentationRunnerArguments(mapOf(
"disableAnalytics" to "true"
))
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
multiDexEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
}
getByName("debug") {
applicationIdSuffix = ".debug"
multiDexEnabled = true
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildFeatures {
......
......@@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package info.quasseldroid.app
package de.justjanne.quasseldroid.app
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
......@@ -36,6 +36,6 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("info.quasseldroid.app", appContext.packageName)
assertEquals("de.justjanne.app", appContext.packageName)
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.quasseldroid.app">
package="de.justjanne.quasseldroid.app">
<uses-feature
android:name="android.hardware.type.pc"
......@@ -13,7 +13,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name="info.quasseldroid.app.QuasseldroidApplication"
android:name=".QuasseldroidApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_descriptor"
android:icon="@mipmap/ic_launcher"
......@@ -22,7 +22,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.Quasseldroid">
<activity
android:name="info.quasseldroid.app.MainActivity"
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Quasseldroid.NoActionBar">
<intent-filter>
......
package info.quasseldroid.app.theme
package de.justjanne.quasseldroid.app
import androidx.compose.ui.graphics.Color
......
......@@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package info.quasseldroid.app
package de.justjanne.quasseldroid.app
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
......@@ -39,9 +39,6 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.lifecycleScope
import info.quasseldroid.app.theme.QuasseldroidTheme
import info.quasseldroid.app.theme.shapes
import info.quasseldroid.app.theme.typography
import dev.chrisbanes.accompanist.coil.CoilImage
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
......
......@@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package info.quasseldroid.app
package de.justjanne.quasseldroid.app
import androidx.multidex.MultiDexApplication
import dagger.hilt.android.HiltAndroidApp
......
package info.quasseldroid.app.theme
package de.justjanne.quasseldroid.app
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
......
package info.quasseldroid.app.theme
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 <http://www.gnu.org/licenses/>.
*/
package de.justjanne.quasseldroid.app
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
......
package info.quasseldroid.app.theme
package de.justjanne.quasseldroid.app
import androidx.compose.material.Typography
import androidx.compose.ui.text.TextStyle
......
......@@ -19,6 +19,10 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
}
buildscript {
repositories {
google()
......@@ -37,7 +41,6 @@ allprojects {
google()
mavenCentral()
jcenter()
mavenLocal()
}
tasks.withType<KotlinCompile>().configureEach {
......
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 <http://www.gnu.org/licenses/>.
*/
package de.justjanne.androidsigning
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType
class AndroidSigningPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.run {
this.extensions.getByType<BaseAppModuleExtension>().run {
signingConfigs {
signingData(project.rootProject.properties("signing.properties"))?.let {
create("default") {
storeFile = file(it.storeFile)
storePassword = it.storePassword
keyAlias = it.keyAlias
keyPassword = it.keyPassword
}
}
}
}
}
}
}
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 <http://www.gnu.org/licenses/>.
*/
package de.justjanne.androidsigning
import org.gradle.api.Project
import java.util.*
fun Project.properties(fileName: String): Properties? {
val file = file(fileName)
if (!file.exists())
return null
val props = Properties()
props.load(file.inputStream())
return props
}
package de.kuschku.justcode
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 <http://www.gnu.org/licenses/>.
*/
package de.justjanne.androidsigning
import java.util.*
......
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 <http://www.gnu.org/licenses/>.
*/
package de.justjanne.coverageconverter
import org.gradle.api.Action
import org.gradle.api.Task
import org.gradle.testing.jacoco.tasks.JacocoReport
import java.io.File
internal class CoverageConverterAction(
private val jacocoReportTask: JacocoReport
) : Action<Task> {
private fun findOutputFile(jacocoFile: File): File? {
val actualFile = jacocoFile.absoluteFile
if (actualFile.exists() && actualFile.parentFile.name == "jacoco") {
val folder = File(actualFile.parentFile.parentFile, "cobertura")
folder.mkdirs()
return File(folder, actualFile.name)
}
return null
}
private fun createPythonScript(name: String, temporaryDir: File): File {
val file = File(temporaryDir, name)
if (file.exists()) {
file.delete()
}
val source = CoverageConverterPlugin::class.java.getResourceAsStream("/coverageconverter/$name")
file.writeBytes(source.readAllBytes())
return file
}
override fun execute(task: Task) {
val cover2coverScript = createPythonScript("cover2cover.py", task.temporaryDir)
val source2filenameScript = createPythonScript("source2filename.py", task.temporaryDir)
fun cover2cover(reportFile: File, outputFile: File, sourceDirectories: Iterable<File>) {
task.project.exec {
commandLine("python3")
args(cover2coverScript.absolutePath)
args(reportFile.absolutePath)
args(sourceDirectories.map(File::getAbsolutePath))
standardOutput = outputFile.outputStream()
}
}
fun source2filename(reportFile: File) {
task.project.exec {
commandLine("python3")
args(source2filenameScript.absolutePath)
args(reportFile.absolutePath)
}
}
jacocoReportTask.reports.forEach {
if (it.isEnabled && it.destination.extension == "xml") {
val outputFile = findOutputFile(it.destination)
if (outputFile != null) {
cover2cover(it.destination, outputFile, jacocoReportTask.sourceDirectories)
source2filename(outputFile)
}
}
}
}
}
/*
* Kotlin Bitflags
* Copyright (c) 2021 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.coverageconverter
open class CoverageConverterExtension {
var autoConfigureCoverage: Boolean = false
}
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 <http://www.gnu.org/licenses/>.
*/
package de.justjanne.coverageconverter
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
import org.gradle.testing.jacoco.tasks.JacocoReport
import java.io.File
class CoverageConverterPlugin : Plugin<Project> {
override fun apply(project: Project) {
val extension = project.extensions.create("coverage", CoverageConverterExtension::class.java)
if (extension.autoConfigureCoverage) {
val jacocoPluginExtension = project.extensions.findByType(JacocoPluginExtension::class.java)
if (jacocoPluginExtension != null) {
jacocoPluginExtension.toolVersion = "0.8.3"
}
}
project.afterEvaluate {
val testTask = tasks.getByName("test")
val jacocoReportTask = tasks.getByName("jacocoTestReport") as? JacocoReport
if (jacocoReportTask != null) {
jacocoReportTask.dependsOn(testTask)
if (extension.autoConfigureCoverage) {
jacocoReportTask.sourceDirectories.from(fileTree("src/main/kotlin"))
jacocoReportTask.classDirectories.from(fileTree("build/classes"))
jacocoReportTask.reports {
xml.destination = File("${buildDir}/reports/jacoco/report.xml")
html.isEnabled = true
xml.isEnabled = true
csv.isEnabled = false
}
}
tasks.register("coberturaTestReport") {
dependsOn(jacocoReportTask)
mustRunAfter(jacocoReportTask)
group = "verification"
doLast(CoverageConverterAction(jacocoReportTask))
}
}
}
}
}
package de.kuschku.justcode
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program 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 <http://www.gnu.org/licenses/>.
*/
package de.justjanne.gitversion
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType
class JustCodePlugin : Plugin<Project> {
class GitVersionPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.run {
this.extensions.getByType<BaseAppModuleExtension>().run {
setCompileSdkVersion(30)
buildToolsVersion = "30.0.3"
signingConfigs {
signingData(project.rootProject.properties("signing.properties"))?.let {
create("default") {
storeFile = file(it.storeFile)
storePassword = it.storePassword
keyAlias = it.keyAlias
keyPassword = it.keyPassword
}
}
}
defaultConfig {
versionCode = gitVersionCode() ?: 1
versionName = gitVersionName() ?: "1.0.0"
......@@ -45,37 +49,6 @@ class JustCodePlugin : Plugin<Project> {
)
setProperty("archivesBaseName", "${rootProject.name}-$versionName")
signingConfig = signingConfigs.findByName("default")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// Disable test runner analytics
testInstrumentationRunnerArguments(mapOf(
"disableAnalytics" to "true"
))
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
multiDexEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
}
getByName("debug") {
applicationIdSuffix = ".debug"
multiDexEnabled = true
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
}
......
......@@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.kuschku.justcode
package de.justjanne.gitversion
import java.io.IOException
import java.io.OutputStream
......
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2020 Janne Mareike Koschinski
* Copyright (c) 2020 The Quassel Project
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
......@@ -17,11 +17,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.kuschku.justcode
package de.justjanne.gitversion
import org.gradle.api.Project
import java.io.ByteArrayOutputStream
import java.util.*
fun Project.cmd(vararg command: String) = try {
val stdOut = ByteArrayOutputStream()
......@@ -35,15 +34,6 @@ fun Project.cmd(vararg command: String) = try {
null
}
fun Project.properties(fileName: String): Properties? {
val file = file(fileName)
if (!file.exists())
return null
val props = Properties()
props.load(file.inputStream())
return props
}
inline fun <reified T> setBuildConfigField(
setter: (String, String, String) -> Unit,
name: String,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment