Skip to content

Commit 24abfdb

Browse files
committed
feat(git-import): new docker image for running the Git importer
1 parent 0f478c9 commit 24abfdb

File tree

16 files changed

+165
-5
lines changed

16 files changed

+165
-5
lines changed

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
"bulk-model-sync-gradle",
1111
"datastructures",
1212
"deps",
13+
"git-import",
1314
"metamodel-export",
1415
"model-api-gen",
1516
"model-api-gen-gradle",
@@ -19,7 +20,6 @@ module.exports = {
1920
"model-server",
2021
"model-server-openapi",
2122
"modelql",
22-
"mps-git-import-plugin",
2323
"mps-model-adapters",
2424
"mps-model-server",
2525
"mps-sync-plugin",

docker-build-gitimport.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
TAG=$( ./modelix-version.sh )
6+
7+
(
8+
cd mps-git-import-cli
9+
if [ "${CI}" = "true" ]; then
10+
docker buildx build --platform linux/amd64,linux/arm64 --push \
11+
-t modelix/mps-git-import:latest -t "modelix/mps-git-import:${TAG}" .
12+
else
13+
docker build \
14+
-t modelix/mps-git-import:latest -t "modelix/mps-git-import:${TAG}" .
15+
fi
16+
)

docker-ci.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ set -e
55
echo "$DOCKER_HUB_KEY" | docker login -u "$DOCKER_HUB_USER" --password-stdin
66

77
./docker-build-model.sh
8+
./docker-build-gitimport.sh

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ kotlinSerialization="1.8.1"
3232
ignite="2.17.0"
3333
apacheCxf="3.6.6"
3434
node="22.14.0"
35-
modelixBuildtools="1.8.1"
35+
modelixBuildtools="1.9.0"
3636
openapi = "7.12.0"
3737
micrometer = "1.14.6"
3838
dokka = "2.0.0"

mps-git-import-cli/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM eclipse-temurin:21
2+
ARG MPS_VERSION="2024.1.3"
3+
4+
RUN apt update && apt install wget ant -y
5+
6+
# download MPS and extract into /mps
7+
RUN set -e \
8+
&& mkdir /mpstmp \
9+
&& cd /mpstmp \
10+
&& MPS_MAJOR_VERSION=`echo "$MPS_VERSION" | grep -oE '20[0-9]{2}\.[0-9]+'` \
11+
&& wget "https://download.jetbrains.com/mps/${MPS_MAJOR_VERSION}/MPS-${MPS_VERSION}.tar.gz" \
12+
&& tar -xf $(ls | head -n 1) \
13+
&& mv "MPS $MPS_MAJOR_VERSION" "/mps" \
14+
&& cd .. \
15+
&& rm -rf /mpstmp \
16+
&& rm -rf /mps/jbr
17+
18+
COPY build/install/mps-git-import-cli /mps-git-import-cli
19+
20+
#RUN /mps-git-import-cli/bin/mps-git-import-cli self-test
21+
22+
ENTRYPOINT ["/mps-git-import-cli/bin/mps-git-import-cli"]
23+
CMD ["self-test"]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import org.modelix.mpsHomeDir
2+
3+
plugins {
4+
`modelix-kotlin-jvm-with-junit`
5+
`maven-publish`
6+
application
7+
alias(libs.plugins.modelix.mps.buildtools)
8+
}
9+
10+
dependencies {
11+
implementation(project(":mps-git-import"))
12+
implementation(libs.modelix.buildtools.lib)
13+
14+
compileOnly(
15+
fileTree(mpsHomeDir).matching {
16+
include("lib/**/*.jar")
17+
},
18+
)
19+
}
20+
21+
application {
22+
mainClass.set("org.modelix.mps.gitimport.cli.MainKt")
23+
}
24+
25+
tasks.assemble {
26+
dependsOn(tasks.installDist)
27+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.modelix.mps.gitimport.cli
2+
3+
import org.modelix.buildtools.runner.MPSRunner
4+
import org.modelix.buildtools.runner.MPSRunnerConfig
5+
import java.io.File
6+
import java.util.UUID
7+
8+
fun main(args: Array<String>) {
9+
val buildDir = File("/tmp/git-import-build")
10+
val workDir = File("/tmp/git-import-work")
11+
buildDir.mkdirs()
12+
workDir.mkdirs()
13+
val config = MPSRunnerConfig(
14+
mainClassName = "org.modelix.mps.gitimport.MainKt",
15+
mainMethodName = "runFromAnt",
16+
mpsHome = File("/mps"),
17+
jarFolders = listOf(File("/mps-git-import-cli/lib")),
18+
jvmArgs = args.mapIndexed { index, arg -> "-Dmodelix.git.import.args.$index=$arg" },
19+
moduleId = UUID.randomUUID(),
20+
buildDir = buildDir,
21+
workDir = workDir,
22+
)
23+
val runner = MPSRunner(config)
24+
runner.run()
25+
}

mps-git-import-plugin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ dependencies {
1919
exclude("org.slf4j", "slf4j-api")
2020
}
2121

22+
implementation(project(":mps-git-import"), excludeMPSLibraries)
2223
implementation(project(":bulk-model-sync-lib"), excludeMPSLibraries)
2324
implementation(project(":bulk-model-sync-mps"), excludeMPSLibraries)
2425
implementation(project(":mps-model-adapters"), excludeMPSLibraries)
2526
implementation(project(":model-client"), excludeMPSLibraries)
2627
implementation(project(":datastructures"), excludeMPSLibraries)
2728
implementation(libs.modelix.mpsApi, excludeMPSLibraries)
2829
implementation(libs.kotlin.logging, excludeMPSLibraries)
29-
implementation(libs.kotlin.html, excludeMPSLibraries)
3030
implementation(libs.kotlin.datetime, excludeMPSLibraries)
3131
implementation("org.eclipse.jgit:org.eclipse.jgit:7.2.0.202503040940-r")
3232
implementation("com.github.ajalt.clikt:clikt:5.0.3")

mps-git-import/build.gradle.kts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import org.modelix.mpsHomeDir
2+
3+
plugins {
4+
`modelix-kotlin-jvm-with-junit`
5+
`maven-publish`
6+
}
7+
8+
dependencies {
9+
implementation(project(":bulk-model-sync-lib"))
10+
implementation(project(":bulk-model-sync-mps"))
11+
implementation(project(":mps-model-adapters"))
12+
implementation(project(":model-client"))
13+
implementation(project(":datastructures"))
14+
implementation(libs.modelix.mpsApi)
15+
implementation(libs.kotlin.logging)
16+
implementation(libs.kotlin.datetime)
17+
implementation("org.eclipse.jgit:org.eclipse.jgit:7.2.0.202503040940-r")
18+
api("com.github.ajalt.clikt:clikt:5.0.3")
19+
20+
compileOnly(
21+
fileTree(mpsHomeDir).matching {
22+
include("lib/**/*.jar")
23+
},
24+
)
25+
}
26+
27+
group = "org.modelix.mps"
28+
29+
java {
30+
withSourcesJar()
31+
}
32+
33+
publishing {
34+
publications {
35+
create<MavenPublication>("maven") {
36+
artifactId = "git-import"
37+
from(components["java"])
38+
}
39+
}
40+
}
File renamed without changes.

0 commit comments

Comments
 (0)