-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved mps-legacy-sync-plugin from modelix.core to here
It's the original implementation of the synchronization plugin between MPS and the model server. It was copied from https://github.com/modelix/modelix/tree/mps/2021.1/mps/org.modelix.model.mpsplugin . Also rescued most of the tests from https://github.com/modelix/modelix/tree/mps/2021.1/integrationtests .
- Loading branch information
Showing
148 changed files
with
10,788 additions
and
23,895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gradle" | ||
open-pull-requests-limit: 20 | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: {} | ||
# allow manual execution just in case | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
- name: Set up Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./gradlew --build-cache build -PciBuild=true | ||
- name: Archive test report | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: test-report | ||
path: | | ||
*/build/test-results | ||
*/build/reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Code linting | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: MPS compatibility | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: {} | ||
# allow manual execution just in case | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-mps-components: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
version: | ||
# Testing with the first and last version of the supported range should be enough. Breaking changes usually stay there | ||
# after being introduced. It's not expected that an incompatibility only exists in some intermediate version and then | ||
# becomes compatible again. | ||
# - "2020.3.6" VersionFixer was replaced by ModuleDependencyVersions in 2021.1 (used by model-sync-plugin) | ||
- "2021.1.4" | ||
# - "2021.2.6" | ||
# - "2021.3.3" | ||
# - "2022.2" | ||
# - "2022.3" | ||
- "2023.2" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
- name: Set up Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Build with ${{ matrix.version }} | ||
run: >- | ||
./gradlew --build-cache | ||
mpsCompatibility | ||
-Pmps.version=${{ matrix.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
newRelease: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.3.0' | ||
registry-url: 'https://artifacts.itemis.cloud/repository/npm-open/' | ||
scope: '<@modelix>' | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
- name: Set up Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Use tag as version | ||
run: echo "${GITHUB_REF#refs/*/}" > version.txt | ||
- name: Build and Publish Artifacts | ||
run: ./gradlew --build-cache build publish -PciBuild=true -Partifacts.itemis.cloud.user=${{secrets.ARTIFACTS_ITEMIS_CLOUD_USER}} -Partifacts.itemis.cloud.pw=${{secrets.ARTIFACTS_ITEMIS_CLOUD_PW}} -Pgpr.user=${{ github.actor }} -Pgpr.key=${{ secrets.GITHUB_TOKEN }} -Pgpr.universalkey=${{ secrets.GHP_UNIVERSAL_PUBLISH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.gradle/ | ||
/build/ | ||
/*/build/ | ||
.DS_Store | ||
.gradletasknamecache | ||
.idea/ | ||
*.iml | ||
kotlin_gen | ||
/version.txt | ||
/node_modules | ||
**/.ideaconfig | ||
**/.mpsconfig | ||
$LOG_DIR$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
default_install_hook_types: | ||
- pre-commit | ||
- commit-msg | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook | ||
rev: v9.4.0 | ||
hooks: | ||
- id: commitlint | ||
stages: [commit-msg] | ||
additional_dependencies: ["@commitlint/config-angular"] | ||
args: ["--config", "./commitlint.config.js"] | ||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks | ||
rev: v2.10.0 | ||
hooks: | ||
- id: pretty-format-kotlin | ||
args: | ||
# IMPORTANT: keep in sync with the version configured in build.gradle.kts | ||
- --ktlint-version=0.50.0 | ||
- --autofix | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
# IMPORTANT: keep in sync with the version configured in `vue-model-api/package.json` | ||
rev: v3.0.3 | ||
hooks: | ||
- id: prettier | ||
files: ^(vue-model-api)|(model-api-gen-gradle-test/vue-integration)/ | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
# IMPORTANT: keep versions of hook and additional dependencies in sync with the versions configured in `vue-model-api/package.json` | ||
rev: v8.50.0 | ||
hooks: | ||
- id: eslint | ||
additional_dependencies: | ||
- "[email protected]" | ||
- "[email protected]" | ||
- "@typescript-eslint/[email protected]" | ||
- "@typescript-eslint/[email protected]" | ||
files: ^vue-model-api/src/ | ||
'types': [ts] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin | ||
|
||
buildscript { | ||
dependencies { | ||
classpath(coreLibs.semver) | ||
} | ||
} | ||
|
||
plugins { | ||
`maven-publish` | ||
`version-catalog` | ||
alias(coreLibs.plugins.kotlin.multiplatform) apply false | ||
alias(coreLibs.plugins.kotlin.serialization) apply false | ||
alias(coreLibs.plugins.gitVersion) | ||
alias(coreLibs.plugins.node) apply false | ||
} | ||
|
||
group = "org.modelix.mps" | ||
version = computeVersion() | ||
println("Version: $version") | ||
|
||
fun computeVersion(): Any { | ||
val versionFile = file("version.txt") | ||
val gitVersion: groovy.lang.Closure<String> by extra | ||
return if (versionFile.exists()) { | ||
versionFile.readText().trim() | ||
} else { | ||
gitVersion() | ||
// Avoid duplicated "-SNAPSHOT" ending | ||
.let { if (it.endsWith("-SNAPSHOT")) it else "$it-SNAPSHOT" } | ||
// Normalize the version so that is always a valid NPM version. | ||
.let { if (it.matches("""\d+\.\d+.\d+-.*""".toRegex())) it else "0.0.1-$it" } | ||
.also { versionFile.writeText(it) } | ||
} | ||
} | ||
|
||
val parentProject = project | ||
|
||
subprojects { | ||
val subproject = this | ||
apply(plugin = "maven-publish") | ||
|
||
version = rootProject.version | ||
group = rootProject.group | ||
|
||
val kotlinApiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_6 | ||
subproject.tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = "11" | ||
freeCompilerArgs += listOf("-Xjvm-default=all-compatibility") | ||
if (!name.lowercase().contains("test")) { | ||
apiVersion = kotlinApiVersion.version | ||
} | ||
} | ||
} | ||
subproject.tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = "11" | ||
freeCompilerArgs += listOf("-Xjvm-default=all-compatibility") | ||
if (!name.lowercase().contains("test")) { | ||
apiVersion = kotlinApiVersion.version | ||
} | ||
} | ||
} | ||
|
||
subproject.plugins.withType<JavaPlugin> { | ||
subproject.extensions.configure<JavaPluginExtension> { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
} | ||
|
||
subproject.plugins.withType<KotlinPlatformJvmPlugin> { | ||
subproject.extensions.configure<KotlinJvmProjectExtension> { | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_11) | ||
} | ||
} | ||
} | ||
|
||
subproject.plugins.withType<KotlinMultiplatformPluginWrapper> { | ||
subproject.extensions.configure<KotlinMultiplatformExtension> { | ||
sourceSets.all { | ||
if (!name.lowercase().contains("test")) { | ||
languageSettings { | ||
apiVersion = kotlinApiVersion.version | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenLocal() | ||
maven { url = uri("https://artifacts.itemis.cloud/repository/maven-mps/") } | ||
mavenCentral() | ||
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") } | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "itemis" | ||
url = if (version.toString().contains("SNAPSHOT")) { | ||
uri("https://artifacts.itemis.cloud/repository/maven-mps-snapshots/") | ||
} else { | ||
uri("https://artifacts.itemis.cloud/repository/maven-mps-releases/") | ||
} | ||
credentials { | ||
username = project.findProperty("artifacts.itemis.cloud.user").toString() | ||
password = project.findProperty("artifacts.itemis.cloud.pw").toString() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
val mpsVersion = project.findProperty("mps.version")?.toString()?.takeIf { it.isNotEmpty() } | ||
?: "2023.2".also { ext["mps.version"] = it } | ||
println("Building for MPS version $mpsVersion") | ||
val mpsJavaVersion = if (mpsVersion >= "2022.2") 17 else 11 | ||
ext["mps.java.version"] = mpsJavaVersion | ||
|
||
// Extract MPS during configuration phase, because using it in intellij.localPath requires it to already exist. | ||
val mpsHome = project.layout.buildDirectory.dir("mps-$mpsVersion") | ||
val mpsZip by configurations.creating | ||
dependencies { mpsZip("com.jetbrains:mps:$mpsVersion") } | ||
mpsHome.get().asFile.let { baseDir -> | ||
if (baseDir.exists()) return@let // content of MPS zip is not expected to change | ||
|
||
println("Extracting MPS ...") | ||
sync { | ||
from(zipTree({ mpsZip.singleFile })) | ||
into(mpsHome) | ||
} | ||
|
||
// The build number of a local IDE is expected to contain a product code, otherwise an exception is thrown. | ||
val buildTxt = mpsHome.get().asFile.resolve("build.txt") | ||
val buildNumber = buildTxt.readText() | ||
val prefix = "MPS-" | ||
if (!buildNumber.startsWith(prefix)) { | ||
buildTxt.writeText("$prefix$buildNumber") | ||
} | ||
|
||
println("Extracting MPS done.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
org.gradle.jvmargs=-Xmx1024m "-XX:MaxMetaspaceSize=2g" | ||
systemProp.org.gradle.internal.http.socketTimeout=120000 | ||
kotlin.daemon.jvmargs=-Xmx2G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[bundles] | ||
|
||
[plugins] | ||
modelix-model-api-gen = { id = "org.modelix.model-api-gen", version.ref = "modelixCore" } | ||
npm-publish = { id = "dev.petuska.npm.publish", version = "3.4.1" } | ||
|
||
[versions] | ||
modelixCore = "3.15.0" | ||
|
||
[libraries] | ||
modelix-model-api = { group = "org.modelix", name = "model-api", version.ref = "modelixCore" } | ||
modelix-model-api-gen-runtime = { group = "org.modelix", name = "model-api-gen-runtime", version.ref = "modelixCore" } | ||
modelix-light-model-client = { group = "org.modelix", name = "light-model-client", version.ref = "modelixCore" } | ||
modelix-authorization = { group = "org.modelix", name = "authorization", version.ref = "modelixCore" } | ||
modelix-model-client = { group = "org.modelix", name = "model-client", version.ref = "modelixCore" } | ||
modelix-model-server = { group = "org.modelix", name = "model-server", version.ref = "modelixCore" } | ||
modelix-modelql-core = { group = "org.modelix", name = "modelql-core", version.ref = "modelixCore" } | ||
modelix-modelql-untyped = { group = "org.modelix", name = "modelql-untyped", version.ref = "modelixCore" } | ||
modelix-modelql-html = { group = "org.modelix", name = "modelql-html", version.ref = "modelixCore" } | ||
modelix-model-datastructure = { group = "org.modelix", name = "model-datastructure", version.ref = "modelixCore" } | ||
modelix-mps-model-adapters = { group = "org.modelix.mps", name = "model-adapters", version.ref = "modelixCore" } | ||
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging", version = "5.1.0" } | ||
kotlin-html = "org.jetbrains.kotlinx:kotlinx-html:0.10.1" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.