1

我看到https://github.com/JetBrains/MPS-extensions通过 GitHub 发布版本,但是将工件集成到基于 MPS 的项目中看起来并不方便。

如果我的项目是通过 MPS 构建的并且依赖于 MPS 扩展,该怎么办?如果有一种方法可以通过命令行自动下载适当的扩展工件(例如./gradlew downloadExtensions) ,那就太好了

4

1 回答 1

1

以下对我有用:

build.gradle(见https://github.com/Hardella/ide61131/blob/8088fbd9bcc2780f5772856a962fbfe6954b3e50/build.gradle):

repositories {
    maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }
    mavenCentral()
}

configurations {
    mpsExtensions
}

dependencies {
    mpsExtensions "de.itemis.mps:extensions:2018.2.+"
}

task resolve_extensions(type: Copy) {
    dependsOn configurations.mpsExtensions
    from {
        configurations.mpsExtensions.resolve().collect { zipTree(it) }
    }
    into "lib"
}

然后./gradlew resolve_extensions下载并解压mps-extensionslib/de.itemis.mps.extensions/...文件夹中。

然后可以通过-> -> /将其插入MPS实例。PreferencesBuild, Execution, DeploymentProject LibrariesGlobal Libraries

以下.mps/libraries.xml将库配置为Project Library

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectLibraryManager">
    <option name="libraries">
      <map>
        <entry key="mps-extensions">
          <value>
            <Library>
              <option name="name" value="mps-extensions" />
              <option name="path" value="$PROJECT_DIR$/lib/de.itemis.mps.extensions" />
            </Library>
          </value>
        </entry>
      </map>
    </option>
  </component>
</project>
于 2018-11-05T13:44:48.583 回答