I want to develop a piece of software in java with some GUIs on top (in particular, an android app). I would like the core functionality to be a self-contained module that is fully independent from any GUI or other software layer that could be built on top.
The core module is a Gradle project itself:
core
├── src
├── build.gradle
└── settings.gradle
For the app, it is included as a git submodule in a root repository:
project
├── app
│ ├── src
│ └── build.gradle
├── core
│ ├── src
│ ├── build.gradle
│ └── settings.gradle
├── build.gradle
└── settings.gradle
Since the core module is independent and has its own repo, I have to be able to treat it as a Gradle root project; hence it has its own settings.gradle
. But when I work in the root project, I want it to behave as a subproject of the latter (so that running gradle
in the core
directory recognises it as the :core
subproject using the settings.gradle
in the parent directory). And without changing the contents of core
(which will be a git submodule).
I don't want to make a separate branch in core
's git repo in which there is no settings.gradle
, because in that branch the repo wouldn't make sense on its own, and, again, core
shouldn't "need to know anything" about the root project.
The ideal solution would be an alternative version of git submodules in which custom changes to the submodule could be committed to the parent repo alone without affecting the submodule's original repo. (With the ability of merging upstream changes in the submodule with the local commits.) Then I would add one such "local" commit that removes the core/settings.gradle
file.
Is there a way to achieve this?