avito-android
106 строк · 3.5 Кб
1rootProject.name = "build-logic-settings"
2
3pluginManagement {
4// See rationale inside this script
5apply(from = "dependency-plugin/pluginManagement-shared.settings.gradle.kts")
6}
7
8val isInternalBuild = booleanProperty("avito.internalBuild", false)
9
10if (!isInternalBuild) {
11logger.warn(
12"""
13| -----------------------------------------
14| WARNING!
15| This build doesn't use `avito.internalBuild`
16|
17| For Avito employees only: it makes the build slower and less hermetic.
18| For external contributors: some artifacts might be not published yet to Maven Central.
19| -----------------------------------------
20""".trimMargin()
21)
22}
23
24val parentBuild = gradle.parent
25
26/**
27* --dry-run on root build executes tasks in a composite build
28* Workaround to https://github.com/gradle/gradle/issues/2517
29*/
30if (parentBuild != null && parentBuild.startParameter.isDryRun) {
31gradle.startParameter.isDryRun = true
32}
33
34@Suppress("UnstableApiUsage")
35dependencyResolutionManagement {
36
37@Suppress("UnstableApiUsage")
38repositories {
39exclusiveContent {
40forRepository {
41maven {
42if (isInternalBuild) {
43val artifactoryUrl: String by settings
44name = "Proxy for gradle-plugins: https://plugins.gradle.org/m2/"
45setUrl("$artifactoryUrl/gradle-plugins")
46isAllowInsecureProtocol = true
47} else {
48name = "gradle-plugins"
49setUrl("https://plugins.gradle.org/m2/")
50}
51}
52}
53filter {
54includeGroupByRegex("com\\.gradle.*")
55includeGroupByRegex("org\\.jetbrains.*")
56}
57}
58exclusiveContent {
59forRepository {
60maven {
61if (isInternalBuild) {
62val artifactoryUrl: String by settings
63name = "Proxy for gradle-plugins: https://repo1.maven.org/maven2"
64setUrl("$artifactoryUrl/mavenCentral")
65isAllowInsecureProtocol = true
66} else {
67name = "mavenCentral"
68setUrl("https://repo1.maven.org/maven2")
69}
70}
71}
72filter {
73includeGroup("net.java.dev.jna")
74}
75}
76}
77}
78
79// HACK:
80// We apply here the same settings as we provide by convention-cache plugin.
81// Conventional way is to inherit build cache configuration from the root project into all included builds.
82// The problem is - it doesn't work for included builds inside `pluginManagement`.
83// They applied before the cache configuration in the root project itself.
84// https://docs.gradle.org/current/userguide/build_cache.html#sec:build_cache_composite
85apply(from = "cache-plugin/convention-cache.settings.gradle.kts")
86
87include("dependency-plugin")
88include("scan-plugin")
89include("extensions")
90
91fun Settings.booleanProperty(name: String, defaultValue: Boolean): Boolean {
92return if (extra.has(name)) {
93extra[name]?.toString()?.toBoolean() ?: defaultValue
94} else {
95defaultValue
96}
97}
98
99fun Settings.stringProperty(name: String, nullIfBlank: Boolean = false): String? {
100return if (extra.has(name)) {
101val string = extra[name]?.toString()
102if (nullIfBlank && string.isNullOrBlank()) null else string
103} else {
104null
105}
106}
107