forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
60 lines (49 loc) · 1.5 KB
/
build.gradle
File metadata and controls
60 lines (49 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Java Lint Configuration for python-for-android
// This file configures Spotless to lint Java source files across all bootstraps
plugins {
id 'java'
id 'com.diffplug.spotless' version '6.25.0'
}
// Repositories for plugin dependencies (e.g., google-java-format)
repositories {
mavenCentral()
}
// Define the root directory for bootstrap Java sources
def bootstrapsDir = "${rootProject.projectDir}"
// Collect all Java source directories from all bootstraps
def javaSourceDirs = []
file(bootstrapsDir).eachDir { bootstrapDir ->
def srcDir = new File(bootstrapDir, 'build/src/main/java')
if (srcDir.exists()) {
javaSourceDirs.add(srcDir.absolutePath)
}
}
sourceSets {
main {
java {
srcDirs = javaSourceDirs
}
}
}
spotless {
java {
// Target all Java files from the source directories
target fileTree(bootstrapsDir) {
include '**/build/src/main/java/**/*.java'
// Exclude third-party vendored code
exclude '**/org/kamranzafar/jtar/**'
}
// Use Google Java Format with AOSP style (Android-friendly, slightly relaxed)
googleJavaFormat('1.19.2').aosp()
// Remove unused imports
removeUnusedImports()
// Trim trailing whitespace
trimTrailingWhitespace()
// Ensure files end with a newline
endWithNewline()
}
}
// Disable compilation - we only want to lint, not build
tasks.withType(JavaCompile).configureEach {
enabled = false
}