Skip to content

Commit

Permalink
Adds Spotless rules for Groovy Gradle files and fixes. (nickbutcher#809)
Browse files Browse the repository at this point in the history
Adds Spotless rules for Groovy Gradle files

This commit includes:
- spotless rule for Groovy build scripts
- groovy configuration (`script/greclipse.properties`)
- formatting fixes in `build.gradle` files
  • Loading branch information
pfmaggi authored Dec 10, 2019
1 parent 4d3fdf1 commit 5b28b05
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 72 deletions.
21 changes: 10 additions & 11 deletions about/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright 2018 Google LLC
* Copyright 2018 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.dynamic-feature'
Expand Down
14 changes: 10 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -38,7 +38,7 @@ android {

resConfig 'en'
manifestPlaceholders += [
crashlyticsEnabled: false
crashlyticsEnabled: false
]
}

Expand All @@ -49,7 +49,8 @@ android {
buildTypes {
release {
// There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features
// The temporary workaround is to disable shrinking
// The temporary workaround is to disable shrinking.
// This issue is tracked in: https://issuetracker.google.com/120517460
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
Expand All @@ -69,7 +70,12 @@ android {
jvmTarget = "1.8"
}

dynamicFeatures = [':about', ':designernews', ':dribbble', ':search']
dynamicFeatures = [
':about',
':designernews',
':dribbble',
':search'
]
}

dependencies {
Expand Down
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,14 @@ subprojects {
ktlint(versions.ktlint)
licenseHeaderFile project.rootProject.file('scripts/copyright.kt')
}
groovyGradle {
// same as groovy, but for .gradle (defaults to '*.gradle')
target '**/*.gradle'
paddedCell() // Avoid cyclic ambiguities
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
// so it formats Java files by default (unless `excludeJava` is used).
greclipse().configFile(project.rootProject.file('scripts/greclipse.properties'))
licenseHeaderFile project.rootProject.file('scripts/copyright.kt'), '(buildscript|apply)'
}
}
}
21 changes: 10 additions & 11 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright 2018 Google LLC
* Copyright 2018 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.library'
Expand Down
21 changes: 10 additions & 11 deletions designernews/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright 2018 Google LLC
* Copyright 2018 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.dynamic-feature'
Expand Down
21 changes: 10 additions & 11 deletions dribbble/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright 2018 Google LLC
* Copyright 2018 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.dynamic-feature'
Expand Down
34 changes: 34 additions & 0 deletions scripts/greclipse.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#Whether to use 'space', 'tab' or 'mixed' (both) characters for indentation.
#The default value is 'tab'.
org.eclipse.jdt.core.formatter.tabulation.char=space

#Number of spaces used for indentation in case 'space' characters
#have been selected. The default value is 4.
org.eclipse.jdt.core.formatter.tabulation.size=4

#Number of spaces used for indentation in case 'mixed' characters
#have been selected. The default value is 4.
org.eclipse.jdt.core.formatter.indentation.size=4

#Whether or not indentation characters are inserted into empty lines.
#The default value is 'true'.
org.eclipse.jdt.core.formatter.indent_empty_lines=false

#Number of spaces used for multiline indentation.
#The default value is 2.
groovy.formatter.multiline.indentation=2

#Length after which list are considered too long. These will be wrapped.
#The default value is 30.
groovy.formatter.longListLength=30

#Whether opening braces position shall be the next line.
#The default value is 'same'.
groovy.formatter.braces.start=same

#Whether closing braces position shall be the next line.
#The default value is 'next'.
groovy.formatter.braces.end=next

#Remove unnecessary semicolons. The default value is 'false'.
groovy.formatter.remove.unnecessary.semicolons=false
22 changes: 10 additions & 12 deletions search/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright 2018 Google LLC
* Copyright 2018 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.dynamic-feature'
Expand Down Expand Up @@ -53,7 +52,6 @@ dependencies {
implementation "com.github.bumptech.glide:recyclerview-integration:${versions.glide}"
implementation "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}"
kapt "com.google.dagger:dagger-compiler:${versions.dagger}"

}

kapt {
Expand Down
22 changes: 10 additions & 12 deletions test_shared/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright 2018 Google LLC
* Copyright 2019 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.library'
Expand Down Expand Up @@ -48,6 +47,5 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}"
implementation "junit:junit:${versions.junit}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}"

}

16 changes: 16 additions & 0 deletions third_party/bypass/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2019 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

Expand Down

0 comments on commit 5b28b05

Please sign in to comment.