-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
88 lines (83 loc) · 3.79 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
/*
* Sillot T☳Converbenk Matrix 汐洛彖夲肜矩阵:为智慧新彖务服务
* Copyright (c) 2024.
*
* lastModified: 2024/8/3 10:21
* updated: 2024/8/3 10:21
*/
import groovy.json.JsonSlurper
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
siyuanVersionCode = 239
siyuanVersionName = "3.1.2"
}
def kotlin_v = '2.0.0' // 2.0+ 不需要手动对齐 Compose Compiler 版本 REF https://developer.android.com/jetpack/androidx/releases/compose-kotlin?hl=zh-cn
// kotlin_v 设为 1.9+ 会报错 Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'kaptGenerateStubsDebugKotlin' (1.8).
ext {
kotlin_version = kotlin_v
versionSillot = "" // 初始化 Sillot 版本同步
vC = 14 // Sillot-android 主要版本递增
}
repositories { // 这个块定义了用于Gradle脚本自身执行的仓库。这意味着它用于加载Gradle插件和它们的依赖项,而不是项目本身的依赖项。
maven { url 'https://jitpack.io' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven {url 'https://developer.huawei.com/repo/'}
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.0' // 8.0+ 需要 JDK 17+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_v}"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
// 确保版本一致性,在 module 级别无需声明版本
plugins {
id 'io.realm.kotlin' version '2.0.0' apply false // 需要适配 kotlin 版本
id "com.google.devtools.ksp" version("2.0.0-1.0.22") apply false // 使用 ksp 而不是 kapt ; 需要手动对齐 kotlin 版本
id "org.jetbrains.kotlin.plugin.compose" version "$kotlin_version" apply false // https://developer.android.com/develop/ui/compose/compiler?hl=zh-cn
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version" apply false
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
gradle.beforeProject { project ->
File packageFile = file('package.json')
if (packageFile.exists()) {
def json = new JsonSlurper().parse(packageFile)
ext.versionSillot = json.version
println "Version from package.json: ${ext.versionSillot}"
} else {
throw new GradleException("package.json not found.")
}
}
tasks.withType(JavaCompile).configureEach {
// Try to turn them all off automatically
options.compilerArgs << '-Xlint:none'
options.compilerArgs << '-nowarn' // same as '-Xlint:none'
// Turn them off manually
options.compilerArgs << '-Xlint:-auxiliaryclass'
options.compilerArgs << '-Xlint:-cast'
options.compilerArgs << '-Xlint:-classfile'
options.compilerArgs << '-Xlint:-deprecation'
options.compilerArgs << '-Xlint:-dep-ann'
options.compilerArgs << '-Xlint:-divzero'
options.compilerArgs << '-Xlint:-empty'
options.compilerArgs << '-Xlint:-fallthrough'
options.compilerArgs << '-Xlint:-finally'
options.compilerArgs << '-Xlint:-options'
options.compilerArgs << '-Xlint:-overloads'
options.compilerArgs << '-Xlint:-overrides'
options.compilerArgs << '-Xlint:-path'
options.compilerArgs << '-Xlint:-processing'
options.compilerArgs << '-Xlint:-rawtypes'
options.compilerArgs << '-Xlint:-serial'
options.compilerArgs << '-Xlint:-static'
options.compilerArgs << '-Xlint:-try'
options.compilerArgs << '-Xlint:-unchecked'
options.compilerArgs << '-Xlint:-varargs'
}