I am building a multi-module app, and I have included the modules in the project-level settngs.gradle file, in this manner:
include(":sub_module_1")
project(":sub_module_1").projectDir = file("../path/to/sub_module_1_folder")
include(":sub_module_2")
project(":sub_module_2").projectDir = file("../path/to/sub_module_2_folder")
include(":sub_module_3")
project(":sub_module_3").projectDir = file("../path/to/sub_module_3_folder")
Then I implement them in the app-level build.gradle file, in this manner:
implementation project(":sub_module_1")
implementation project(":sub_module_2")
implementation project(":sub_module_3")
So far, so good. The project builds and runs as expected.
However, in the Project Explorer (both Android & Project tabs), some modules appear inside the main project, while some appear outside of it. But all of the sub-module file folders are located outside of the main project folder. Here's an illustration of the Project Explorer (Android):
> sub_module_1
|__ manifests
|__ java
|__ res
> main_project
> app
|__ manifests
|__ java
|__ res
> sub_module_2
|__ java
> sub_module_3
|__ manifests
|__ java
|__ res
> Gradle Scripts
Q: What could be causing this?
Related
I have 2 Gradle projects both inside the same directory. The directory structure is as follows:
ParentDirectory\
GradleProjectA\
build.gradle
GradleProjectB\
settings.gradle
build.gradle
I want to add GradleProjectA as a dependency to GradleProjectB. In the settings.gradle for GradleProjectB, I've tried adding include 'GradleProjectA' and then in build.gradle: compile project(':GradleProjectA') but that didn't work.
Any help would be greatly appreciated. Thanks.
The way I did something like this is as follows:
GradleProjectB/settings.gradle:
include ':GradleProjectA'
project(':GradleProjectA').projectDir = new File('../GradleProjectA')
GradleProjectB/build.gradle:
compile project(":GradleProjectA")
In the latest version of Gradle, you can use Composite Builds, like that:
In GradleProjectB's settings.gradle, add the following line:
includeBuild "../GradleProjectA"
It will automatically handle dependency collisions and all that stuff.
The settings.gradle file needs to be in the parent directory specifying both.
Try the following format:
ParentDirectory\
build.gradle
settings.gradle <-- include 'GradleProjectA', 'GradleProjectB'
GradleProjectA/
build.gradle
GradleProjectB/
build.gradle
Edit:
Ok if your Parent Directory is not a build directory then you can do the following:
in your gradle project b settings.gradle file try the following:
includeFlat("GradleProjectA") // Include the project
in your b build.gradle:
compile project(":GradleProjectA")
includeFlat reference
The following should do the trick:
root
+-- projectA
| +-- build.gradle
| => dependencies { compile project(':common') }
| +-- settings.gradle
| => include ':common'
| project(':common').projectDir = new File('../common')
+-- projectB
| => same as projectA
+-- common
+-- build.gradle
=> regular build, probably with a "jar" section
You can create a settings.gradle in the parent directory. This just associates GradleProjectA with GradleProjectB. This is the approach used in the official Gradle docs. It would look like the following:
ParentDirectory/settings.gradle
rootProject.name = 'RootProject'
include 'GradleProjectA', 'GradleProjectB'
Then in GradleProjectB/build.gradle, you can simply write implementation project(':GradleProjectA') under dependencies.
If GradleProjectA and GradleProjectB are part of one multi-project Gradle build, then you probably want the settings.gradle in ParentDirectory and there include A and B. The way you use settings.gradle is not correct. Maybe you should re-read the section about multi-project gradle builds in the User Guide.
If the two projects are indiviual projects but you still want to depend on A from B, you might prefer to build A, release it to some repository (possibly the mavenLocal repository) and then depend on the built artifacts from project B.
I am looking for a way to combine all my "Applications" references into a common directory inside the AppX package. The project types of the references are standard Visual C++ (Win32) projects. The current structure of my solution is as follows:
Solution Structure
* Solution
|__ Exe_1 (Visual C++ Project)
|__ Exe_2 (Visual C++ Project)
|__ Exe_3 (Visual C++ Project)
|
|__ MyApp (AppX Project)
|__ Applications
| |__ Exe_1
| |__ Exe_2
| |__ Exe_3
|___ Images\
|___ Package.appxmanifest
After publishing the solution and deploying the AppX package, I get the following directory structure:
[ Actual ] Deployed AppX Directory Structure
Com.MyApp.12107._cx40ttqa_n3.48019.0_x64zyj5
|__ Exe_1\Exe_1.exe
|__ Exe_2\Exe_2.exe
|__ Exe_3\Exe_3.exe
[ Expected ] Deployed AppX Directory Structure
Com.MyApp.12107._cx40ttqa_n3.48019.0_x64zyj5
|__ Exe_1.exe
|__ Exe_2.exe
|__ Exe_3.exe
What I tried
I tried following this guide on MSDN, but it didn't help for Visual C++-based projects.
Changing the "Output directory" on executable's project properties didn't make any effect.
Added a Post-Build Event in the AppX project to manually move the files.
What I want to achieve
A similar result to how Apple managed to pack iTunes' related files in the root app directory.
UPDATE #1
I've edited the MyApp.wapproj file in the AppX project and modified the following lines:
<ProjectReference Include="..\Exe_1\Exe_1.vcxproj">
<OutputItemType>Content</OutputItemType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</ProjectReference>
With the modification in hand, the EXE is now only copied but not used as a real entry point. The case is similar to the Post-Build Event method.
As of time of writing, Visual Studio 2019 (v16.6.4) doesn't offer a built-in option to change output paths for referenced "Applications". Alternatively, you have to revoke all Applications references from the projects and append the following under the imports of the assets in your .wapproj project file:
<Content Include="..\Path\To\Your\Exe_1\Exe_1.exe" />
<Content Include="..\Path\To\Your\Exe_2\Exe_2.exe" />
<Content Include="..\Path\To\Your\Exe_3\Exe_3.exe" />
Additionally, you will need to replace the the tag <EntryPointProjectUniqueName> with <EntryPointExe> since we're not dealing with referenced applications anymore (at least in the author's case.)
<EntryPointExe>..\Path\To\Your\Exe_1\Exe_1.exe</EntryPointExe>
Finally, you will obtain an output similar to the expectation stated by the author after deploying it to a machine.
Feedback from Microsoft
As you can imagine there is a reason that we do this and the primary
concern is duplicate filenames as well as some issues with uploading
to the store. As of now there is no override that we provide that will
allow you to achieve this although there are some hacks you could do
to make it possible but it is not advised.
Scoban [MSFT]
The discussion can be found here.
I have recently packaged an electron app using electron-builder:
myProject/
├── package.json
├── app/
└── release/
All files created by electron-builder are place in the release directory. The executable works fine on my local machine, with all features present through the packaged app.
However, once I move the application to another machine only some features are available. Noticeably features within subdirectories in app/ are not included.
For example here a snippet of the app/ directory:
app/
├── app.html
├── index.js
├── components/
└── other files and folders
Features added from .js/.html files within components/ are not present when I move the app to another machine. I have tried both moving just the executable as well as the whole release/ directory, neither includes additional features beyond what is included in app.html.
Update
It does indeed look like any other machine simply doesn't read items contained in
<script></script>
In my app.html file
Would there be some outside installation I need to do on another machine to get this executable running
Found the issue,
It involved my usage of a two package.json structure
Both dependencies and devDependencies of my build were located in the root/package.json, where dependencies needed to be moved to the app/package.json file
Maybe I am totally off track here and I am chasing the wrong Idea:
I have node.js project which contains an npm module (let's call it my_npm_module) which I am also working on.
The module's directory is symlinked into my project like this:
/home
|
|__ myproject
| |
| |__ node_modules
| |__ some_other_module
| |__ my_npm_module (should only get installed/updated in production mode)
| |__ my_npm_module (symlinked only in development mode from /home/modules/mymodule)
|
|__modules
|__ my_npm_module (symlinked to /home/myproject/node_modules/mymodule)
Now, when I call npm install/update in development mode I don't want mymodule to get installed/updated, since I want to use the symlinked version.
But I want mymodule to get installed/updated in production mode. And only in production (NODE_ENV=production) mode.
Since package.json "dependencies" installs/updates for either mode i.e. development and production and "devDependencies" installs/updates for development mode only, I am kind of stuck here.
What I am looking for is something like "productionDependencies" or at least a solution which covers this situation.
Sorry, there is no way to do that.
What you could do is add an extra line when you deploy.
$ npm install my_module
$ NODE_ENV=production npm install
And when you finish with your module development ( let's say you don't want to link it anymore, because it's ready for production ), you just remove that extra line and add it to your dependencies.
Another idea is to modify your package.json file for production in your deploy script. This will ensure that the module will be installed only for production.
I'd like to have my project using the following structure :
|_ bin
|_ docs
|_ logs
|_ src
|_main
|_ api
|_ config
|_ views
...
app.js
|_test
|_ node_modules
|_ package.json
By default, the app.js is in the same directory as the npm modules, is it possible to do it my way? I modified the .sailsrc file to change the paths (especially for the adapters), but once I try to run the app, the sails module can't be found.
I'd like to have my project using the following structure
is it possible to do it my way?
No.
The solution is to to build your sails.js app the same way as the thousands of other sails.js applications. If you don't want to follow convention, you're on your own.