netbeans-gradle-project
netbeans-gradle-project copied to clipboard
[Improvement] Give option of different naming for subproject's build file
Having many subprojects with a build.gradle file open in the NetBeans editor makes is really confusing. One suggestion would be to use accept a different name that includes the name of the subproject (as suggested in Gradle In Action), in the form: 'subproject.gradle' or 'subproject-build.gradle'. This upgraded name should be the default used for generating a subproject.
To allow that update, only a small change in settings.gradle is needed (this example works for both 'build.gradle' or 'subproject-build.gradle':
def subDirs = rootDir.listFiles(new FileFilter() {
public boolean accept(File file) {
if (!file.isDirectory()) {
return false
}
if (file.name == 'buildSrc') {
return false
}
if (new File(file, 'build.gradle').isFile()) {
return true
}
if (new File(file, file.name.toLowerCase() + '-build.gradle').isFile()) {
return true
}
return false
}
});
subDirs.each { File dir ->
include dir.name
}
rootProject.children.each {
if (! it.buildFile.isFile()) {
it.buildFileName = it.name + '-build.gradle'
}
}
I assume you mean changing the project wizard. For Gradle projects, the plugin currently supports build.gradle files named as
If the current options are not adequate for you, please list the name formats you expect to get support for.
Yes, the improvement would be for the wizard for subprojects only, to make their build files stand out from other subprojects' build files. Maybe users could be presented with the default file name 'build.gradle' and have the option to add a prefix to it (the prefix could default to the subproject name, but the developer could tweak it to anything else as long as it ends in 'build.gradle').
I guess a "-buid.gradle" suffix sounds reasonable to detect.
Anyway, you can adjust the generated settings.gradle to your liking. However, I'm not sure if I really want to adjust the wizard because then I somehow have to detect the build file name format when adding subprojects. If anything, I would rather create a new Gradle project type with a better more customizable setup where you can create subprojects using Gradle tasks.
That would be great... If anyone is having this issue, they can replace the settings.gradle
with the one I posted earlier