forked from tidev/titanium-sdk
/
build.gradle
91 lines (82 loc) 路 2.44 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
90
91
/**
* 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 {
ndkVersion project.ext.tiNdkVersion
defaultConfig {
applicationId 'com.titanium.test'
compileSdk 34
minSdkVersion 26
targetSdkVersion 34
versionCode 1
versionName '1.0'
manifestPlaceholders = project.ext.tiManifestPlaceholders
manifestPlaceholders.put('localApplicationId', applicationId) // Legacy placeholder old AARs sometimes use.
}
sourceSets {
main {
assets.srcDirs = [
'src/main/assets',
"${projectDir}/../titanium/build/outputs/ti-assets"
]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
namespace 'com.titanium.test'
lint {
checkReleaseBuilds false
}
}
// 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).configureEach {
// Specify all files that should be checked
classpath = files()
source android.sourceSets.main.java.srcDirs
}
// Execute Checkstyle on all files
tasks.register('checkJavaStyle', Checkstyle) {
// include '**/*.java'
}
// Execute Checkstyle on all modified files
tasks.register('checkstyleChanged', 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).configureEach {
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}"
}