Frege / frege-gradle-plugin

Gradle plugin for compiling Frege projects
BSD 3-Clause "New" or "Revised" License
25 stars 10 forks source link

Source directories are not detected by Netbeans #22

Open januslynd opened 9 years ago

januslynd commented 9 years ago

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

Dierk commented 9 years ago

Ok, thanks!