-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from phansier/updates
Updates
- Loading branch information
Showing
75 changed files
with
1,697 additions
and
1,503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.**, ^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
/.idea | ||
.DS_Store | ||
/build | ||
/build-logic/build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
path := ./ | ||
|
||
detekt: | ||
$(path)gradlew detektAll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
40
build-logic/checks/src/main/kotlin/convention.detekt.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} |
16 changes: 16 additions & 0 deletions
16
build-logic/gradle-ext/src/main/kotlin/ru/beryukhov/android/VersionCatalog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ plugins { | |
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} |
Oops, something went wrong.