Skip to content

Source directories are not detected by Netbeans #22

@januslynd

Description

@januslynd

Hi I'm testing the gradle plugin, and when importing the project into Netbeans 8.0.2 / 8.1 it doesn't recognizes Frege sources ("src/main/frege").

I've look into the SourceSet branch you are working on and I guess the problem is that there is no frege sourceSet defined. It seems you are adding the dir to all existent source sets declared by the JavaPlugin.

As a work around it turns out if you add the srcDir to the allSource sourceSet then the IDE knows that an extra source dir should be taken into account and then it is visible.

Inside the FregePlugin#configureSourceSetDefaults fmethod it's enough adding the last line:

  private void configureSourceSetDefaults(JavaBasePlugin javaBasePlugin) {
        project.convention.getPlugin(JavaPluginConvention).sourceSets.all { sourceSet ->
            def fregeSourceSet = new FregeSourceSet(sourceSet.displayName, fileResolver)
            new DslObject(sourceSet).convention.plugins.put(FREGE_PLUGIN_NAME, fregeSourceSet)

            fregeSourceSet.frege.srcDir("src/${sourceSet.name}/frege")

            def compileTaskName = sourceSet.getCompileTaskName(FREGE_PLUGIN_NAME)

            def fregeCompile = project.tasks.create(compileTaskName, FregeTask)
            javaBasePlugin.configureForSourceSet(sourceSet, fregeCompile)
            fregeCompile.dependsOn(sourceSet.compileJavaTaskName)
            fregeCompile.setDescription("Compiles the ${sourceSet.name} Frege sources.")
            fregeCompile.setSource(fregeSourceSet.frege)

            project.tasks.getByName(sourceSet.classesTaskName).dependsOn(compileTaskName)

            // WORKAROUND
            sourceSet.allSource.srcDir("src/${sourceSet.name}/frege")
        }
    }

Janus

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions