Upsource JDK & Third Party Lib Configuration

I have deployed 2.0.3682 version of upsource and I am facing a couple of issues in the setup

  • Language Level - While reviewing jdk 1.8 code we get an error "Lambda expressions are not supported at this language level". Below is the config I found in the misc.xml under .idea folder.

</component><component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-type="JavaSDK" assert-jdk-15="true" project-jdk-name="1.8">

         If I am not wrong, the iml files and the .idea folder are created by upsource. Where is the above file reading it from?

  • Third party libraries - How can upsource be configured to import third party libraries while reviewing or browser source code? Under each module I see the .iml file updated to have the below xml entry

     <orderEntry type="module-library" exported="">

      <library>

        <CLASSES>

          <root url="jar:///opt/crw/upsource/Upsource/temp/upsource-analyzer/upsource-tmp/gradle-home/caches/modules-2/files-2.1/org.apache.commons-lang/commons-lang/2.5/b0236b252e86419eef20c31a44579d2aee2f0a69/commons-lang-2.5.jar!/"/>

        </CLASSES>

        <JAVADOC/>

        <SOURCES>

          <root url="jar:///opt/crw/upsource/Upsource/temp/upsource-analyzer/upsource-tmp/gradle-home/caches/modules-2/files-2.1/org.apache.commons-lang/commons-lang/2.5/bb75ef699b349b6e02d17d41556cebcd755d07ab/commons-lang-2.5-sources.jar!/"/>

        </SOURCES>

      </library>

    </orderEntry>

It seems the gradle home variable is getting overwritten because GRADLE_HOME environment variable is pointing to /opt/gradle/gradle2.4.

Let me know your suggestions on resolving the above issues. If a backup of the .idea folder is needed, let me know the steps to take it. Where is .idea folder located? On the upsource machine or on the remote git server?

5 comments

Hi Amit,

1. Upsource gets language level from gradle config files. If gradle doesn't have any mentions of this setting, JDK_1_6 is used by default. So what you might want to do is specify JDK version on project level (module level is not supported).

IDEA model is generated by gradle idea plugin and everything you see in .idea folder is generated from gradle.

2. Could you pleasee clarify where did you take this .iml file?

Actually .idea folder located in Upsource DB and might be accessible through Upsource UI only.

Thanks.

0

Hi Artem,

1. In our case gradle does not create the .idea folder. We only have the idea plugin activated that generates the .iml files.
We tried setting the language level setting on the root gradle project but it doesn't seem to take into effect.

2. This is the .iml generated by the idea plugin. I am surprised as to how did it pick upsource config paths.

I am quite confused with the upsource configuration in this regards. It's hard to distinguish between what is controlled by gradle, upsource,idea plugin and how does upsource interact with them. It would be helpful if you could through some light.

0

Amit,

Upsource runs gradle idea plugin to convert your gradle model to idea one.

The process is the following -  gradle idea plugin is run with parameters that might be found in gradle.out file (here is description on how this file can be found - https://www.jetbrains.com/upsource/help/2.0/issues.html#code-intelligence-is-not-available). As a result of this process Upsource gets idea files in old format, where to say locations of some files are defined with absolute path (it's what shown in the iml you pasted above). After that Upsource starts processing this idea files and convert them to the new idea format, replace absolute paths with variables and distribute imls as appropriate. As a result you might see .idea folder in project root and iml file in each module. Note that this self generated idea/iml resources are stored in Upsource database and available only through Upsource UI (you might open any revision in Upsource and go to Browse code). So the question is where have you took this iml file? From Upsource UI or from a temp folder?  

Speaking about language level, could you please let us know how/where have you specified it? It will be ideal if you send us your build.gradle file.

Thanks in advance.

0

Thanks for the detailed reply. That helped in clearing some doubts.

So the question is where have you took this iml file? From Upsource UI or from a temp folder?


The iml file extract was from the Upsource UI. I have mailed a few screen shots at upsource-support@jetbrains.com to give an idea of how the config is made currently.
After you have a look at the screenshots, a follow up question would be - the path to the third-party libs in the iml files is incorrect and points to the upsource-analyzer directory. How can I correct it?

Speaking about language level, could you please let us know how/where have you specified it? It will be ideal if you send us your build.gradle file.

I have mailed the gradle file too. The language level setting is specified as "sourceCompatibility='1.8' property in the build.gradle file. Upsource doesn't seem to be picking it up. Is that the right way to configure the language level?

Thanks!

0

Hi Amit,

Thanks for sending files and clarifying the details.

- Path to third-party libs shouldn't look like this in the iml file, so most likely it's bug.

- Language level is set correctly in build.gradle file, so it's a question why Upsource didn't pick this up.

I've filled an issue for both problems - https://youtrack.jetbrains.com/issue/UP-5496, please watch it, further communications will be held there.

Thanks in advance.

0

Please sign in to leave a comment.