-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to Gradle Groovy and update dependencies
- Loading branch information
Showing
23 changed files
with
283 additions
and
314 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,139 @@ | ||
import io.gitlab.arturbosch.detekt.Detekt | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
buildscript { | ||
apply from: "gradle/dependencies.gradle" | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
google() | ||
} | ||
|
||
dependencies { | ||
classpath libs.android.gradlePlugin | ||
classpath libs.kotlinGradlePlugin | ||
classpath libs.mavenPublishGradlePlugin | ||
classpath libs.dokkaGradlePlugin | ||
classpath libs.detekt.gradlePlugin | ||
classpath libs.gradleVersions.gradlePlugin | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
jcenter() | ||
} | ||
|
||
group GROUP | ||
version VERSION_NAME | ||
|
||
tasks.withType(Test) { | ||
testLogging { | ||
events "skipped", "failed", "passed" | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
sourceCompatibility "1.8" | ||
targetCompatibility "1.8" | ||
} | ||
|
||
tasks.withType(KotlinCompile) { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
freeCompilerArgs += [ | ||
"-progressive", | ||
"-Xjvm-default=enable", | ||
] | ||
} | ||
} | ||
|
||
pluginManager.withPlugin("com.android.library") { | ||
android { | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
compileSdkVersion versions.androidBuild.compileSdk | ||
|
||
defaultConfig { | ||
minSdkVersion versions.androidBuild.minSdk | ||
targetSdkVersion versions.androidBuild.targetSdk | ||
|
||
vectorDrawables.useSupportLibrary true | ||
} | ||
|
||
variantFilter { variant -> | ||
setIgnore variant.name != "release" | ||
} | ||
|
||
libraryVariants.all { variant -> | ||
variant.outputs.all { | ||
outputFileName = "${archivesBaseName}-${version}.aar" | ||
} | ||
} | ||
|
||
lintOptions { | ||
lintConfig rootProject.file("lint.xml") | ||
|
||
htmlReport !isCi() | ||
xmlReport isCi() | ||
xmlOutput file("build/reports/lint/lint-results.xml") | ||
|
||
textReport true | ||
textOutput "stdout" | ||
explainIssues false | ||
|
||
checkDependencies false | ||
checkGeneratedSources true | ||
checkTestSources false | ||
checkReleaseBuilds false | ||
} | ||
} | ||
} | ||
} | ||
|
||
apply plugin: libs.detekt.gradlePluginId | ||
|
||
dependencies { | ||
detekt libs.detekt.formatting | ||
detekt libs.detekt.cli | ||
} | ||
|
||
tasks.withType(Detekt) { | ||
parallel true | ||
config.setFrom(rootProject.files("detekt-config.yml")) | ||
setSource(files(projectDir)) | ||
exclude "**/test/**", "**/androidTest/**" | ||
exclude subprojects.collect { "${rootDir.toPath().relativize(it.buildDir.toPath())}/" } | ||
reports { | ||
xml { | ||
enabled = isCi() | ||
destination = file("build/reports/detekt/detekt-results.xml") | ||
} | ||
html.enabled = !isCi() | ||
txt.enabled = false | ||
} | ||
} | ||
|
||
apply plugin: libs.gradleVersions.gradlePluginId | ||
|
||
dependencyUpdates { | ||
rejectVersionIf { | ||
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion) | ||
} | ||
} | ||
|
||
private static def isNonStable(String version) { | ||
def regex = /^[0-9,.v-]+(-r)?$/ | ||
return !(version ==~ regex) | ||
} | ||
|
||
private static def isCi() { | ||
// noinspection GroovyPointlessBoolean | ||
return System.getenv("CI")?.toBoolean() == true | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
ext.versions = [ | ||
"kotest": "4.3.1", | ||
"detekt": "1.14.2", | ||
"androidBuild": [ | ||
"minSdk": 21, | ||
"compileSdk": 30, | ||
"targetSdk": 30, | ||
], | ||
] | ||
|
||
ext.libs = [ | ||
"android": [ | ||
"gradlePlugin": "com.android.tools.build:gradle:4.1.0", | ||
"xTestCoreKtx": "androidx.test:core-ktx:1.3.0" | ||
], | ||
"kotlinGradlePlugin": "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10", | ||
"dokkaGradlePlugin": "org.jetbrains.dokka:dokka-gradle-plugin:1.4.10.2", | ||
"kotest": [ | ||
"runnerJunit5": "io.kotest:kotest-runner-junit5-jvm:${versions.kotest}", | ||
"assertions": "io.kotest:kotest-assertions-core-jvm:${versions.kotest}", | ||
"property": "io.kotest:kotest-property-jvm:${versions.kotest}", | ||
], | ||
"mavenPublishGradlePlugin": "com.vanniktech:gradle-maven-publish-plugin:0.13.0", | ||
"detekt": [ | ||
"gradlePluginId": "io.gitlab.arturbosch.detekt", | ||
"gradlePlugin": "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${versions.detekt}", | ||
"formatting": "io.gitlab.arturbosch.detekt:detekt-formatting:${versions.detekt}", | ||
"cli": "io.gitlab.arturbosch.detekt:detekt-cli:${versions.detekt}", | ||
], | ||
"gradleVersions": [ | ||
"gradlePlugin": "com.github.ben-manes:gradle-versions-plugin:0.36.0", | ||
"gradlePluginId": "com.github.ben-manes.versions", | ||
], | ||
"junit": "junit:junit:4.13.1", | ||
"robolectric": "org.robolectric:robolectric:4.4", | ||
] |
Oops, something went wrong.