Repository navigation
Expand file tree
/
Copy pathsettings.gradle.kts
More file actions
160 lines (149 loc) · 6.6 KB
/
Copy pathsettings.gradle.kts
File metadata and controls
160 lines (149 loc) · 6.6 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
import java.net.URI
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
pluginManagement {
// This block is compiled earlier than the rest of the script, so keep it self-contained.
// ARTIFACTORY_RESOLVE_URL is the CI Edge override. Local/off-VPN keeps ARTIFACTORY_URL
// or the artifactoryUrl Gradle property (SaaS).
val artifactoryUrl = (System.getenv("ARTIFACTORY_RESOLVE_URL")
?: System.getenv("ARTIFACTORY_URL")
?: providers.gradleProperty("artifactoryUrl").orNull)
?.removeSuffix("/")
val artifactoryUsername = System.getenv("ARTIFACTORY_USERNAME")
?: System.getenv("ARTIFACTORY_ACCESS_USERNAME")
?: providers.gradleProperty("artifactoryUsername").orNull
val artifactoryPassword = System.getenv("ARTIFACTORY_ACCESS_TOKEN")
?: System.getenv("ARTIFACTORY_PASSWORD")
?: providers.gradleProperty("artifactoryPassword").orNull
repositories {
maven {
if (artifactoryUrl != null && artifactoryUsername != null && artifactoryPassword != null) {
url = java.net.URI("$artifactoryUrl/plugins.gradle.org/")
credentials { username = artifactoryUsername; password = artifactoryPassword }
} else {
url = java.net.URI("https://plugins.gradle.org/m2/")
}
}
}
}
plugins {
id("org.jetbrains.intellij.platform.settings") version "2.19.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
id("com.gradle.develocity") version "4.6.0"
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.8.0"
}
rootProject.name = "sonarlint-intellij"
val artifactoryUrl = ((System.getenv("ARTIFACTORY_RESOLVE_URL")
?: System.getenv("ARTIFACTORY_URL")
?: extra.properties["artifactoryUrl"] as? String)
?.removeSuffix("/")).orEmpty()
val artifactoryUsername = (System.getenv("ARTIFACTORY_USERNAME")
?: System.getenv("ARTIFACTORY_ACCESS_USERNAME")
?: extra.properties["artifactoryUsername"] as? String).orEmpty()
val artifactoryPassword = (System.getenv("ARTIFACTORY_ACCESS_TOKEN")
?: System.getenv("ARTIFACTORY_PASSWORD")
?: extra.properties["artifactoryPassword"] as? String).orEmpty()
dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.PREFER_SETTINGS
@Suppress("UnstableApiUsage")
repositories {
if (artifactoryUrl.isNotEmpty() && artifactoryUsername.isNotEmpty() && artifactoryPassword.isNotEmpty()) {
maven("$artifactoryUrl/sonarsource") {
credentials {
username = artifactoryUsername
password = artifactoryPassword
}
}
// IDE installer tarballs are not on Edge (HTTP 404). Keep Ivy fetches on SaaS.
val installerArtifactoryUrl = "https://repox.jfrog.io/artifactory"
intellijPlatform {
localPlatformArtifacts()
maven("$artifactoryUrl/jetbrains-intellij-dependencies") {
name = "IntelliJ Platform Dependencies Repository"
credentials {
username = artifactoryUsername
password = artifactoryPassword
}
}
ivy {
name = "JetBrains IDE Installers"
url = URI("$installerArtifactoryUrl/jetbrains-download")
credentials {
username = artifactoryUsername
password = artifactoryPassword
}
patternLayout {
artifact("[organization]/[module]-[revision](-[classifier]).[ext]")
artifact("[organization]/[module]-[revision](.[classifier]).[ext]")
artifact("[organization]/[revision]/[module]-[revision](-[classifier]).[ext]")
artifact("[organization]/[revision]/[module]-[revision](.[classifier]).[ext]")
artifact("[organization]/[module]-[revision]-[classifier].tar.gz")
}
content {
IntelliJPlatformType.values()
.filter { it != IntelliJPlatformType.AndroidStudio }
.mapNotNull { it.installer }
.forEach {
includeModule(it.groupId, it.artifactId)
}
}
metadataSources { artifact() }
}
ivy {
name = "Android Studio Installers"
url = URI("$installerArtifactoryUrl/android-studio")
credentials {
username = artifactoryUsername
password = artifactoryPassword
}
patternLayout {
artifact("/ide-zips/[revision]/[artifact]-[revision]-[classifier].[ext]")
artifact("/install/[revision]/[artifact]-[revision]-[classifier].[ext]")
}
content {
val coordinates = IntelliJPlatformType.AndroidStudio.installer
requireNotNull(coordinates)
includeModule(coordinates.groupId, coordinates.artifactId)
}
metadataSources { artifact() }
}
maven("$artifactoryUrl/intellij-releases") {
name = "IntelliJ Repository (Releases)"
credentials {
username = artifactoryUsername
password = artifactoryPassword
}
}
}
} else {
mavenCentral()
intellijPlatform {
localPlatformArtifacts()
jetbrainsIdeInstallers()
androidStudioInstallers()
intellijDependencies()
releases()
}
}
}
}
include("its", "clion", "clion-resharper", "nodejs", "common", "git", "rider", "test-common")
val isCiServer = System.getenv("CI") != null
buildCache {
local {
isEnabled = !isCiServer
}
remote(develocity.buildCache) {
isEnabled = true
isPush = isCiServer
}
}
develocity {
server = "https://develocity.sonar.build"
buildScan {
publishing.onlyIf { isCiServer && it.isAuthenticated }
capture {
buildLogging.set(!startParameter.taskNames.contains("properties"))
}
}
}