Skip to content

Commit b7f9e56

Browse files
ali-abdullahpocmo
authored andcommitted
included buildSrc in ktlint and detekt checks
1 parent 25f37c9 commit b7f9e56

File tree

62 files changed

+334
-320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+334
-320
lines changed

build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ buildscript {
1111
}
1212

1313
dependencies {
14-
classpath Deps.tools_androidgradle
15-
classpath Deps.tools_kotlingradle
16-
classpath Deps.tools_dokka
14+
classpath Dependencies.tools_androidgradle
15+
classpath Dependencies.tools_kotlingradle
16+
classpath Dependencies.tools_dokka
1717

1818
// Publish.
19-
classpath Deps.tools_mavengradle
19+
classpath Dependencies.tools_mavengradle
2020
}
2121
}
2222

@@ -168,7 +168,7 @@ task clean(type: Delete) {
168168
detekt {
169169
// The version number is duplicated, please refer to plugins block for more details
170170
version = "1.0.0.RC9.2"
171-
input = files("$projectDir/components")
171+
input = files("$projectDir/components", "$projectDir/buildSrc")
172172
config = files("$projectDir/config/detekt.yml")
173173
filters = ".*test.*,.*/resources/.*,.*/tmp/.*"
174174
baseline = file("$projectDir/config/detekt-baseline.xml")
@@ -193,7 +193,7 @@ task ktlint(type: JavaExec, group: "verification") {
193193
description = "Check Kotlin code style."
194194
classpath = configurations.ktlint
195195
main = "com.github.shyiko.ktlint.Main"
196-
args "components/**/*.kt", "samples/**/*.kt", "!**/build"
196+
args "components/**/*.kt" , "samples/**/*.kt", "!**/build", "buildSrc/**/*.kt"
197197
}
198198

199199
task printModules {

buildSrc/src/main/java/Dependencies.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ private object Versions {
3434
}
3535

3636
// Synchronized dependencies used by (some) modules
37-
object Deps {
37+
@Suppress("MaxLineLength")
38+
object Dependencies {
3839
const val kotlin_stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}"
3940
const val kotlin_coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}"
4041
const val kotlin_reflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}"

buildSrc/src/main/java/GVNightlyVersionVerifierPlugin.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ open class GVNightlyVersionVerifierPlugin : Plugin<Project> {
1616

1717
companion object {
1818
private const val GV_VERSION_PATH_FILE = "buildSrc/src/main/java/Gecko.kt"
19-
private const val MAVEN_MOZILLA_GV_URL = "https://maven.mozilla.org/maven2/org/mozilla/geckoview/geckoview-nightly-armeabi-v7a/maven-metadata.xml"
19+
private const val MAVEN_MOZILLA_GV_URL =
20+
"https://maven.mozilla.org/maven2/org/mozilla/geckoview/geckoview-nightly-armeabi-v7a/maven-metadata.xml"
2021
}
2122

2223
override fun apply(project: Project) {
@@ -29,6 +30,7 @@ open class GVNightlyVersionVerifierPlugin : Plugin<Project> {
2930
}
3031
}
3132

33+
@Suppress("TooGenericExceptionThrown")
3234
private fun updateGVNightlyVersion(project: Project) {
3335

3436
val newVersion = getLastGeckoViewNightlyVersion(project)
@@ -60,9 +62,8 @@ open class GVNightlyVersionVerifierPlugin : Plugin<Project> {
6062
val file = File(path)
6163
var fileContent = file.readText()
6264
fileContent = fileContent.replace(Regex("nightly_version.*=.*"),
63-
"nightly_version = \"$newVersion\"")
65+
"nightly_version = \"$newVersion\"")
6466
file.writeText(fileContent)
6567
println("${file.name} file updated")
6668
}
67-
68-
}
69+
}

buildSrc/src/main/java/Gecko.kt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ internal object GeckoVersions {
88
const val release_version = "63.0.20181018182531"
99
}
1010

11+
@Suppress("MaxLineLength")
1112
object Gecko {
1213
const val geckoview_nightly_arm = "org.mozilla.geckoview:geckoview-nightly-armeabi-v7a:${GeckoVersions.nightly_version}"
1314
const val geckoview_nightly_x86 = "org.mozilla.geckoview:geckoview-nightly-x86:${GeckoVersions.nightly_version}"

buildSrc/src/main/java/GitHubClient.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class GitHubClient(token: String) {
2626
return httpPOST(url, bodyJson, tokenHeader)
2727
}
2828

29-
private fun httpPOST(urlString: String, json: String,
30-
vararg headers: Pair<String, String>): Pair<Boolean, String> {
29+
@Suppress("TooGenericExceptionCaught")
30+
private fun httpPOST(urlString: String, json: String, vararg headers: Pair<String, String>): Pair<Boolean, String> {
3131
val url = URL(urlString)
3232
val http = url.openConnection() as HttpURLConnection
3333

@@ -51,8 +51,7 @@ class GitHubClient(token: String) {
5151
} catch (e: Exception) {
5252
responseSuccessful = false
5353
http.errorStream.bufferedReader().readText()
54-
5554
}
5655
return responseSuccessful to textResponse
5756
}
58-
}
57+
}

buildSrc/src/main/java/GitHubPlugin.kt

+20-13
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ open class GitHubPlugin : Plugin<Project> {
3636

3737
createPullRequest(title, body, branch, baseBranch, owner, repo, user)
3838
}
39-
4039
}
4140

4241
project.task("openIssue") {
@@ -52,15 +51,22 @@ open class GitHubPlugin : Plugin<Project> {
5251
}
5352
}
5453

55-
private fun createPullRequest(title: String, body: String, branchName: String,
56-
baseBranch: String, owner: String,
57-
repoName: String, user: String) {
54+
@Suppress("TooGenericExceptionThrown", "LongParameterList")
55+
private fun createPullRequest(
56+
title: String,
57+
body: String,
58+
branchName: String,
59+
baseBranch: String,
60+
owner: String,
61+
repoName: String,
62+
user: String
63+
) {
5864
val bodyJson = ("{\n" +
59-
" \"title\": \" $title\",\n" +
60-
" \"body\": \"$body\",\n" +
61-
" \"head\": \"$user:$branchName\",\n" +
62-
" \"base\": \"$baseBranch\"\n" +
63-
"}")
65+
" \"title\": \" $title\",\n" +
66+
" \"body\": \"$body\",\n" +
67+
" \"head\": \"$user:$branchName\",\n" +
68+
" \"base\": \"$baseBranch\"\n" +
69+
"}")
6470

6571
val result = client.createPullRequest(owner, repoName, bodyJson)
6672

@@ -76,11 +82,12 @@ open class GitHubPlugin : Plugin<Project> {
7682
println(stringToPrint)
7783
}
7884

85+
@Suppress("TooGenericExceptionThrown")
7986
private fun createIssue(title: String, body: String, owner: String, repoName: String) {
8087
val bodyJson = ("{\n" +
81-
" \"title\": \"$title\",\n" +
82-
" \"body\": \"$body\"" +
83-
"}")
88+
" \"title\": \"$title\",\n" +
89+
" \"body\": \"$body\"" +
90+
"}")
8491

8592
val result = client.createIssue(owner, repoName, bodyJson)
8693
val successFul = result.first
@@ -108,4 +115,4 @@ open class GitHubPlugin : Plugin<Project> {
108115
val token = properties.getProperty("token")
109116
client = GitHubClient(token)
110117
}
111-
}
118+
}

components/browser/awesomebar/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ android {
2929
dependencies {
3030
api project(':concept-awesomebar')
3131

32-
api Deps.support_recyclerview
33-
implementation Deps.support_constraintlayout
32+
api Dependencies.support_recyclerview
33+
implementation Dependencies.support_constraintlayout
3434

35-
implementation Deps.kotlin_stdlib
36-
implementation Deps.kotlin_coroutines
35+
implementation Dependencies.kotlin_stdlib
36+
implementation Dependencies.kotlin_coroutines
3737

3838
testImplementation project(':support-test')
3939

40-
testImplementation Deps.testing_junit
41-
testImplementation Deps.testing_robolectric
42-
testImplementation Deps.testing_mockito
40+
testImplementation Dependencies.testing_junit
41+
testImplementation Dependencies.testing_robolectric
42+
testImplementation Dependencies.testing_mockito
4343
}
4444

4545
archivesBaseName = "browser-awesomebar"

components/browser/domains/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ android {
2424
}
2525

2626
dependencies {
27-
implementation Deps.kotlin_stdlib
28-
implementation Deps.kotlin_coroutines
27+
implementation Dependencies.kotlin_stdlib
28+
implementation Dependencies.kotlin_coroutines
2929

30-
testImplementation Deps.testing_junit
31-
testImplementation Deps.testing_robolectric
32-
testImplementation Deps.testing_mockito
30+
testImplementation Dependencies.testing_junit
31+
testImplementation Dependencies.testing_robolectric
32+
testImplementation Dependencies.testing_mockito
3333
}
3434

3535
apply from: '../../../publish.gradle'

components/browser/engine-gecko-beta/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ dependencies {
3232
compileOnly Gecko.geckoview_beta_arm
3333
testImplementation Gecko.geckoview_beta_arm
3434

35-
implementation Deps.kotlin_stdlib
36-
implementation Deps.kotlin_coroutines
35+
implementation Dependencies.kotlin_stdlib
36+
implementation Dependencies.kotlin_coroutines
3737

38-
testImplementation Deps.testing_junit
39-
testImplementation Deps.testing_robolectric
40-
testImplementation Deps.testing_mockito
38+
testImplementation Dependencies.testing_junit
39+
testImplementation Dependencies.testing_robolectric
40+
testImplementation Dependencies.testing_mockito
4141

4242
testImplementation project(':support-test')
4343
}

components/browser/engine-gecko-nightly/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ dependencies {
3939
compileOnly Gecko.geckoview_nightly_arm
4040
testImplementation Gecko.geckoview_nightly_arm
4141

42-
implementation Deps.kotlin_stdlib
43-
implementation Deps.kotlin_coroutines
42+
implementation Dependencies.kotlin_stdlib
43+
implementation Dependencies.kotlin_coroutines
4444

45-
testImplementation Deps.testing_junit
46-
testImplementation Deps.testing_robolectric
47-
testImplementation Deps.testing_mockito
45+
testImplementation Dependencies.testing_junit
46+
testImplementation Dependencies.testing_robolectric
47+
testImplementation Dependencies.testing_mockito
4848

4949
testImplementation project(':support-test')
5050
}

components/browser/engine-gecko/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ dependencies {
3232
compileOnly Gecko.geckoview_release_arm
3333
testImplementation Gecko.geckoview_release_arm
3434

35-
implementation Deps.kotlin_stdlib
36-
implementation Deps.kotlin_coroutines
35+
implementation Dependencies.kotlin_stdlib
36+
implementation Dependencies.kotlin_coroutines
3737

38-
testImplementation Deps.testing_junit
39-
testImplementation Deps.testing_robolectric
40-
testImplementation Deps.testing_mockito
38+
testImplementation Dependencies.testing_junit
39+
testImplementation Dependencies.testing_robolectric
40+
testImplementation Dependencies.testing_mockito
4141

4242
testImplementation project(':support-test')
4343
}

components/browser/engine-servo/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ dependencies {
3636
implementation project(':support-ktx')
3737
implementation project(':support-utils')
3838

39-
implementation Deps.mozilla_servo
39+
implementation Dependencies.mozilla_servo
4040

41-
implementation Deps.kotlin_stdlib
42-
implementation Deps.kotlin_coroutines
41+
implementation Dependencies.kotlin_stdlib
42+
implementation Dependencies.kotlin_coroutines
4343

4444
testImplementation project(':support-test')
4545

46-
testImplementation Deps.testing_junit
47-
testImplementation Deps.testing_robolectric
48-
testImplementation Deps.testing_mockito
46+
testImplementation Dependencies.testing_junit
47+
testImplementation Dependencies.testing_robolectric
48+
testImplementation Dependencies.testing_mockito
4949
}
5050

5151
apply from: '../../../publish.gradle'

components/browser/engine-system/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ dependencies {
3131
implementation project(':support-ktx')
3232
implementation project(':support-utils')
3333

34-
implementation Deps.kotlin_stdlib
35-
implementation Deps.kotlin_coroutines
34+
implementation Dependencies.kotlin_stdlib
35+
implementation Dependencies.kotlin_coroutines
3636

3737
testImplementation project(':support-test')
3838

39-
testImplementation Deps.testing_junit
40-
testImplementation Deps.testing_robolectric
41-
testImplementation Deps.testing_mockito
39+
testImplementation Dependencies.testing_junit
40+
testImplementation Dependencies.testing_robolectric
41+
testImplementation Dependencies.testing_mockito
4242
}
4343

4444
apply from: '../../../publish.gradle'

components/browser/errorpages/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ android {
3232
}
3333

3434
dependencies {
35-
implementation Deps.support_annotations
35+
implementation Dependencies.support_annotations
3636

37-
implementation Deps.kotlin_stdlib
37+
implementation Dependencies.kotlin_stdlib
3838

3939
testImplementation project(':support-test')
4040

41-
testImplementation Deps.testing_junit
42-
testImplementation Deps.testing_robolectric
43-
testImplementation Deps.testing_mockito
41+
testImplementation Dependencies.testing_junit
42+
testImplementation Dependencies.testing_robolectric
43+
testImplementation Dependencies.testing_mockito
4444
}
4545

4646
apply from: '../../../publish.gradle'

components/browser/menu/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ android {
2424
dependencies {
2525
implementation project(':support-ktx')
2626

27-
implementation Deps.support_appcompat
28-
implementation Deps.support_recyclerview
29-
implementation Deps.support_cardview
27+
implementation Dependencies.support_appcompat
28+
implementation Dependencies.support_recyclerview
29+
implementation Dependencies.support_cardview
3030

31-
implementation Deps.kotlin_stdlib
31+
implementation Dependencies.kotlin_stdlib
3232

33-
testImplementation Deps.testing_junit
34-
testImplementation Deps.testing_robolectric
35-
testImplementation Deps.testing_mockito
33+
testImplementation Dependencies.testing_junit
34+
testImplementation Dependencies.testing_robolectric
35+
testImplementation Dependencies.testing_mockito
3636
}
3737

3838
apply from: '../../../publish.gradle'

components/browser/search/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ android {
3535
dependencies {
3636
implementation project(':support-ktx')
3737

38-
implementation Deps.kotlin_stdlib
39-
implementation Deps.kotlin_coroutines
38+
implementation Dependencies.kotlin_stdlib
39+
implementation Dependencies.kotlin_coroutines
4040

41-
testImplementation Deps.testing_junit
42-
testImplementation Deps.testing_robolectric
43-
testImplementation Deps.testing_mockito
41+
testImplementation Dependencies.testing_junit
42+
testImplementation Dependencies.testing_robolectric
43+
testImplementation Dependencies.testing_mockito
4444
}
4545

4646
apply from: '../../../publish.gradle'

components/browser/session/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ dependencies {
2626
implementation project(':support-utils')
2727
implementation project(':support-ktx')
2828

29-
implementation Deps.kotlin_stdlib
30-
implementation Deps.support_customtabs
29+
implementation Dependencies.kotlin_stdlib
30+
implementation Dependencies.support_customtabs
3131

3232
// We expose this as API because we are using Observable in our public API and do not want every
3333
// consumer to have to manually import "utils".
3434
api project(':support-base')
3535

3636
testImplementation project(':support-test')
3737

38-
testImplementation Deps.testing_junit
39-
testImplementation Deps.testing_robolectric
40-
testImplementation Deps.testing_mockito
38+
testImplementation Dependencies.testing_junit
39+
testImplementation Dependencies.testing_robolectric
40+
testImplementation Dependencies.testing_mockito
4141
}
4242

4343
apply from: '../../../publish.gradle'

0 commit comments

Comments
 (0)