Select Git revision
index.html 10.99 KiB
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="../img/favicon.ico">
<title>Adding RagConnect to your project - RagConnect dev</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700" />
<link rel="stylesheet" href="../css/theme.css" />
<link rel="stylesheet" href="../css/theme_extra.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/github.min.css" />
<link href="../css/version-select.css" rel="stylesheet" />
<script>
// Current page data
var mkdocs_page_name = "Adding RagConnect to your project";
var mkdocs_page_input_path = "adding.md";
var mkdocs_page_url = null;
</script>
<script src="../js/jquery-2.1.1.min.js" defer></script>
<script src="../js/modernizr-2.8.3.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href=".." class="icon icon-home"> RagConnect dev</a>
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../using/">RagConnect by Example</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../use_cases/">Use Cases</a>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal current" href="./">Adding RagConnect to your project</a>
<ul class="current">
<li class="toctree-l2"><a class="reference internal" href="#use-packaged-version">Use packaged version</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#build-from-source">Build from source</a>
</li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../dsl/">RagConnect Specification Language</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../compiler/">Compiler options</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../inner-workings/">Inner workings</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../extending/">Extending RagConnect</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../changelog/">Changelog</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../ragdoc/">API documentation</a>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="..">RagConnect dev</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="..">Docs</a> »</li>
<li>Adding RagConnect to your project</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<h1 id="adding-ragconnect-to-your-project">Adding <code>RagConnect</code> to your project<a class="headerlink" href="#adding-ragconnect-to-your-project" title="Permanent link"></a></h1>
<p>If you want to use <code>RagConnect</code>, either use the latest <a href="#use-packaged-version">pre-build version</a> or clone the repository and <a href="#build-from-source">build it yourself</a>.</p>
<h2 id="use-packaged-version">Use packaged version<a class="headerlink" href="#use-packaged-version" title="Permanent link"></a></h2>
<p>Check the <a href="https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/packages">package overview page</a> to find the latest version.</p>
<p>To use it, three steps are needed. First add this GitLab as a repository in your <code>build.gradle</code>:</p>
<pre><code>repositories {
maven {
name "gitlab-maven"
url "https://git-st.inf.tu-dresden.de/api/v4/groups/jastadd/-/packages/maven"
}
}
</code></pre>
<p>Next, add <code>RagConnect</code> as a dependency:</p>
<pre><code>configurations {
ragconnectClasspath
}
dependencies {
ragconnectClasspath group: 'de.tudresden.inf.st', name: 'ragconnect', version: '0.2.3'
}
</code></pre>
<p>Finally, add a task to compile your specification:</p>
<pre><code>task ragConnect(type: JavaExec) {
group = 'Build'
main = 'org.jastadd.ragconnect.compiler.Compiler'
classpath = configurations.ragconnectClasspath
args([
'--verbose',
'--o=src/gen/jastadd',
'src/main/jastadd/GoalModel.relast',
'src/main/jastadd/GoalModel.connect',
'--rootNode=GoalModel'
])
}
</code></pre>
<p>You might need to add another task for <a href="#compiling-relast-specifications">compiling relast specifications</a>.</p>
<h2 id="build-from-source">Build from source<a class="headerlink" href="#build-from-source" title="Permanent link"></a></h2>
<p>If you want to plan to extend <code>RagConnect</code>, the suggested way is to first build the jar from the <a href="https://git-st.inf.tu-dresden.de/jastadd/ragconnect">RagConnect repository</a> (if you only want to <em>use</em> it, consider using <a href="#use-packaged-version">the packaged version</a>).</p>
<pre><code class="language-bash">git clone https://git-st.inf.tu-dresden.de/jastadd/ragconnect.git
cd ragconnect
./gradlew jar
ls ragconnect.base/build/libs/
</code></pre>
<p>This <code>ragconnect-<version>.jar</code> can then be copied to your project.
Please note, that you can safely use <code>ragconnect.jar</code> as filename, because the version can always be printed using <code>java -jar path/to/ragconnect.jar --version</code>.</p>
<pre><code class="language-bash">cp ragconnect.base/build/libs/ragconnect-<version>.jar ../your-project/libs/ragconnect.jar
cd ../your-project/
</code></pre>
<p>Finally, this jar has to be integrated into your build process.
In case, <a href="https://gradle.org/">Gradle</a> is used, a task could look like the following (example taken from the <a href="https://git-st.inf.tu-dresden.de/jastadd/ros2rag">ros2rag use case</a>).
The path to the jar file may need to be changed according to your project structure.</p>
<pre><code class="language-groovy">task ragConnect(type: JavaExec) {
group = 'Build'
main = '-jar'
args([
'../libs/ragconnect.jar',
'--verbose',
'--o=src/gen/jastadd',
'src/main/jastadd/GoalModel.relast',
'src/main/jastadd/GoalModel.connect',
'--rootNode=GoalModel'
])
}
</code></pre>
<p>You might need to add another task for <a href="#compiling-relast-specifications">compiling relast specifications</a>.</p>
<h1 id="compiling-relast-specifications">Compiling RelAst specifications<a class="headerlink" href="#compiling-relast-specifications" title="Permanent link"></a></h1>
<p>The task to compile <code>RagConnect</code> specifications is typically accompanied by a task to invoke the <a href="http://relational-rags.eu/">RelAst compiler</a> and the <a href="https://plugins.gradle.org/plugin/org.jastadd">JastAdd gradle plugin</a>.
Currently, the parameter <code>--useJastAddNames</code> is <strong>required</strong>, and it may cause incompatibilities if not set.
The additional arguments <code>--listClass</code>, <code>--jastAddList</code> and <code>--resolverHelper</code> to relast are not required.
Please see the user manual of the RelAst compiler for more information.</p>
<pre><code class="language-groovy">task relastToJastAdd(type: JavaExec) {
group = 'Build'
main = "-jar"
args(["../libs/relast.jar",
"--grammarName=./src/gen/jastadd/model",
"--useJastAddNames",
"--listClass=java.util.ArrayList",
"--jastAddList=JastAddList",
"--resolverHelper",
"--file",
"src/gen/jastadd/GoalModel.relast",
"src/gen/jastadd/RagConnect.relast"])
}
jastadd {
...
}
</code></pre>
<p>One also has to specify the dependencies to get correct ordering of tasks.</p>
<pre><code class="language-groovy">generateAst.dependsOn relastToJastAdd
relastToJastAdd.dependsOn ragConnect
</code></pre>
</div>
</div>
<p>
<hr>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
<small><br><i>Last updated <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-datetime">November 24, 2021 09:05:52</span></i></small>
</p>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span><a href="../use_cases/" style="color: #fcfcfc">« Previous</a></span>
<span><a href="../dsl/" style="color: #fcfcfc">Next »</a></span>
</span>
</div>
<script>var base_url = '..';</script>
<script src="../js/theme_extra.js" defer></script>
<script src="../js/theme.js" defer></script>
<script src="../search/main.js" defer></script>
<script src="../js/version-select.js" defer></script>
<script defer>
window.onload = function () {
SphinxRtdTheme.Navigation.enable(true);
};
</script>
</body>
</html>