I store my solutions to various coding exercises in one repository as Gradle projects. One solution - one Gradle project. I have near 100 Gradle projects in one repository. The structure of the whole repository looks like this:
repository_name
├── topic1
│ ├── exercise1
│ │ ├── build.gradle
│ │ └── settings.gradle
│ ├── exercise2
│ │ ├── build.gradle
│ │ └── settings.gradle
│ └── exercise3
│ ├── build.gradle
│ └── settings.gradle
├── topic2
│ ├── exercise1
│ └── exercise2
└── topic3
Perhaps a clearer view in the form of an image
"repository name" and "topic*" are directories that consist of directories only, only "exercises*" are gradle projects as I mentioned before.
The problem is that when I open my whole project (repository) in IntelliJ IDEA it tries to load all these projects at the same time, all system resources go to 100% and then IntelliJ IDEA just stops responding, so I can't work with my projects anymore.
I did what the JetBrains employee advised to do at this link at youtrack.jetbrains.com portal (and it helped)
I add the repository_name/settings.gradle file and this is what it contains:
includeBuild("topic1/exercise1")
includeBuild("topic1/exercise2")
includeBuild("topic1/exercise3")
includeBuild("topic2/exercise1")
//for linux
includeBuild("topic1\\exercise1")
includeBuild("topic1\\exercise2")
includeBuild("topic1\\exercise3")
includeBuild("topic2\\exercise1")
//for windows
As you can imagine I have 100 + 100 lines in these files. I tried
includeBuild("topic1\\*")
and it didn't work.
Is there a way to simplify this file and add some platform independence? Something like this:
if (windows) {
includeBuild("topic1\\*")
includeBuild("topic2\\*")
includeBuild("topic3\\*")
}
if (debian) {
includeBuild("topic1/*")
includeBuild("topic2/*")
includeBuild("topic3/*")
}
I moved all topics directories to separate folder for simplicity and this is how settings.gradle file looks now:
file('exercises').eachDir { topic ->
topic.eachDir { exercise ->
includeBuild("exercises/${topic.name}/${exercise.name}")
}
}