{"id":18485,"date":"2024-11-29T09:38:39","date_gmt":"2024-11-29T07:38:39","guid":{"rendered":"https:\/\/www.btc-embedded.com\/?p=18485"},"modified":"2024-11-29T10:02:25","modified_gmt":"2024-11-29T08:02:25","slug":"how-to-automate-dependency-management-part-1","status":"publish","type":"post","link":"https:\/\/www.btc-embedded.com\/zh-hans\/how-to-automate-dependency-management-part-1\/","title":{"rendered":"How to Automate Dependency Management: Part 1"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"18485\" class=\"elementor elementor-18485\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3b5f0493 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3b5f0493\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-559a247a\" data-id=\"559a247a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d83c847 elementor-widget elementor-widget-text-editor\" data-id=\"d83c847\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Very few people develop their software from scratch. Why would they, after all, when so many others have already done the work for almost any algorithm you could think of? Rather than re-invent the wheel, it\u2019s more efficient (and more fun) to work on the novel tasks in front of you and let someone else handle the technical details with a quick \u2018import\u2019.<\/p><p>But this strength of re-using software comes with a very great weakness: dependency management. What do you do when the module you\u2019re importing upgrades to a new version? How do you ensure that your own code still works, and there are no unintended side effects of the upgrade?<\/p><p>Most people just handle these upgrades manually, and because of the effort that can be involved, this often means their dependencies are often several versions behind the latest release. This isn\u2019t necessarily a bad thing, but it does mean you\u2019re missing out on bugfixes, performance improvements, and new features. And you don\u2019t need to! With some simple workflow automation, you can reap the benefits of CI\/CD best practices and let your process work for you!<\/p><p>In <strong>this article<\/strong>, I\u2019ll explain current best practices for dependency management in an MBD context. By the end of it, you\u2019ll have enough familiarity with the process as whole to be able to implement your own production CI pipeline for managing, migrating, and testing dependencies! You\u2019ll also have set up your own sample dependency migration pipeline, so you have a practical example to reference.<\/p><p>In part 1 of <strong>this article<\/strong> (you are here!), I\u2019ll focus on the development part of the toolchain, where we restructure an original monolithic model to version its dependencies and build them on-the-fly. In <a href=\"https:\/\/www.btc-embedded.com\/how-to-automate-dependency-management-part-2\/\">part 2<\/a> of <strong>this article<\/strong>, I\u2019ll add in a CI pipeline to automatically migrate and test our dependencies to the latest version. Here\u2019s an outline of the steps we\u2019ll be going through:<\/p><ol><li><strong>Creating our original, unified model<\/strong><\/li><li><strong>Separating out our model into main module and dependency module<\/strong><\/li><li><strong>Serving our dependency module through a package-manager<\/strong><\/li><li>Migrating our main module to use the latest version of its dependency<\/li><li>Testing the main module to validate the migration didn\u2019t break anything<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1144c66 elementor-widget elementor-widget-heading\" data-id=\"1144c66\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step 1: Creating our Model <\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9a4031e elementor-widget elementor-widget-text-editor\" data-id=\"9a4031e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>First things first, we need some models! I\u2019m going to be shamelessly stealing the example my coworker, Thabo, has already developed, and build up from there. If you\u2019re curious, the git repos have the fully-fledged example all worked out, but I\u2019m only going to be grabbing the \u2018core\u2019 files to begin with. If you want to follow along, <a href=\"https:\/\/github.com\/thabok\/deps-swc-1\" target=\"_blank\" rel=\"noopener\">navigate<\/a> to the first repo, and grab the swc_1.slx and start.m files (these files, by the way, were generated for MATLAB R2023b) from inside the src folder.<\/p><p>These two files will define my main unit, but they won\u2019t run unless I also get the dependency library along with them. <a href=\"https:\/\/github.com\/thabok\/deps-shared-mod-a\" target=\"_blank\" rel=\"noopener\">Navigate<\/a> to the other git repo, and download the shared_module_a.slx inside the src folder, placing it in the same directory as the model from above.<\/p><p>Just to make sure nothing went wrong, go ahead and run start.m in your Matlab workspace, and then open and simulate swc_1:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aed285d elementor-widget elementor-widget-image\" data-id=\"aed285d\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"405\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog1.png\" class=\"attachment-large size-large wp-image-18489\" alt=\"\" srcset=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog1.png 1430w, https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog1-768x389.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Happy as a clam!<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-46f5d1e elementor-widget elementor-widget-heading\" data-id=\"46f5d1e\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step 2: Separating Out our Model <\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-223dfa0 elementor-widget elementor-widget-text-editor\" data-id=\"223dfa0\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Now that we know they work together, let\u2019s separate them, so that they can be versioned independently. You can delete any cache folders created by Simulink, and then structure the models into two separate folders<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b103197 elementor-widget elementor-widget-image\" data-id=\"b103197\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"520\" height=\"318\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog2.png\" class=\"attachment-large size-large wp-image-18492\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d3e7a30 elementor-widget elementor-widget-text-editor\" data-id=\"d3e7a30\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>And from here, I\u2019m going to create two separate git repos and commit them both. First, create the repositories in GitHub, using the web interface (they can be uninitialized\/empty, and mine are set to \u2018private\u2019). Then, for both the dep folder and swc1 folders, initialize and commit them to their respective repositories:<\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">git init<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">git add .<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">git commit \u2013m \u201cinitial model commit\u201d<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">git remote add origin https:\/\/github.com\/btc-nathand\/swc1.git<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">git branch -M main<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">git push -u origin main<\/span><\/p><p>Replacing the URL in both cases with the appropriate link to the repository you just created in the GitHub web interface.<\/p><p>Success! We\u2019ve broken the link between our main SWC and its dependent!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f572598 elementor-widget elementor-widget-heading\" data-id=\"f572598\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step 3: Serving the Dependency to the Main Module <\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-50171a1 e-grid e-con-boxed e-con e-parent\" data-id=\"50171a1\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-395d17e elementor-widget elementor-widget-text-editor\" data-id=\"395d17e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Now that we\u2019ve separated the two models, we\u2019re going to want to also have some way to bring them back together again\u2014otherwise we\u2019ve just broken everything, with no benefit to anyone! We\u2019ll do this by treating the dependent as an independently developed software module\u2014and that means we need to set up an artifact repository server to make the file available to other modules, so our main unit can ask for the dependencies it needs.<\/p><p>At a high level, this is the intended workflow we\u2019re looking to set up in this step: <\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-89c13cb elementor-widget elementor-widget-image\" data-id=\"89c13cb\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"1043\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog3.png\" class=\"attachment-large size-large wp-image-18495\" alt=\"\" srcset=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog3.png 876w, https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog3-768x1001.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8345d3f elementor-widget elementor-widget-text-editor\" data-id=\"8345d3f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Developer 1 and Developer 2 work on their codebases separately. When Developer 1 is finished, he releases his code publicly; this lets Developer 2 pull it in as a dependency to her own code. This lets Developer 2 have strict separation of concerns between code she\u2019s responsible for and code she\u2019s just using, and also gives a way for her to explicitly track which version of dependent code she needs.<\/p><p>Having a way to separate out the development environment (my code!) from the dependency source (your code!) is vital here. While we could use something like git submodules, this would blur the line between responsibilities, and we still could (accidently or maliciously!) push unintended changes to the dependency. What we need isn\u2019t just a way to import code from one place to another\u2014we need a full-blown way of versioning and serving code as a \u2018black-box\u2019 with strict controls between unrelated projects. What we need is a package manager!<\/p><p>There are lots of mature, maintained package managers out there, and any one of those will work. One of the more well-known ones is JFrog\u2019s Artifactory, which is a dual-bundle artifact serving tool with an environment definition tool called Conan, and I\u2019ll be using these in this tutorial. First, download the <a href=\"https:\/\/conan.io\/downloads\" target=\"_blank\" rel=\"noopener\">latest<\/a> Artifactory installer (on a real production workflow, this would be hosted on a separate server, but running it locally is perfectly fine for this example). Navigate into the app\/bin directory and double-click on \u201cartifactory.bat\u201d to start up the service. Go into your browser and navigate to <a href=\"http:\/\/localhost:8081\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost:8081<\/a>, where you should see a pretty, green welcome screen. Log in with the default username (admin) and password (password), and you\u2019ll be prompted through some basic configuration options. Leave everything as default, and finally you\u2019ll be greeted with the main loading page:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a74899f elementor-widget elementor-widget-image\" data-id=\"a74899f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"379\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog4.png\" class=\"attachment-large size-large wp-image-18498\" alt=\"\" srcset=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog4.png 1393w, https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog4-768x364.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-971f023 elementor-widget elementor-widget-text-editor\" data-id=\"971f023\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>From here, we\u2019re going to create a new repository to host and serve our dependency module. Configure it as a local Conan project and give it a unique key. Because we\u2019re running all this locally, we don\u2019t need to set up any user management permissions, but again, this would be helpful in a production environment.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-027a727 elementor-widget elementor-widget-image\" data-id=\"027a727\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"225\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog5.png\" class=\"attachment-large size-large wp-image-18503\" alt=\"\" srcset=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog5.png 1430w, https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog5-768x216.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c74f18e elementor-widget elementor-widget-text-editor\" data-id=\"c74f18e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Switch back to your IDE. To connect our git, where our dependency is stored, with Artifactory, where it\u2019s served, we have to create a conanfile in the dependency module file structure. Create a file named conanfile.py, and put the following text into it, replacing the URL with your own repo. If you\u2019re curious about the configuration options available here, you can read more on the <a href=\"https:\/\/docs.conan.io\/2.0\/tutorial\/creating_packages\/create_your_first_package.html\" target=\"_blank\" rel=\"noopener\">Conan website<\/a>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7ae7b78 elementor-widget elementor-widget-text-editor\" data-id=\"7ae7b78\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">from conan import ConanFile<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">from conan.tools.files import copy<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">class MyPackage(ConanFile):<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 name = &#8220;shared_module_a&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 version = &#8220;1.0.0&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 license = &#8220;MIT&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 url = &#8220;https:\/\/github.com\/btc-nathand\/dep&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 description = &#8220;Conan package for Shared Module A&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 exports_sources = &#8220;*.slx&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 no_copy_source = False<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 def package(self):<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 copy(self, &#8220;*.slx&#8221;, self.source_folder, self.package_folder, keep_path=False)<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-89a3ea2 elementor-widget elementor-widget-text-editor\" data-id=\"89a3ea2\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Save the file and open a terminal to finish the packaging. First, let\u2019s do some restructuring, so that our project isn\u2019t just a flat folder:<\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">cd dep<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">mkdir src<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">mv shared_module_a src<\/span><\/p><p>Of course, we need to install Conan to have it available. We\u2019re also going to need to finish our configuration by telling Conan where our dependency is supposed to go when we release it, and then finalize our changes and push them as our first commit:<\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">pip install conan<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">conan profile detect<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">conan remote add artifactory http:\/\/localhost:8081\/artifactory\/api\/conan\/dep-repo-conan<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">conan create .<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">conan upload shared_module_a -r=artifactory<\/span><\/p><p>And with that we\u2019ve successfully uploaded our dependency! This means it\u2019s available for anyone to download from our server; the next step is to tell our main SWC how to find and install it, so that we can create a complete running module.<\/p><p>We\u2019ll need to go back into our main SWC, and create a conanfile, but instead of uploading to the Artifactory repo, we\u2019ll point it to pull and merge in the dependency with our own model at build time. Create another conanfile.py, with the following contents:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a6254ba elementor-widget elementor-widget-text-editor\" data-id=\"a6254ba\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">from os.path import join<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">from conan import ConanFile<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">from conan.tools.env import VirtualBuildEnv, VirtualRunEnv<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">from conan.tools.files import copy<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">class SWC1(ConanFile):<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 name = &#8220;swc_1&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 version = &#8220;1.0.0&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 license = &#8220;MIT&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 url = &#8220;https:\/\/github.com\/btc-nathand\/swc1&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 description = &#8220;Conan package for SWC1&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 requires = &#8220;shared_module_a\/1.0.0&#8221;<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0 def generate(self):<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # disable generation of scripts in the build folder<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 VirtualBuildEnv(self)<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 VirtualRunEnv(self)<\/span><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # copy model files from dependencies root folder into<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # folders with the dep-name inside the build_folder<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for dep in self.dependencies.values():<\/span><\/p><p class=\"MsoNormal\" style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoSubtleReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 copy(self, &#8220;*.slx&#8221;, dep.package_folder, join(self.build_folder, &#8216;shared&#8217;))<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9d45b84 elementor-widget elementor-widget-text-editor\" data-id=\"9d45b84\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We\u2019ll want this at the root level of swc1 to define our project. Then, much like with the dependency, we\u2019ll restructure our main module project hierarchy, and create the conan project:<\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">cd swc1<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">mkdir src<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">mv swc_1.slx src<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">mv start.m src<\/span><\/p><p class=\"MsoNormal\" style=\"line-height: 18.56px; font-size: 12pt; margin: 0cm 0cm 8pt; font-family: Aptos, sans-serif; color: #000000;\"><span class=\"MsoIntenseReference\" style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #0f4761; letter-spacing: 0.25pt; font-weight: bold;\">conan create .<\/span><\/p><p>Finally, tell Conan to pull in the dependencies it needs from our Artifactory server:<\/p><p><span style=\"color: #0f4761; font-family: Aptos, sans-serif; font-variant-caps: small-caps; font-weight: bold; letter-spacing: 0.333333px;\">conan install . -r artifactory<\/span><\/p><p>Just to make sure that everything is pieced together, I\u2019m going to look at my workspace and confirm that my missing dependency did, in fact, get downloaded:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e16b074 elementor-widget elementor-widget-image\" data-id=\"e16b074\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"510\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog6.png\" class=\"attachment-large size-large wp-image-18516\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f2ec5c2 elementor-widget elementor-widget-text-editor\" data-id=\"f2ec5c2\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>You\u2019ll notice that now, in addition to the files we added in and moved around by hand, we have a \u2018shared\u2019 folder next the \u2018src\u2019, which contains our resolved dependency. Great! Our Artifactory server is doing its job. To make sure that this doesn\u2019t get checked into git (it\u2019s supposed to be resolved at build time\u2014ideally, a local initialization script will run our \u2018conan install\u2019 command along with doing a git pull to make sure everything is up to date), lets pop in a quick .gitignore:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-692b7f2 elementor-widget elementor-widget-text-editor\" data-id=\"692b7f2\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\"># ignore anything from the simulink cache &amp; all generated files<\/span><\/p><p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">*.slxc<\/span><\/p><p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">*_ert_rtw\/<\/span><\/p><p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">slprj\/<\/span><\/p><p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">*.html<\/span><\/p><p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\"># ignore shared modules that are added by the package manager<\/span><\/p><p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">shared\/<\/span><\/p><p style=\"margin: 0cm 0cm 8pt; line-height: 18.56px; font-size: 12pt; font-family: Aptos, sans-serif; color: #000000;\"><span style=\"font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-caps: small-caps; font-variant-alternates: normal; font-variant-position: normal; font-variant-emoji: normal; color: #5a5a5a;\">conan.log<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-25eca1d elementor-widget elementor-widget-text-editor\" data-id=\"25eca1d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>You can go ahead and copy over the same .gitignore into the dep repo as well.<\/p><p>Great! We&#8217;ve just finished setting up our system so that it can successfully upload and resolve dependencies. Now\u2019s a good point to save everything through a git upload.<\/p><p>We\u2019ve done a lot, so let\u2019s summarize our status so far. From a developer perspective, everything\u2019s been finished:<\/p><p>&#8211; The maintainer of dep, when he\u2019s done making his changes, in addition to checking in to git (for internal maintenance), also makes them available to other teams through Artifactory (for external linkage), by doing a \u2018conan upload\u2019<\/p><p>&#8211; The maintainer of SWC1, when she\u2019s ready to develop her software, simply declares her dependencies, and then runs a \u2018conan install\u2019 to bring all the defined dependency versions into her \u2018shared\u2019 folder<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3e867ee elementor-widget elementor-widget-image\" data-id=\"3e867ee\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"431\" src=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog7.png\" class=\"attachment-large size-large wp-image-18513\" alt=\"\" srcset=\"https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog7.png 1430w, https:\/\/www.btc-embedded.com\/wp-content\/uploads\/2024\/11\/blog7-768x414.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Very few people develop their software from scratch. Wh [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":19068,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[124,53,123,48,122,51,80,121],"product":[],"use_cases":[],"class_list":["post-18485","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-embedded-coder","tag-iso-26262","tag-matlab","tag-simulink","tag-standard-tools","tag-targetlink","tag-test-generation","tag-testing"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts\/18485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=18485"}],"version-history":[{"count":39,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts\/18485\/revisions"}],"predecessor-version":[{"id":19079,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/posts\/18485\/revisions\/19079"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/media\/19068"}],"wp:attachment":[{"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=18485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=18485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=18485"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/product?post=18485"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.btc-embedded.com\/zh-hans\/wp-json\/wp\/v2\/use_cases?post=18485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}