Skip to content

Commit 6c9d895

Browse files
authored
Merge pull request #705 from modelix/build/deduplicate-repositories
MODELIX-875 Deduplicate repository declarations
2 parents 1fcee2a + f3818a0 commit 6c9d895

File tree

16 files changed

+154
-190
lines changed

16 files changed

+154
-190
lines changed

build-logic/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}

build-logic/settings.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
dependencyResolutionManagement {
17+
repositories.gradlePluginPortal()
18+
versionCatalogs {
19+
create("libs") {
20+
from(files("../gradle/libs.versions.toml"))
21+
}
22+
}
23+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// For some projects we need to redeclare repositories on project level
18+
// because plugins like npm and intellij may override our settings
19+
repositories {
20+
val modelixRegex = "org\\.modelix.*"
21+
mavenLocal {
22+
content {
23+
includeGroupByRegex(modelixRegex)
24+
}
25+
}
26+
gradlePluginPortal {
27+
content {
28+
excludeGroupByRegex(modelixRegex)
29+
}
30+
}
31+
maven {
32+
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
33+
content {
34+
includeGroupByRegex(modelixRegex)
35+
includeGroup("com.jetbrains")
36+
}
37+
}
38+
mavenCentral {
39+
content {
40+
excludeGroupByRegex(modelixRegex)
41+
}
42+
}
43+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
val modelixRegex = "org\\.modelix.*"
18+
pluginManagement {
19+
repositories {
20+
mavenLocal {
21+
content {
22+
includeGroupByRegex(modelixRegex)
23+
}
24+
}
25+
gradlePluginPortal {
26+
content {
27+
excludeGroupByRegex(modelixRegex)
28+
}
29+
}
30+
mavenCentral {
31+
content {
32+
excludeGroupByRegex(modelixRegex)
33+
}
34+
}
35+
maven {
36+
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
37+
content {
38+
includeGroupByRegex(modelixRegex)
39+
}
40+
}
41+
}
42+
}
43+
dependencyResolutionManagement {
44+
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
45+
repositories {
46+
gradlePluginPortal {
47+
content {
48+
excludeGroupByRegex(modelixRegex)
49+
}
50+
}
51+
mavenCentral {
52+
content {
53+
excludeGroupByRegex(modelixRegex)
54+
}
55+
}
56+
maven {
57+
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
58+
content {
59+
includeGroupByRegex(modelixRegex)
60+
includeGroup("com.jetbrains")
61+
}
62+
}
63+
}
64+
}
File renamed without changes.

build.gradle.kts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,6 @@ subprojects {
171171
}
172172

173173
allprojects {
174-
repositories {
175-
val modelixRegex = "org\\.modelix.*"
176-
mavenLocal {
177-
content {
178-
includeGroupByRegex(modelixRegex)
179-
}
180-
}
181-
maven {
182-
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
183-
content {
184-
includeGroupByRegex(modelixRegex)
185-
includeGroup("com.jetbrains") // for our mps dependencies
186-
}
187-
}
188-
mavenCentral {
189-
content {
190-
excludeGroupByRegex(modelixRegex)
191-
}
192-
}
193-
}
194-
195174
publishing {
196175
repositories {
197176
maven {

buildSrc/build.gradle.kts

Lines changed: 0 additions & 7 deletions
This file was deleted.

bulk-model-sync-gradle-test/build.gradle.kts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,6 @@ plugins {
1919
id("org.modelix.bulk-model-sync")
2020
}
2121

22-
repositories {
23-
val modelixRegex = "org\\.modelix.*"
24-
gradlePluginPortal {
25-
content {
26-
excludeGroupByRegex(modelixRegex)
27-
}
28-
}
29-
maven {
30-
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
31-
content {
32-
includeGroupByRegex(modelixRegex)
33-
includeGroup("com.jetbrains")
34-
}
35-
}
36-
mavenCentral {
37-
content {
38-
excludeGroupByRegex(modelixRegex)
39-
}
40-
}
41-
}
42-
4322
val kotlinGenDir = project.layout.buildDirectory.dir("metamodel/kotlin").get().asFile.apply { mkdirs() }
4423

4524
dependencies {

bulk-model-sync-gradle-test/settings.gradle.kts

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,52 +16,19 @@
1616

1717
pluginManagement {
1818
includeBuild("..")
19-
val modelixRegex = "org\\.modelix.*"
20-
repositories {
21-
gradlePluginPortal {
22-
content {
23-
excludeGroupByRegex(modelixRegex)
24-
}
25-
}
26-
maven {
27-
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
28-
content {
29-
includeGroupByRegex(modelixRegex)
30-
}
31-
}
32-
mavenCentral {
33-
content {
34-
excludeGroupByRegex(modelixRegex)
35-
}
36-
}
37-
}
19+
includeBuild("../build-logic")
3820
dependencyResolutionManagement {
3921
versionCatalogs {
4022
create("libs") {
4123
from(files("../gradle/libs.versions.toml"))
4224
}
4325
}
44-
repositories {
45-
gradlePluginPortal {
46-
content {
47-
excludeGroupByRegex(modelixRegex)
48-
}
49-
}
50-
maven {
51-
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
52-
content {
53-
includeGroupByRegex(modelixRegex)
54-
includeGroup("com.jetbrains")
55-
}
56-
}
57-
mavenCentral {
58-
content {
59-
excludeGroupByRegex(modelixRegex)
60-
}
61-
}
62-
}
6326
}
6427
}
6528

29+
plugins {
30+
id("modelix-repositories")
31+
}
32+
6633
includeBuild("..")
6734
include("graph-lang-api")

model-api-gen-gradle-test/build.gradle.kts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,6 @@ plugins {
77
}
88

99
subprojects {
10-
repositories {
11-
val modelixRegex = "org\\.modelix.*"
12-
mavenLocal {
13-
content {
14-
includeGroupByRegex(modelixRegex)
15-
}
16-
}
17-
gradlePluginPortal {
18-
content {
19-
excludeGroupByRegex(modelixRegex)
20-
}
21-
}
22-
maven {
23-
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
24-
content {
25-
includeGroupByRegex(modelixRegex)
26-
includeGroup("com.jetbrains")
27-
}
28-
}
29-
mavenCentral {
30-
content {
31-
excludeGroupByRegex(modelixRegex)
32-
}
33-
}
34-
}
35-
3610
plugins.withType<NodePlugin> {
3711
project.extensions.configure<NodeExtension> {
3812
version.set(libs.versions.node)

0 commit comments

Comments
 (0)