Skip to content

Update IntelliJ build for use with sbt#5046

Closed
lrytz wants to merge 1 commit intoscala:2.12.xfrom
lrytz:intellij
Closed

Update IntelliJ build for use with sbt#5046
lrytz wants to merge 1 commit intoscala:2.12.xfrom
lrytz:intellij

Conversation

@lrytz
Copy link
Member

@lrytz lrytz commented Mar 16, 2016

No description provided.

@scala-jenkins scala-jenkins added this to the 2.12.0-M5 milestone Mar 16, 2016
@lrytz
Copy link
Member Author

lrytz commented Mar 16, 2016

review by @szeiger, as there's some code in build.sbt.

@lrytz
Copy link
Member Author

lrytz commented Mar 17, 2016

@retronym for the scala-build module, how did you come up with the list of dependencies in 504ac0d? i'd like to keep them automatically up-to-date, like this PR does for dependencies of other modules.

@retronym
Copy link
Member

Iirc, I started with a .iml file from another project that was compatible with the native SBT import. I added source JARs by hand.

We could mimic the internals of that import tool ourselves to automate most of this.

@szeiger
Copy link
Contributor

szeiger commented Mar 18, 2016

Hm, this doesn't compile for me, as if there was a problem with the applicative transformation in sbt's macros:

$ sbt
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024M; support was removed in 8.0
[info] Loading global plugins from /Users/szeiger/.sbt/0.13/plugins/project
[info] Updating {file:/Users/szeiger/.sbt/0.13/plugins/project/}global-plugins-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Loading global plugins from /Users/szeiger/.sbt/0.13/plugins
[info] Updating {file:/Users/szeiger/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Loading project definition from /Users/szeiger/code/scala/project
[info] Updating {file:/Users/szeiger/code/scala/project/}scala-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 8 Scala sources to /Users/szeiger/code/scala/project/target/scala-2.10/sbt-0.13/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.10.6. Compiling...
[info]   Compilation completed in 6.685 s
/Users/szeiger/code/scala/build.sbt:889: error: type mismatch;
 found   : String
 required: sbt.TaskKey[String]
    print(s"Could not find src/intellij/scala.ipr. Create new project files from src/intellij/*.SAMPLE (y/n)? ")
          ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

@szeiger
Copy link
Contributor

szeiger commented Mar 18, 2016

Looks like I have a wrong print in scope, probably auto-imported from some global plugin. Using scala.Console.print instead of print works.

@adriaanm
Copy link
Contributor

Using it already -- works great! Would it make sense to have a shortcut task that does it all at once?

@szeiger
Copy link
Contributor

szeiger commented Mar 18, 2016

Do you even need two separate tasks? Wouldn't it be sufficient to have one task that updates the IntelliJ configuration, or creates it from scratch if it doesn't yet exist?

@szeiger
Copy link
Contributor

szeiger commented Mar 18, 2016

sbt-dependency-graph was the culprit. The latest version doesn't shadow print anymore.

@lrytz
Copy link
Member Author

lrytz commented Mar 18, 2016

the description in the readme is not quite accurate, if you run sbt intellijUpdateLibraryClasspaths on a fresh checkout it will ask and create copies of the .SAMPLE files.

@adriaanm
Copy link
Contributor

Shall we rename that task to simply intellij and recommend just calling that in the docs?

@lrytz
Copy link
Member Author

lrytz commented Mar 18, 2016

fine with me, i'll clean it up

@lrytz
Copy link
Member Author

lrytz commented Mar 20, 2016

@szeiger i changed print to scala.Console.print just to make sure.

@adriaanm renamed the task to intellij. It copies the .SAMPLE files if necessary, otherwise only updates the dependency lists. Updated the README accordingly.

As a bonus, the dependency list for the scala-build module (to edit the sbt build within IntelliJ) is now also updated automatically, thanks to some sbt magic. Thanks to @dwijnand for the support on gitter!

So i think this PR is ready now.

@adriaanm
Copy link
Contributor

Cool!

@retronym
Copy link
Member

I just noticed that the repl-jline module is not catered for:

I've got this one in one of my checkouts that I must have created manually:

src/intellij/repl-jline.iml

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$/../repl-jline">
      <sourceFolder url="file://$MODULE_DIR$/../repl-jline" isTestSource="false" />
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="module" module-name="compiler" />
    <orderEntry type="module" module-name="library" />
    <orderEntry type="module" module-name="reflect" />
    <orderEntry type="module" module-name="interactive" />
    <orderEntry type="library" name="starr" level="project" />
    <orderEntry type="library" name="repl-deps" level="project" />
    <orderEntry type="library" name="asm" level="project" />
    <orderEntry type="module" module-name="repl" />
  </component>
</module>

The problem pre-dates this PR, but if you're feeling in the mood to cross all the t-s and dot all the i-s, it would be great to sort this out too.

@retronym
Copy link
Member

Oh, I've seen you've added that already.

@retronym
Copy link
Member

Would it be possible to merge this to 2.11.x instead, or to backport it?

@lrytz
Copy link
Member Author

lrytz commented Mar 21, 2016

good point, moving it to 2.11.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants