Laravel nWidart/laravel-modules, move an existing module to another folder - laravel

I have a bunch of modules in Modules folder. For example "Modules/Customers"
And I need to move everything to "Modules/Core/Customers" keeping all the functionality working. Besides I must will use another subfolder for some modules:
Modules
|___ Core
| |__ Customers
| |__ Products
|
|___ External
|__ Taller
I suppose there might be three possibilities:
1- Lucky one: automatically with an artisan command, but I did not find anything on documentation (https://docs.laravelmodules.com/)
2- Manually changing files and configs, but I suppose that will leave namespaces unchanged, and that is not acceptable I would say.
3- Worst but likely: manually changing namespaces and config files.
I went for the third one as #lk77 suggested and everything was correct if I changed the folder for modules in config file module.php, except that then I cannot add several paths (or I don not find the way as it does not seem to be an array) or a more generic Modules/* as path.
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path used for save the generated module. This path also will be added
| automatically to list of scanned folders.
|
*/
'modules' => base_path('Modules/Core'),
Thanks a lot!!
Thanks very much

Here is what I finally did. For the existing modules created previously in "Modules":
1- Move files to Modules/Core folder and change manually all references to "Modules/" for "Modules/Core" in folders "app", "bootstrap" and "Modules" (with help of replace all from sublime :-) ). Afterwards it was necessary to manually change references in files "composer.json" and "module.json" of each module.
2- In config/modules.php activate scan:
'scan' => [
'enabled' => true,
'paths' => [
base_path('Modules/Core'),
base_path('Modules/External'),
base_path('vendor/*/*'),
],
],
After doing this old modules seemed to be working properly, but trying to include new ones triggered errors.
In fact the versions that included the feature to add the possibility for managing submodules/subfolders were retired shortly after the release.
So, finally I guess it is better not to use this approach with the package due to the problems.
In the end we are going to use subfolders in Laravel default tree for the core modules and use the package laravel-modules for external and optional custom modules:
app
|
|--- Http
| |
| |--- Controllers
| . |
| . |--- Customers
| |--- Products
|
|--- Models
. |
. |--- Customers
. |--- Products
.
.
Modules
|--- Taller
.
.
.

Related

Generate MAKFILE dependency with header and source files in separate directory

I have 3 layer architecture project for embedded
top layer - application
middle layer - middle(HAL Layer)
bottom layer - bottom(Driver layer)
I need to make a Makefile for the project with multiple source and header files which are in different directories.
For sake of understanding of makefile consider this as c project.
The issue I am facing is I am not able to generate the dependency files for the source files.
I have seen many tutorials but mostly in the example code of MAKEFILE, the header files are present in the same folder with the source files.
In my case the files are in the below structure.
project
|
|---- _build(DIR)
| --- Makefile
|
|---- application(DIR)
| inc/main.h
| src/main.c
|
|---- middle(DIR)
| inc/middle.h
| src/middle.c
|
|---- bottom(DIR)
| inc/bottom.h
| src/bottom.c
As the header files are in separate folder, I am not able to generate the dependency files(.d files).
Without including header files like
-I<header_files>
How to generate the dependency files?
http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
No Header file is included using -I options because source and header files are in same folder
Youtube example but same result, header and source in same folders.
https://www.youtube.com/watch?v=NPdagdEOBnI

How to specify Dapr component locations with Sidekick?

I'm trying to get started with Sidekick for Dapr, and am having trouble telling Sidekick where the dapr components are.
By default it's going to %USERPROFILE%.dapr\components, but I'd rather it go to a folder local to the solution.
Looking at the code it appears that adding the following to the appsettings.json should work, but it isn't picked up.
"DaprSidekick": {
"RuntimeDirectory": "dapr",
"ComponentsDirectory": "C:\\Dev\\DaprPOC\\components",
}
However the components folder invariably becomes %USERPROFILE%\.dapr\components
Any help on how I specify the component locations with Sidekick?
When you set "RuntimeDirectory": "dapr" Sidekick will automatically look for component files in the dapr/components subdirectory in your solution. Try removing the ComponentsDirectory entry so it returns to defaults, and try a directory structure like this:
|-- MyProject
| |-- MyProject.csproj
| |-- dapr
| | |-- config.yaml
| | |-- components
| | | |-- my_component.yaml
The Dapr Sidecar should then load my_component.yaml.
You can also manually add the components directory in the dependency injection:
services.AddDaprSidekick(configuration, p => p.Sidecar =
new DaprSidecarOptions() { AppId = "daprservice", ComponentsDirectory = "C:\\Dev\\DaprPOC\\components" });

Maven: how to make things different in a parent while all children behave otherwise?

I have a multi-module Maven project (one level deep only). I like not to have to repeat the same things in all child projects, but how can I still do it (avoir repeating) when the parent project itself needs a different setting ?
The example I’m facing is when trying to produce a common folder for all artifacts and dependencies (but I can imagine other equivalent situations):
<properties>
<__.build.folder>../last_build</__.build.folder>
</properties>
Of course, this will lead to a situation where I have two last_build folder, one common to all child projects, one in the upper level folder.
How can I avoid that without having to duplicate the same setting in every child pom.xml ?
Can I use profiles ?
I don’t know, I’m new to Maven.
Thanks
Edit :
In this example, last_build is a subfolder of the folder containing the parent pom.xml. The child projects are all in other subfolders, from which last_build has to be addressed as "../last_build" - but not in the parent pom.xml !
|
*--rootFolder
| |
| *--last_build // aggregation folder
| |
| *--subProject1
| | |
| | *--pom.xml (../last_build)
| |
| *--subProject2
| | |
| | *--pom.xml (../last_build)
| |
| *--subProject3
| | |
| | *--pom.xml (../last_build)
| |
| *--pom.xml (last_build) // different here for the parent project
I don't think you're proceeding down a very useful path and I think that you may be confused about a few things.
First, at the highest level, your root or parent pom, there should be no project, no code, no resources, and no artifact, so there should also be no output or need for an output directory. All you should have at the highest level is the parent pom and subdirectories containing modules.
The next problem is that you think you need a common build folder. I am hard pushed to imagine a rational scenario where that would be necessary. The artifacts one typically builds in maven are self-contained jars/wars -- one per module, and these are cached in the local repo whenever you build through the install lifecycle. They can be used in situ from there.

mvn idea:idea exclude folder wildcard?

Running mvn idea:idea to generate IntelliJ IDEA project files we stumble into a folder that must be avoided, let's say .avoidMe, which is located inside every folder as a placeholder.
folder1
|
+- .avoidMe
|
+- folder2
| |
| +- .avoidMe
|
+- folder3
| |
| +- .avoidMe
. . .
I've looked at idea:idea exclude options but none of them accepts wildcars (e.g. .avoidMe , "/.avoidMe/" or else ) so that I need to add every possible path to the exclude property ( e.g. folder1/.avoidMe,folder1/folder2/.avoidMe,folder1/folder3/.avoidMe )
The idea here is to use it to run IDEA inspections and publish the results into Sonar.
Is there any way to exclude file search using a wildcard or any other trick than exhaustive path search ?
are there any other ways to run IDEA inspections and publish them into Sonar ?
You should never use mvn idea:idea, it's obsolete and was not updated for years. It's also known to generate incorrect projects with the bugs that will be hard to trace later.
Instead, just import pom.xml in IDEA, project files will be generated by IDEA automatically.
You can then Exclude certain folders in Project Structure | Modules | Sources. Be aware that this configuration will be lost on the next reimport.
There is another configuration to exclude folders that is global and will be not lost on reimport: Settings | File Types | Ignore files and folders.

Cmake: add_subproject & add_subfolder

I currently want to add some self written classes ("mycode.cpp" and "mycode.hpp") to a big existing C++ project that is configured with Cmake. These classes are located in "myfolder" which is located in the "lib/pointrender" folder of the existing project (see dummy hierarchy below).
|- libs
| |- core
| | |- ...
| |- pointrender
| |- myfolder
| | |- mycode.cpp
| | |- mycode.hpp
| |- existingclasses.cpp
| |- existingclasses.hpp
| |- project.cmake
|- CMakeLists.txt
In the CMakesLists.txt the pointrender folder is declared as a subproject.
declare_subproject(libs/pointrender)
How do I best add my code to the existing cmake configuration? Do I add it as a subfolder in the project.cmake with a seperate CMakeLists.txt in myfolder? Or do I best add it as a subproject with a seperate project.cmake file? What's the difference?
This project.cmake is being include()d be some CMakeLists.txt and get's executed as part of it. Authors of project you are using rolled this out for some reason, so it's probably better to use their infrastructure to add custom code.
The usual way to do this is writing your own CMakeLists.txt and add_subdirectory()ing it from the upper level.
If you wish more details you should update your question with project.cmake contents.

Resources