<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0"
     xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xml:base="https://specificlanguages.com/">
  <channel>
    <title>Troubleshooting on Specific Languages</title>
    <link>https://specificlanguages.com/categories/troubleshooting/</link>
    <description>Recent content in Troubleshooting on Specific Languages</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>sergej@specificlanguages.com (Sergej Koščejev)</managingEditor>
    <webMaster>sergej@specificlanguages.com (Sergej Koščejev)</webMaster>
    <lastBuildDate>Sat, 03 Aug 2019 09:47:37 +0200</lastBuildDate>
    
    <atom:link href="https://specificlanguages.com/categories/troubleshooting/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Build script error: &#34;Dependency on a module not visible from current build project&#34;</title>
      <link>https://specificlanguages.com/posts/build-script-errors/dependency-on-a-module-not-visible-from-current-build-project/</link>
      <pubDate>Sat, 03 Aug 2019 09:47:37 +0200</pubDate>
      <author>sergej@specificlanguages.com (Sergej Koščejev)</author>
      <guid>https://specificlanguages.com/posts/build-script-errors/dependency-on-a-module-not-visible-from-current-build-project/</guid>
      <description>&lt;p&gt;(Last updated on Oct 20, 2021)&lt;/p&gt;
&lt;h2 id=&#34;the-problem&#34;&gt;The problem&lt;/h2&gt;
&lt;p&gt;You have created a language based on the mbeddr platform, MPS Extensions, or KernelF (or all of the above). Now the time
has come to create a build script for your language to package it for delivery to the users. However, after creating the
build script you get an error message saying &lt;code&gt;Error: dependency on a module not visible from current build project&lt;/code&gt;:&lt;/p&gt;</description>
      <content:encoded xml:base="https://specificlanguages.com/posts/build-script-errors/dependency-on-a-module-not-visible-from-current-build-project/"><![CDATA[ <p>(Last updated on Oct 20, 2021)</p>
<h2 id="the-problem">The problem</h2>
<p>You have created a language based on the mbeddr platform, MPS Extensions, or KernelF (or all of the above). Now the time
has come to create a build script for your language to package it for delivery to the users. However, after creating the
build script you get an error message saying <code>Error: dependency on a module not visible from current build project</code>:</p>
<p><img src="error.png" alt="Dependency on a module not visible from current build project"></p>
<h2 id="what-is-going-on-here">What is going on here?</h2>
<p>The solution <code>jetbrains.mps.samples.theSimplestLanguage.sandbox</code> depends on a module<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup> (here
<code>org.iets3.core.base</code>) but the build script doesn&rsquo;t have the information required to locate this module.</p>
<p>Even though you can build the project successfully from MPS, the build language is designed to describe your project on
a lower level. Rather than depending on libraries or plugins, <em>build scripts depend on other build scripts</em>. Build
scripts produce artifacts in a certain <em>layout</em> and the build scripts that depend on them expect to find these artifacts
in a certain location in this exact layout.</p>
<h2 id="is-the-dependency-required">Is the dependency required?</h2>
<p>Before continuing, check (or ask yourself) whether the dependency is indeed intentional and required. You could have
added it by accident (it&rsquo;s very easy to just press Enter in response to a pop-up dialog that MPS shows when importing
models). Or perhaps it was required by an intermediate version of the code but is no longer necessary in the final
version.</p>
<p>To check, open the properties of the depending module. If the dependency is grayed out, it means it is unused and you
can remove it.</p>
<h2 id="adding-missing-dependencies">Adding missing dependencies</h2>
<h3 id="switch-from-plugins-to-project-libraries">Switch from plugins to project libraries</h3>
<p>If you have installed your dependencies from the JetBrains Marketplace as plugins, you will need to switch to
using project libraries:</p>
<ol>
<li>Download the corresponding distribution from GitHub or itemis Nexus.</li>
<li>Unpack the distribution into a folder. I recommend using a subdirectory of your MPS project directory, such as
<code>deps</code>.</li>
<li>Add the unpacked distribution as a <a href="https://www.jetbrains.com/help/mps/library-manager.html">project library</a>. You can also add the entire <code>deps</code> directory
instead.</li>
</ol>
<h3 id="add-the-dependency-to-the-build-script">Add the dependency to the build script</h3>
<ol>
<li>Open the build script of your project and go to the <code>dependencies:</code> section.</li>
<li>Press Enter to add a new entry.</li>
<li>Import the model containing the build script you want to add. Do it either by using the usual Ctrl/Cmd+R
shortcut and typing the <em>build script name</em> or by using Ctrl/Cmd+M and searching for the <em>model</em>
containing the build script.</li>
<li>Type <code>(</code> to have the <code>(artifacts location .)</code> text appear. Replace the <code>.</code> with the location of the distribution.
Example: <code>./deps/org.iets3.opensource</code>.</li>
</ol>
<p>The result should look like this:</p>
<p><img src="build-script-dependencies.png" alt="Dependency on org.iets3.opensource added"></p>
<p>After adding the dependency use the <em>Reload modules from disk</em> intention to update the module dependencies and the error
should disappear.</p>
<h2 id="build-scripts-of-popular-libraries">Build scripts of popular libraries</h2>
<p>Here are the build scripts you need to depend on for some of the popular libraries (as of October 2021). The build
script link <a href="https://www.jetbrains.com/help/mps/http-support-plugin.html#nodeurls">opens the script in MPS</a>:</p>
<table>
	<thead>
			<tr>
					<th>Project</th>
					<th>Build Script</th>
					<th>Containing Model</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><a href="https://github.com/IETS3/iets3.opensource/">KernelF/iets3.opensource</a></td>
					<td><a href="http://127.0.0.1:63320/node?ref=r%3Ac3d6ae0c-8b10-477f-a3e9-5dc8700ceb13%28org.iets3.opensource.build.build%29%2F6354991446090808661"><code>org.iets3.opensource</code></a></td>
					<td><code>org.iets3.opensource.build</code></td>
			</tr>
			<tr>
					<td><a href="https://github.com/mbeddr/mbeddr.core">mbeddr Platform</a></td>
					<td><a href="http://127.0.0.1:63320/node?ref=r%3A742f344d-4dc4-4862-992c-4bc94b094870%28com.mbeddr.mpsutil.dev.build%29%2F4160126263863194133"><code>com.mbeddr.platform</code></a></td>
					<td><code>com.mbeddr.mpsutil.dev.build</code></td>
			</tr>
			<tr>
					<td><a href="https://github.com/JetBrains/MPS-extensions">MPS extensions</a></td>
					<td><a href="http://127.0.0.1:63320/node?ref=r%3Afb24ac52-5985-4947-bba9-25be6fd32c1a%28de.itemis.mps.extensions.build%29%2F3410197114990977083"><code>de.itemis.mps.extensions</code></a></td>
					<td><code>de.itemis.mps.extensions.build</code></td>
			</tr>
	</tbody>
</table>
<h2 id="more-resources">More Resources</h2>
<ul>
<li>Kolja Dummann has recorded a <a href="https://www.twitch.tv/videos/324864370?collection=OR4XS68jXxWXAw">Twitch stream</a> on the topic of setting up the build of an MPS project. The video
is part of the &ldquo;Heavy Meta&rdquo; series of videos about MPS.</li>
</ul>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>This is of course just an artificial dependency added to <code>theSimplestLanguage</code> sample project for
demonstration purposes.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
