Difference between revisions of "Documentation/Nightly/Developers/Tutorials/BuildTestPackageDistributeExtensions"

From Slicer Wiki
Jump to: navigation, search
m
(moved to readthedocs)
Tags: 2017 source edit, Replaced
 
(37 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
<noinclude>{{documentation/versioncheck}}</noinclude>
 
<noinclude>{{documentation/versioncheck}}</noinclude>
== Step-by-step: How to create, publish and distribute an extension ? ==
 
  
<ol start="1" style="list-style-type: decimal;">
+
{{documentation/banner
 
+
| text  = [https://slicer.readthedocs.io/en/latest/developer_guide/extensions.html This page has been moved to read-the-docs.]
<li><p>Scan through the [[Documentation/{{documentation/version}}/FAQ/Extensions|user]] and [[Documentation/{{documentation/version}}/Developers/FAQ/Extensions|developer]] extension FAQs</p></li>
+
| background-color = 8FBC8F }}
 
 
<li><p>(Optionally) Present your extension(s) on the [http://massmail.bwh.harvard.edu/mailman/listinfo/slicer-devel slicer developers list] to check if other developer are working on a similar project, to seek for advice or to reach out for potential collaborator.</p></li>
 
 
 
<li><p>[[Documentation/{{documentation/version}}/Developers/Build_Instructions|Build Slicer application]] in <code>Release</code></p></li>
 
 
 
<li><p>Use the Wizard to create an extension bundling one Command line module:</p>
 
 
 
{|width = "100%"
 
! width="50%" style="border-bottom: 1px solid darkgrey;font-size: 75%;"| Linux or MacOSX
 
! width="50%" style="border-bottom: 1px solid darkgrey;font-size: 75%;"| Windows
 
|-
 
| valign="top" |
 
Start a terminal.
 
{{pre2|<nowiki>
 
$ cd Slicer
 
 
 
$ ../Slicer-SuperBuild/python-build/bin/python ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate/ --target ~/MyExtension MyExtension
 
 
 
$ rm -rf ~/MyExtension/CLIModuleTemplate/
 
 
 
$ ../Slicer-SuperBuild/python-build/bin/python ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate/CLIModuleTemplate/ --target ~/MyExtension/MyCLI MyCLI
 
 
 
$ sed -i.bak 's/add_subdirectory(CLIModuleTemplate)/add_subdirectory(MyCLI)/g' ~/MyExtension/CMakeLists.txt && rm ~/MyExtension/CMakeLists.txt.bak
 
</nowiki>}}
 
 
 
To learn more about:
 
: the Wizard, click [[Documentation/{{documentation/version}}/Developers/ModuleWizard|here]].
 
: the different type of modules, click [[Documentation/{{documentation/version}}/Developers/Modules|here]].
 
| valign="top" |
 
 
 
Start Git Bash (not the Windows command line). [https://help.github.com/articles/set-up-git#platform-windows Need help ?]
 
{{pre2|<nowiki>
 
$ cd Slicer
 
 
 
$ ../Slicer-SuperBuild/python-build/bin/Release/python.exe ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate/ --target ~/MyExtension MyExtension
 
 
 
$ rm -rf ~/MyExtension/CLIModuleTemplate/
 
 
 
$ ../Slicer-SuperBuild/python-build/bin/Release/python.exe ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate/CLIModuleTemplate/ --target ~/MyExtension/MyCLI MyCLI
 
 
 
$ sed.exe -i.bak 's/add_subdirectory(CLIModuleTemplate)/add_subdirectory(MyCLI)/g' ~/MyExtension/CMakeLists.txt && rm ~/MyExtension/CMakeLists.txt.bak
 
</nowiki>}}
 
|}
 
 
 
</li>
 
 
 
<li><p>Create a repository named <code>Slicer-MyExtension</code> to save your extension located in <code>~/MyExtension</code> directory.</p>
 
  <ol style="list-style-type:none; border-left:thick solid darkgreen; padding-left:1em;"> 
 
    <li>We recommend [https://github.com/ GitHub]. [https://help.github.com/articles/create-a-repo Need help ?]</li>
 
    <li>Read our [[Documentation/{{documentation/version}}/Developers/FAQ/Extensions|FAQ]] to learn about repository naming convention.
 
  </ol>
 
</li>
 
 
 
<li><p>Implement your extension. <code>Hack, hack, hack :)</code>. Make sure to commit often using meaningful commit message.</p></li>
 
 
 
<li><p>[[Documentation/{{documentation/version}}/Developers/Tutorials/DocumentExtension#Extension_page|Create a documentation page for your extension]].</p></li>
 
 
 
<li><p>[[Documentation/{{documentation/version}}/Developers/Tutorials/ObtainExtensionServerApiKey|Create an account on the extension server and obtain an API Key]]. You will then use your midas login and api key to substitute <code><YOUR-MIDAS-LOGIN></code> and <code><YOUR-MIDAS-APIKEY></code> in the examples.</p></li>
 
 
 
<li><p>If not already done, go to [http://slicer.kitware.com/midas3/community/23 NA-MIC community] and click on <code>Join community</code></p></li>
 
 
 
<li>{{:Documentation/{{documentation/version}}/Developers/Tutorials/BuildTestPackageDistributeExtensions/ExperimentalFolderAccess}}</li>
 
 
 
<li><p>Assuming the source code of your extension is located in folder <code>MyExtension</code>, you could upload your extension doing:
 
 
 
{|width = "100%"
 
! width="50%" style="border-bottom: 1px solid darkgrey;font-size: 75%;"| Linux or MacOSX (Makefile)
 
! width="50%" style="border-bottom: 1px solid darkgrey;font-size: 75%;"| Windows (Visual Studio)
 
|-
 
| valign="top" |
 
{{pre2|<nowiki>
 
$ mkdir MyExtension-build
 
 
 
$ cd MyExtension-build
 
 
 
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DMIDAS_PACKAGE_EMAIL:STRING=<YOUR-MIDAS-LOGIN> -DMIDAS_PACKAGE_API_KEY:STRING=<YOUR-MIDAS-APIKEY> -DSlicer_DIR:PATH=/path/to/Slicer-Superbuild/Slicer-build ../MyExtension
 
 
 
$ make ExperimentalUpload
 
</nowiki>}}
 
| valign="top" |
 
<ol start="1" style="list-style-type: decimal;">
 
<li>Start CMake, select source and build directory</li>
 
<li>Add <code>Slicer_DIR</code>, <code>MIDAS_PACKAGE_EMAIL</code> and <code>MIDAS_PACKAGE_API_KEY</code> entries to the cache</li>
 
[[File:Slicer Extensions Configure Windows.png|600px]]
 
<li>Click on <code>Configure</code>, select Generator, then click on <code>Generate</code> button.</li>
 
<li>Open <code>MyExtension.sln</code> (1), select <code>Release</code> configuration (2), select <code>ExperimentalUpload</code> (3) and <code>Build</code> (4).</li>
 
[[File:Slicer_Extension_ExperimentalUpload_Windows_VS2008.png|400px]]
 
</ol>
 
|}
 
</p></li>
 
 
 
<li><p>Check submission results on the dashboard: http://slicer.cdash.org/index.php?project=Slicer4#Extensions-Experimental</p>
 
  <ol style="list-style-type:none; border-left:thick solid red; padding-left:1em;">
 
  <li>You should expect the test <code>MyCLITest</code> to fail with error of the form:
 
  {{pre2|scroll|[nrrd] nrrdIoStateDataFileIterNext: couldn't open "~/MyExtension-build/MyCLI/Data/Baseline/CLIModuleTemplateTest.raw"}}
 
  This is explained by the fact the <code>*.nhdr</code> file available on midas and downloaded locally still reference <code>CLIModuleTemplateTest.raw</code></li>
 
  </ol>
 
</li>
 
 
<li><p>Check that the extension can be installed by starting the Slicer executable from <code>/path/to/Slicer-Superbuild/Slicer-build</code> and installing your extension as explained [[Documentation/{{documentation/version}}/SlicerApplication/ExtensionsManager|here]].</p></li>
 
 
 
<li>
 
  <p>If you consider your extension ready for distribution, follow [[Documentation/{{documentation/version}}/Developers/Tutorials/Contribute_Extension_Description_File|these instructions.]] to contribute the already generated description file.</p>
 
  <ol style="list-style-type:none; border-left:thick solid darkgreen; padding-left:1em;"> 
 
    <li>The generated extension description file file is named <code>&lt;MyExtension&gt;.s4ext</code> and is located in the extension build directory <code>~/MyExtension-build</code></li>
 
    <li>Details about the extension description file formet are available [[Documentation/{{documentation/version}}/Developers/Extensions/DescriptionFile|here]]</li>
 
  </ol>
 
</li>
 
 
 
</ol>
 
 
 
<!--
 
<noinclude>
 
{{:Documentation/{{documentation/version}}/Developers/FAQ/Extensions|Extensions}}
 
</noinclude>
 
-->
 

Latest revision as of 20:39, 8 June 2020

Home < Documentation < Nightly < Developers < Tutorials < BuildTestPackageDistributeExtensions