Code Monkey home page Code Monkey logo

Comments (7)

AlecKazakova avatar AlecKazakova commented on August 23, 2024

Do you know if this is only from the gradle plugin or the intellij plugin? Right now my structure looks right but its purely generated in intellij

screen shot 2016-02-04 at 2 49 59 pm

from sqldelight.

JakeWharton avatar JakeWharton commented on August 23, 2024

I'm talking about the folder in your source tree with the .sq files, src/main/sqlite/, not the generated source files. I get the same for the generated dir in IDEA as well since it gets marked as a generated source folder.

from sqldelight.

AlecKazakova avatar AlecKazakova commented on August 23, 2024

gotchya 👍

from sqldelight.

AlecKazakova avatar AlecKazakova commented on August 23, 2024

Looks like the will require a sqldelight facet type and all the stuff around that. It's probably the right thing to do but later.

from sqldelight.

AlecKazakova avatar AlecKazakova commented on August 23, 2024

so in vanilla intellij the solution is

val contentEntry = ModuleRootManager.getInstance(module).getModifiableModel().addContentEntry("src");
contentEntry.addSourceFolder("/path-to-module/src/main/sqldelight")

and this works fine.

Unfortunately in the android plugin they drop all the existing ContentEntries and hardcode their own, which are essentially generatedJava, generatedRes, java, and res directories with some others. So if you call the above code before the wipe it looks proper for a fraction of a second before the android plugin code runs and wipes it. If you call it after the wipe the source folder (sqldelight) is blue but the packages dont collapse. Not sure whats going on there.

All this is to say I'm going to take the ridiculously easy route and just add the sqldelight directory as a source directory from gradle instead of using the IDE. IDE is the right way to go but Android Studio is making it difficult/impossible.

from sqldelight.

romtsn avatar romtsn commented on August 23, 2024

@AlecStrong I've tried to make this work, but as you mentioned it's unavoidable that the android plugin will rewrite all content entries after a gradle sync.. Even if you mark a dir manually as a sources root, it still will be overwritten. I tried to look for workarounds (like listening for gradle sync to finish?) but no luck. Do you have an idea/refs on how to do it properly with facets?

from sqldelight.

AlecKazakova avatar AlecKazakova commented on August 23, 2024

yea there isn't a whole lot of information regarding facets: https://www.jetbrains.org/intellij/sdk/docs/reference_guide/project_model/facet.html

it's a lot to look through, and I can't find anything specifically about directory UI so it might also be a dead end which would suck. It's likely that adding it as a kotlin source set in gradle is the only way to get the working. It kinda sucks because then you could also put kotlin files there and they would be compiled, but it's probably worth it because right now the directory structure kinda sucks

there might be other intellij platform APIs to facilitate this but I haven't found them. It might be worth asking in the intellij platform slack to see if one of the JB team has a good idea for it

from sqldelight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.