forked from aws/aws-toolkit-jetbrains
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle.kts
173 lines (155 loc) · 5.46 KB
/
settings.gradle.kts
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
162
163
164
165
166
167
168
169
170
171
172
173
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import kotlin.collections.ArrayDeque
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
val codeArtifactMavenRepo = fun RepositoryHandler.(): MavenArtifactRepository? {
val codeArtifactUrl: Provider<String> = providers.environmentVariable("CODEARTIFACT_URL")
val codeArtifactToken: Provider<String> = providers.environmentVariable("CODEARTIFACT_AUTH_TOKEN")
return if (codeArtifactUrl.isPresent && codeArtifactToken.isPresent) {
maven {
url = uri(codeArtifactUrl.get())
credentials {
username = "aws"
password = codeArtifactToken.get()
}
}
} else {
null
}
}.also {
pluginManagement {
repositories {
it()
gradlePluginPortal()
}
}
}
plugins {
id("com.github.burrunan.s3-build-cache") version "1.5"
id("com.gradle.develocity") version "3.17.6"
id("org.jetbrains.intellij.platform.settings") version "2.1.0"
}
dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
repositories {
codeArtifactMavenRepo()
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}
}
buildscript {
// match with version catalog, s3-build-cache has silent classpath conflict with codegen task
// also since this is a settings plugin, we can't use a version catalog
dependencies {
classpath(platform("software.amazon.awssdk:bom:2.26.25"))
}
}
val regionEnv: Provider<String> = providers.environmentVariable("AWS_REGION")
val bucketEnv: Provider<String> = providers.environmentVariable("S3_BUILD_CACHE_BUCKET")
val prefixEnv: Provider<String> = providers.environmentVariable("S3_BUILD_CACHE_PREFIX")
if (regionEnv.isPresent && bucketEnv.isPresent && prefixEnv.isPresent) {
// TODO: can we serve a remote cache out of CloudFront instead? https://docs.gradle.org/8.1/userguide/build_cache.html#sec:build_cache_configure_remote
buildCache {
local {
isEnabled = false
}
remote<com.github.burrunan.s3cache.AwsS3BuildCache> {
region = regionEnv.get()
bucket = bucketEnv.get()
prefix = prefixEnv.get()
isPush = true
lookupDefaultAwsCredentials = true
}
}
}
develocity {
buildScan {
// only publish with `--scan` argument
publishing.onlyIf { false }
if (System.getenv("CI") == "true") {
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
}
obfuscation {
username { "<username>" }
hostname { "<hostname>" }
ipAddresses { it.map { "0.0.0.0" } }
}
}
}
apply(from = "kotlinResolution.settings.gradle.kts")
rootProject.name = "aws-toolkit-jetbrains"
include("detekt-rules")
include("ui-tests")
include("sandbox-all")
include("ui-tests-starter")
when (providers.gradleProperty("ideProfileName").get()) {
// FIX_WHEN_MIN_IS_242: `tmp-all` test module no longer needed in 242+
"2023.3", "2024.1" -> {
include("tmp-all")
// only available 242+
project(":ui-tests-starter").projectDir = file("noop")
}
}
/*
plugins/
core/ :plugin-core
community/ :plugin-core:community
ultimate/ :plugin-core:ultimate
...
toolkit/ :plugin-toolkit
resources/ :plugin-toolkit:resources
...
amazonq/ :plugin-amazonq
codewhisperer/ :plugin-amazonq:codewhisperer
community/ :plugin-amazonq:codewhisperer:ultimate
ultimate/ :plugin-amazonq:codewhisperer:community
codemodernizer/ ...
community/ ...
ultimate/
featuredev/
community/
ultimate/
mynah-ui/ :plugin-amazonq:mynah-ui
*/
file("plugins").listFiles()?.forEach root@ {
if (!it.isDirectory) return@root
val pluginRoot = "plugin-${it.name}"
include(":$pluginRoot")
project(":$pluginRoot").projectDir = it
val path = ArrayDeque<String>()
it.walk().maxDepth(3)
.onEnter {
// dont bother traversing a directory if it does not declare a subproject
if (!it.resolve("build.gradle.kts").isFile) {
return@onEnter false
}
if (path.isEmpty()) {
path.addLast("plugin-${it.name}")
} else {
path.addLast(it.name)
}
return@onEnter true
}
.onLeave {
path.removeLastOrNull()
}
.filter { it.isDirectory && it.resolve("build.gradle.kts").isFile }
.iterator()
.forEach {
if (it.name == "jetbrains-gateway") {
when (providers.gradleProperty("ideProfileName").get()) {
// buildSrc is evaluated after settings so we can't key off of IdeVersions.kt
"2023.3", "2024.1" -> {
return@forEach
}
}
}
val projectName = path.joinToString(separator = ":", prefix = ":")
include(projectName)
project(projectName).projectDir = it
}
}