forked from tidev/titanium-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
89 lines (80 loc) · 2.34 KB
/
build.gradle
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* Titanium SDK
* Copyright TiDev, Inc. 04/07/2022-Present
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
apply plugin: 'com.android.application'
// Set up Android app project.
android {
compileSdkVersion 33
defaultConfig {
applicationId 'com.titanium.test'
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName '1.0'
manifestPlaceholders = project.ext.tiManifestPlaceholders
manifestPlaceholders.put('localApplicationId', applicationId) // Legacy placeholder old AARs sometimes use.
}
lintOptions {
checkReleaseBuilds false
}
sourceSets {
main {
assets.srcDirs = [
'src/main/assets',
"${projectDir}/../titanium/build/outputs/ti-assets"
]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
// Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml".
// Will trigger a build failure if any violations have been detected.
// Customize all the Checkstyle tasks
tasks.withType(Checkstyle) {
// Specify all files that should be checked
classpath = files()
source android.sourceSets.main.java.srcDirs
}
// Execute Checkstyle on all files
task checkJavaStyle(type: Checkstyle) {
// include '**/*.java'
}
// Execute Checkstyle on all modified files
task checkstyleChanged(type: Checkstyle) {
include getChangedFiles()
}
// Used to strip the src dir prefixes from the changed java files
def getChangedFiles() {
if (!project.hasProperty('changedFiles')) {
return new ArrayList<>()
}
def allFiles = project.changedFiles.split(',')
// Remove the prefix
List<String> files = new ArrayList<>()
for (file in allFiles) {
def index = file.indexOf('src/main/java/')
if (index != -1) {
files.add(file.substring(index + 14))
}
}
// Return the list of touched files
files
}
tasks.withType(JavaCompile) {
dependsOn checkJavaStyle
}
// Define library dependencies used by this app.
dependencies {
implementation(project(':titanium')) {
// Uncomment the below to exclude Google Play Services from app.
// exclude group: 'com.google.android.gms'
}
implementation "androidx.appcompat:appcompat:${project.ext.tiAndroidXAppCompatLibVersion}"
implementation "com.google.android.material:material:${project.ext.tiMaterialLibVersion}"
}