-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathsettings.gradle
More file actions
161 lines (146 loc) · 6.33 KB
/
settings.gradle
File metadata and controls
161 lines (146 loc) · 6.33 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import org.gradle.api.GradleException
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
import org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler
import org.gradle.api.tasks.JavaExec
import org.gradle.api.artifacts.dsl.DependencyHandler
// Gradle 9 removed the jcenter() helper but fearless-utils still calls it.
// Provide a shim so the included build keeps working until upstream is updated.
if (!DefaultRepositoryHandler.metaClass.respondsTo(DefaultRepositoryHandler, "jcenter")) {
DefaultRepositoryHandler.metaClass.jcenter << { Closure config = null ->
MavenArtifactRepository repo = delegate.maven {
name = "jcenter-compat"
url = uri("https://jcenter.bintray.com/")
}
if (config != null) {
config.delegate = repo
config.resolveStrategy = Closure.DELEGATE_FIRST
config()
}
repo
}
}
// Gradle 8+ removed JavaExec.main; fearless-utils still uses it in ktlint tasks.
if (!JavaExec.metaClass.respondsTo(JavaExec, "setMain", String)) {
JavaExec.metaClass.setMain { String mainClassName ->
mainClass.set(mainClassName)
}
}
if (!JavaExec.metaClass.respondsTo(JavaExec, "getMain")) {
JavaExec.metaClass.getMain { ->
mainClass.orNull
}
}
def tryLoadClass(String name) {
try {
return Class.forName(name)
} catch (Throwable ignored) {
return null
}
}
// Gradle 9 removed DependencyHandler.module(Object); keep it for legacy utils scripts.
def dependencyHandlerMetaTargets = [
DependencyHandler,
tryLoadClass("org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler")
].findAll { it != null }
dependencyHandlerMetaTargets.each { handlerClass ->
if (!handlerClass.metaClass.respondsTo(handlerClass, "module", Object)) {
handlerClass.metaClass.module << { Object notation ->
delegate.create(notation)
}
handlerClass.metaClass.module << { Object notation, Closure config ->
def dependency = delegate.create(notation)
config.delegate = dependency
config.resolveStrategy = Closure.DELEGATE_FIRST
config.call(dependency)
dependency
}
}
}
def moduleSelectorFactoryMethod = tryLoadClass("org.gradle.internal.component.external.model.DefaultModuleComponentSelector")?.declaredMethods?.find {
it.name == "newSelector" && it.parameterCount == 3
}
moduleSelectorFactoryMethod?.setAccessible(true)
def createModuleSelector = { Object notation ->
if (moduleSelectorFactoryMethod == null) {
throw new GradleException("Legacy module() shim unavailable: DefaultModuleComponentSelector not found")
}
def parts = notation.toString().split(":", 3)
if (parts.length < 2) {
throw new GradleException("module notation '$notation' must be 'group:name[:version]'")
}
def version = parts.length == 3 ? parts[2] : null
moduleSelectorFactoryMethod.invoke(null, parts[0], parts[1], version)
}
def dependencySubstitutionsClass = tryLoadClass("org.gradle.api.artifacts.DependencySubstitutions")
if (dependencySubstitutionsClass != null && !dependencySubstitutionsClass.metaClass.respondsTo(dependencySubstitutionsClass, "module", Object)) {
dependencySubstitutionsClass.metaClass.module << { Object notation ->
createModuleSelector(notation)
}
}
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "fearlessWallet"
include ':feature-crowdloan-impl'
include ':feature-crowdloan-api'
include ':feature-staking-impl'
include ':feature-staking-api'
include ':feature-wallet-impl'
include ':feature-wallet-api'
include ':feature-onboarding-impl'
include ':feature-onboarding-api'
include ':app', ':test-shared', ':common', ':feature-splash', 'core-db', 'core-api'
include ':runtime'
include ':feature-account-api'
include ':feature-account-impl'
include ':feature-polkaswap-api'
include ':feature-polkaswap-impl'
include ':feature-success-api'
include ':feature-success-impl'
include ':runtime-permission'
include ':feature-tonconnect-api'
include ':feature-tonconnect-impl'
include ':feature-walletconnect-api'
include ':feature-walletconnect-impl'
include ':feature-nft-api'
include ':feature-nft-impl'
include ':feature-liquiditypools-api'
include ':feature-liquiditypools-impl'
// Prefer a local fearless-utils-Android checkout when available.
def localUtilsPath = System.getenv("FEARLESS_UTILS_PATH")
if (localUtilsPath == null || localUtilsPath.trim().isEmpty()) {
localUtilsPath = new File(rootDir, "../fearless-utils-Android").canonicalPath
}
def localUtilsDir = new File(localUtilsPath)
// Enable Git source dependency fallback by setting -PUSE_REMOTE_UTILS=true or USE_REMOTE_UTILS=true
def useRemoteUtils = (
providers.gradleProperty("USE_REMOTE_UTILS").orNull?.toBoolean() ?: false
) || (System.getenv("USE_REMOTE_UTILS") == "true")
def forceLocalUtils = (
providers.gradleProperty("FORCE_LOCAL_UTILS").orNull?.toBoolean() ?: false
) || (System.getenv("FORCE_LOCAL_UTILS") == "true")
def gradleMajorVersion = gradle.gradleVersion.tokenize('.').first().toInteger()
def localUtilsSupported = gradleMajorVersion < 9
if (localUtilsDir.exists() && (localUtilsSupported || forceLocalUtils)) {
println("Including local fearless-utils from: ${localUtilsDir}")
includeBuild(localUtilsDir)
} else if (localUtilsDir.exists() && !forceLocalUtils && !localUtilsSupported) {
println("Skipping local fearless-utils because Gradle ${gradle.gradleVersion} is incompatible with its build scripts. Set FORCE_LOCAL_UTILS=true to override.")
if (useRemoteUtils) {
println("Using remote fearless-utils from GitHub via sourceControl")
sourceControl {
gitRepository("https://github.com/soramitsu/fearless-utils-Android.git") {
producesModule("jp.co.soramitsu.fearless-utils:fearless-utils")
}
}
} else {
println("No remote fallback configured; published artifacts will be used.")
}
} else if (useRemoteUtils) {
println("Including remote fearless-utils from GitHub via sourceControl")
sourceControl {
gitRepository("https://github.com/soramitsu/fearless-utils-Android.git") {
producesModule("jp.co.soramitsu.fearless-utils:fearless-utils")
}
}
} else {
println("No local fearless-utils checkout found; using published artifacts")
}