Compare commits
7 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
a6dcd67a81 | |
|
|
5c46386ebf | |
|
|
3cc63ffe5e | |
|
|
ec358728eb | |
|
|
78024ea1a6 | |
|
|
5e7a39d14d | |
|
|
e175e66e57 |
|
|
@ -9,17 +9,18 @@ plugins {
|
|||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// android gradle plugin, required by custom plugin
|
||||
implementation("com.android.tools.build:gradle:4.0.1")
|
||||
implementation("com.android.tools.build:gradle:7.1.3")
|
||||
|
||||
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.10.0")
|
||||
implementation("de.aaschmid:gradle-cpd-plugin:3.1")
|
||||
implementation("de.aaschmid:gradle-cpd-plugin:3.3")
|
||||
|
||||
// kotlin plugin, required by custom plugin
|
||||
implementation(kotlin("gradle-plugin", embeddedKotlinVersion))
|
||||
implementation(kotlin("gradle-plugin", "1.8.10"))
|
||||
|
||||
gradleKotlinDsl()
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
|
|
@ -27,7 +28,7 @@ dependencies {
|
|||
|
||||
val compileKotlin: KotlinCompile by tasks
|
||||
compileKotlin.kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
|
|
|
|||
|
|
@ -52,9 +52,13 @@ abstract class ApiGeneratorPlugin : Plugin<Project> {
|
|||
val outputLanguage = extension.outputLanguage ?: throw IllegalStateException("Configure output language code for api generator plugin")
|
||||
|
||||
javaexec {
|
||||
main = "-jar"
|
||||
mainClass.set("-jar")
|
||||
workingDir = rootDir
|
||||
args = listOfNotNull(
|
||||
"--add-opens",
|
||||
"java.base/java.lang=ALL-UNNAMED",
|
||||
"--add-opens",
|
||||
"java.base/java.time=ALL-UNNAMED",
|
||||
configurations.getByName("apiGenerator").asPath,
|
||||
"generate-client-code",
|
||||
"--output-language",
|
||||
|
|
@ -68,7 +72,7 @@ abstract class ApiGeneratorPlugin : Plugin<Project> {
|
|||
"--package-name",
|
||||
extension.outputPackageName,
|
||||
"--recreate_output_dirs",
|
||||
extension.recreateOutputDir.toString()
|
||||
extension.recreateOutputDir.toString(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package static_analysis.linters
|
||||
|
||||
import com.android.build.gradle.AppExtension
|
||||
import com.android.build.gradle.AppPlugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.findByType
|
||||
import static_analysis.errors.AndroidLintError
|
||||
import static_analysis.errors.StaticAnalysisError
|
||||
import static_analysis.plugins.StaticAnalysisExtension
|
||||
|
|
@ -33,22 +31,10 @@ class AndroidLinter : Linter {
|
|||
.flatten()
|
||||
|
||||
override fun setupForProject(project: Project, extension: StaticAnalysisExtension) {
|
||||
project.beforeEvaluate {
|
||||
subprojects
|
||||
.mapNotNull { it.extensions.findByType<AppExtension>() }
|
||||
.first()
|
||||
.lintOptions.apply {
|
||||
isAbortOnError = false
|
||||
isCheckAllWarnings = true
|
||||
isWarningsAsErrors = false
|
||||
xmlReport = true
|
||||
htmlReport = false
|
||||
isCheckDependencies = true
|
||||
disable("MissingConstraints", "VectorRaster")
|
||||
xmlOutput = getLintReportFile()
|
||||
lintConfig = file("${extension.buildScriptDir}/static_analysis_configs/lint.xml")
|
||||
}
|
||||
}
|
||||
// Make sure to set lint options manually in modules gradle file
|
||||
// Otherwise you will get java.io.FileNotFoundException
|
||||
|
||||
// See issue: https://github.com/TouchInstinct/BuildScripts/issues/310
|
||||
}
|
||||
|
||||
override fun getTaskNames(project: Project, buildType: String?): List<String> {
|
||||
|
|
@ -62,11 +48,14 @@ class AndroidLinter : Linter {
|
|||
.mapNotNull { subproject: Project ->
|
||||
subproject
|
||||
.tasks
|
||||
.find { task -> task.name.contains(buildType, ignoreCase = true) && task.name.contains("lint") }
|
||||
?.path
|
||||
.filter { task ->
|
||||
task.name.equals("lint${buildType}", ignoreCase = true)
|
||||
|| task.name.equals("copy${buildType}AndroidLintReports", ignoreCase = true)
|
||||
}
|
||||
.map { it.path }
|
||||
}
|
||||
.flatten()
|
||||
}
|
||||
|
||||
private fun Project.getLintReportFile() = file("${rootProject.buildDir}/reports/lint-report.xml")
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class CpdLinter : Linter {
|
|||
}
|
||||
tasks.withType<Cpd> {
|
||||
reports.xml.required.set(true)
|
||||
reports.xml.destination = getCpdReportFile()
|
||||
reports.xml.outputLocation.set(getCpdReportFile())
|
||||
ignoreFailures = true
|
||||
source = getSources(extension.excludes)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package static_analysis.plugins
|
|||
import com.android.build.gradle.AppExtension
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import static_analysis.linters.AndroidLinter
|
||||
import static_analysis.linters.CpdLinter
|
||||
import static_analysis.linters.DetektLinter
|
||||
import static_analysis.linters.Linter
|
||||
|
|
@ -34,8 +35,7 @@ class StaticAnalysisAndroidPlugin : StaticAnalysisPlugin() {
|
|||
override fun createLinters(): List<Linter> = listOf(
|
||||
DetektLinter(),
|
||||
CpdLinter(),
|
||||
//TODO temporary disable Android Linter to avoid FileNotFoundException when generating report
|
||||
//AndroidLinter()
|
||||
AndroidLinter()
|
||||
)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
android {
|
||||
lint {
|
||||
abortOnError false
|
||||
checkAllWarnings true
|
||||
warningsAsErrors false
|
||||
checkDependencies true
|
||||
htmlReport false
|
||||
textReport false
|
||||
xmlReport true
|
||||
xmlOutput file("${rootProject.buildDir}/reports/lint-report.xml")
|
||||
lintConfig file("${rootProject.ext["buildScriptsDir"]}/static_analysis_configs/lint.xml")
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,9 @@
|
|||
<!--All activities should have locked orientation-->
|
||||
<issue id="LockedOrientationActivity" severity="ignore" />
|
||||
|
||||
<!-- TODO: Update Timber version. See this issue: https://github.com/JakeWharton/timber/issues/408 -->
|
||||
<issue id="WrongTimberUsageDetector" severity="ignore" />
|
||||
|
||||
<issue id="AllowAllHostnameVerifier" severity="error" />
|
||||
<issue id="InvalidUsesTagAttribute" severity="error" />
|
||||
<issue id="MissingIntentFilterForMediaSearch" severity="error" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue