Skip to content

Commit

Permalink
Merge pull request #13 from phansier/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
phansier authored Mar 31, 2024
2 parents cc5669c + 0ce417f commit f7275af
Show file tree
Hide file tree
Showing 75 changed files with 1,697 additions and 1,503 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

# See detektConfig.yml, values should be the same

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120

ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^
36 changes: 20 additions & 16 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
name: Android CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Run tests
run: ./gradlew test
- name: Build a library with Gradle
run: ./gradlew assembleRelease
steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
cache: 'gradle'
- name: Detekt
run: make detekt
- name: Run tests
run: ./gradlew test
- name: Build a library with Gradle
run: ./gradlew assembleRelease
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/.idea
.DS_Store
/build
/build-logic/build

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
path := ./

detekt:
$(path)gradlew detektAll
3 changes: 3 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
`kotlin-dsl`
}
1 change: 1 addition & 0 deletions build-logic/checks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
12 changes: 12 additions & 0 deletions build-logic/checks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
`kotlin-dsl`
}

// group = "com.avito.android.buildlogic"

dependencies {
implementation(projects.gradleExt)
implementation(libs.detektGradle)
// workaround for https://github.com/gradle/gradle/issues/15383
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
40 changes: 40 additions & 0 deletions build-logic/checks/src/main/kotlin/convention.detekt.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import io.gitlab.arturbosch.detekt.Detekt
import ru.beryukhov.android.withVersionCatalog

plugins {
/**
* https://docs.gradle.org/current/userguide/base_plugin.html
* base plugin added to add wiring on check->build tasks
*/
base
id("io.gitlab.arturbosch.detekt")
}

// workaround for https://github.com/gradle/gradle/issues/15383
project.withVersionCatalog { libs ->
dependencies {
detektPlugins(libs.detektFormatting)
}
}

val detektAll = tasks.register<Detekt>("detektAll") {
description = "Runs over whole code base without the starting overhead for each module."
parallel = true
setSource(files(projectDir))

config.setFrom(files(project.rootDir.resolve("detektConfig.yml")))
buildUponDefaultConfig = false

include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
reports {
xml.required.set(false)
html.required.set(false)
}
}

tasks.named("check").configure {
dependsOn(detektAll)
}
1 change: 1 addition & 0 deletions build-logic/gradle-ext/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
10 changes: 10 additions & 0 deletions build-logic/gradle-ext/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
`kotlin-dsl`
}

// group = "com.avito.android.buildlogic"

dependencies {
// workaround for https://github.com/gradle/gradle/issues/15383
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ru.beryukhov.android

import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project
import org.gradle.kotlin.dsl.the

/**
* workaround to make version catalog accessible in convention plugins
* https://github.com/gradle/gradle/issues/15383
*/
fun Project.withVersionCatalog(block: (libs: LibrariesForLibs) -> Unit) {
if (project.name != "gradle-kotlin-dsl-accessors") {
val libs = the<LibrariesForLibs>()
block.invoke(libs)
}
}
24 changes: 24 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
rootProject.name = "build-logic"

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}

repositories {
google()
mavenCentral()
}
}

include("checks")
/**
* renamed from 'gradle' to prevent IDE resolution conflict:
* usages of "typesafe project accessors", e.g. `projects.gradle.someProject` was red in IDE
* build was fine however
*/
include("gradle-ext")
25 changes: 10 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
buildscript {
val kotlin_version by extra("1.5.20")
val coroutines_version by extra("1.5.1")
val robolectric_version by extra("4.6.1")
plugins {
id("convention.detekt")
// id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

buildscript {
repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
classpath(libs.androidGradle)
classpath(libs.kotlinGradle)
classpath(libs.bintrayGradle)
}
}

allprojects {
repositories {
google()
mavenCentral()
maven("https://dl.bintray.com/andreyberyukhov/FlowReactiveNetwork")
}
}

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

task<Delete>("clean") {
delete(rootProject.buildDir)
}
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ plugins {
repositories {
google()
mavenCentral()
}
}
Loading

0 comments on commit f7275af

Please sign in to comment.