-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
94 lines (75 loc) · 2.9 KB
/
build.gradle.kts
File metadata and controls
94 lines (75 loc) · 2.9 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
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
92
93
94
/*
* Copyright (c) 2022(-0001) STMicroelectronics.
* All rights reserved.
* This software is licensed under terms that can be found in the LICENSE file in
* the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*/
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
buildscript {
repositories {
google()
mavenCentral()
}
}
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.benManes) apply true
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.kotlinSerialization) apply false
alias(libs.plugins.ksp) apply false
}
fun isNonStable(version: String): Boolean {
return version.contains("alpha", true) ||
version.contains("beta", true) ||
version.contains("dev", true)
}
// https://github.com/ben-manes/gradle-versions-plugin
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
}
// Extend the DefaultTask class to create a CustomSTmTask class
abstract class CustomSTmTask : DefaultTask() {
@TaskAction
fun assembleLibraries() {
println("All specified libraries have been assembled.")
}
@TaskAction
fun publishLibrariesOnLocalMaven() {
println("All specified libraries have been published on Local Maven.")
}
@TaskAction
fun publishLibrariesToGithubPackagesRepository() {
println("All specified libraries have been published on Github package repository.")
}
}
// Register the Tasks with type CustomSTmTask
tasks.register<CustomSTmTask>("assembleLibraries") {
group = "Custom STM Task"
description = "Compiles the st_blue_sdk and st_opus libraries."
val sdkTask = tasks.getByPath(":st_blue_sdk:assemble")
val opusTask = tasks.getByPath(":st_opus:assemble")
opusTask.mustRunAfter(sdkTask)
dependsOn(sdkTask, opusTask)
}
tasks.register<CustomSTmTask>("publishLibrariesOnLocalMaven") {
group = "Custom STM Task"
description = "publish on local Maven the st_blue_sdk and st_opus libraries."
val sdkTask = tasks.getByPath(":st_blue_sdk:publishToMavenLocal")
val opusTask = tasks.getByPath(":st_opus:publishToMavenLocal")
opusTask.mustRunAfter(sdkTask)
dependsOn(sdkTask, opusTask)
}
tasks.register<CustomSTmTask>("publishLibrariesToGithubPackagesRepository") {
group = "Custom STM Task"
description = "publish on Github package the st_blue_sdk and st_opus libraries."
val sdkTask = tasks.getByPath(":st_blue_sdk:publishBlueStSdkPublicationToGithubPackagesRepository")
val opusTask = tasks.getByPath(":st_opus:publishBlueStSdkPublicationToGithubPackagesRepository")
opusTask.mustRunAfter(sdkTask)
dependsOn(sdkTask, opusTask)
}