flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.97k stars 315 forks source link

Missing .idea/misc.xml project file #2814

Open stevemessick opened 5 years ago

stevemessick commented 5 years ago

We might want to add .idea/misc.xml to the Flutter project templates since it is what's returned by Project.getProjectFile(). The default SDK is defined there, and including that would eliminate a glaring error in the Project Structure editor. The error doesn't really mean anything for Flutter projects, but once we get Android sources linked in properly it becomes an issue.

devoncarew commented 5 years ago

Would we be able to populate it with reasonable information? Here's what I have locally for one project:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ClientPropertiesManager">
    <properties class="javax.swing.JPanel">
      <property name="BorderFactoryClass" class="java.lang.String" />
    </properties>
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="IntelliJ IDEA Community Edition" project-jdk-type="IDEA JDK">
    <output url="file://$PROJECT_DIR$/out" />
  </component>
</project>

That's a Java project. For another (Flutter) project, I don't see a misc.xml file.

stevemessick commented 5 years ago

After using the Project Structure editor to set the default SDK in a Flutter project I ended up with this one:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="Android API 26 Platform" project-jdk-type="Android SDK" />
</project>

I don't know if we have the ability to customize these files with the Android platform -- that would be required.

Another consideration is how many non-essential files we generate for people who don't use IntelliJ. /cc @mit-mit

dimsuz commented 4 years ago

The problem here is that project-jdk-name depends on local SDK setup on host computer. I just did a quick poll around the office and got these values of project-jdk-name from different people (all Linux, different distros):

And it is a known problem that when commited to git it will keep changing to whatever jdk name your host has after each gradle sync, this will constantly happen across different computers on your team: one developer commits his misc.xml, it changes for others etc, endless cycle.

Basically we just learned to not commit this line ever.