Skip to content

Commit

Permalink
Added a source bundle for the sbt library.
Browse files Browse the repository at this point in the history
This commit allows debugging, hyperlinking, etc. towards
sbt sources. Useful when working on the Sbt builder.

* create a source bundle for the sbt library. I needed to
  inline the contents of sbt jars in order to get Eclipse
  to correctly associate sources with classfiles

* created a new compiler.interface bundle, only for the
  compiler interface, together with the matching
  `compiler.interface.sources` bundle. Sbt requires this to
  be a separate jar and there was no way to build a single sbt
  bundle with only some of the dependencies inlined.

A similar approach could be used for the Scala library/compiler
bundles, but we should investigate the possibility of having the
Scala team publish source bundles too (Re #1001889).

(this was originally a commit from @dragos, which I have adapted
based on the comments in #482)

Fixes #1001888
  • Loading branch information
dotta committed Sep 10, 2013
1 parent a13811f commit 60726ed
Show file tree
Hide file tree
Showing 11 changed files with 374 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
**/.cache
target/
15 changes: 14 additions & 1 deletion org.scala-ide.build-toolchain/pom.xml
Expand Up @@ -7,15 +7,28 @@
<artifactId>org.scala-ide.build</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>org.scala-ide.build-toolchain</artifactId>
<description>The Scala Toolchain for Scala Eclipse plugins</description>
<packaging>pom</packaging>
<version>4.0.0-SNAPSHOT</version>


<!-- extra repository containing the sbt packages -->
<repositories>
<repository>
<id>typesafe-ide</id>
<name>Typesafe IDE repository</name>
<url>${repo.typesafe}</url>
</repository>
</repositories>

<modules>
<module>../org.scala-ide.scala.library</module>
<module>../org.scala-ide.scala.compiler</module>
<module>../org.scala-ide.sbt.full.library</module>
<module>../org.scala-ide.sbt.full.library.source</module>
<module>../org.scala-ide.sbt.compiler.interface</module>
<module>../org.scala-ide.sbt.compiler.interface.source</module>
</modules>
</project>
63 changes: 63 additions & 0 deletions org.scala-ide.sbt.compiler.interface.source/pom.xml
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>org.scala-ide.build-toolchain</artifactId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../org.scala-ide.build-toolchain/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.sbt.compiler.interface.source</artifactId>
<packaging>bundle</packaging>

<profiles>
<profile>
<id>sbt-new</id>
<dependencies>
<dependency>
<groupId>com.typesafe.sbt</groupId>
<artifactId>compiler-interface-precompiled</artifactId>
<version>${sbt.ide.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
</dependencies>
</profile>

<profile>
<id>sbt-legacy</id>
<dependencies>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>compiler-interface_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<!-- generate the MANIFEST.MF file, and create the bundle -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/src</outputDirectory>
<instructions>
<Bundle-Name>Sbt Compiler Interface Sources for Eclipse</Bundle-Name>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${sbt.version}.${version.tag}-${version.suffix}-${maven.build.timestamp}</Bundle-Version>
<!-- This defines the bundle we provide the source for -->
<Eclipse-SourceBundle>org.scala-ide.sbt.compiler.interface;version="${sbt.version}.${version.tag}-${version.suffix}-${maven.build.timestamp}";roots:="."</Eclipse-SourceBundle>
<!-- Extract all sources into this bundle -->
<Embed-Dependency>classifier=sources;inline=true</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
62 changes: 62 additions & 0 deletions org.scala-ide.sbt.compiler.interface/pom.xml
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>org.scala-ide.build-toolchain</artifactId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../org.scala-ide.build-toolchain/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.sbt.compiler.interface</artifactId>
<packaging>bundle</packaging>

<profiles>
<profile>
<id>sbt-new</id>
<dependencies>
<dependency>
<groupId>com.typesafe.sbt</groupId>
<artifactId>compiler-interface-precompiled</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</profile>

<profile>
<id>sbt-legacy</id>
<dependencies>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>compiler-interface_${sbt.compiled.version}</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<!-- generate the MANIFEST.MF file, and create the bundle -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<instructions>
<Bundle-Vendor>scala-ide.org</Bundle-Vendor>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>Sbt ${sbt.ide.version} Compiler Interface for Eclipse</Bundle-Name>
<!-- put a '-' after the sbt.version since it already has a '-scalaide-01' qualifier. Remove it the qualifier is gone. -->
<Bundle-Version>${sbt.version}.${version.tag}-${version.suffix}-${maven.build.timestamp}</Bundle-Version>
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
<_exportcontents>xsbt.*;version=${sbt.version}</_exportcontents>
<Embed-StripVersion>true</Embed-StripVersion>
<Import-Package>!org.apache.ivy.*,!org.bouncycastle.*,!org.scalatools.testing.*,!com.craft.*,!com.jcraft.*,!sun.misc,!org.apache.commons.vfs,!org.apache.commons.vfs.impl,!org.apache.oro.text,!org.apache.oro.text
.regex,*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
189 changes: 189 additions & 0 deletions org.scala-ide.sbt.full.library.source/pom.xml
@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>org.scala-ide.build-toolchain</artifactId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../org.scala-ide.build-toolchain/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.sbt.full.library.source</artifactId>
<packaging>bundle</packaging>

<profiles>
<profile>
<id>sbt-new</id>
<dependencies>
<dependency>
<groupId>com.typesafe.sbt</groupId>
<artifactId>sbt-interface</artifactId>
<version>${sbt.ide.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.typesafe.sbt</groupId>
<artifactId>incremental-compiler</artifactId>
<version>${sbt.ide.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
</dependencies>
</profile>

<profile>
<id>sbt-legacy</id>
<dependencies>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>classpath_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>logging_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>io_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>control_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>classfile_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>process_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>relation_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>interface_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>persist_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>api_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>compiler-integration_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>incremental-compiler_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>compile_${sbt.compiled.version}</artifactId>
<version>${sbt.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<!-- all the dependencies necessary for running like sbinary, jline -->
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
<!-- No published sources for sbinary, yet -->
<!-- <dependency>
<groupId>org.scala-tools.sbinary</groupId>
<artifactId>sbinary_${sbt.compiled.version}</artifactId>
<classifier>sources</classifier>
<optional>true</optional>
</dependency>
-->
</dependencies>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<!-- automatically clean up the generated META-INF folder -->
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>./</directory>
<includes>
<include>META-INF/**/*</include>
<include>META-INF</include>
<include>target/**/*</include>
<include>target</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/src</outputDirectory>
<instructions>
<Bundle-Vendor>scala-ide.org</Bundle-Vendor>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>Sbt ${sbt.ide.version} Library Sources for Eclipse</Bundle-Name>
<Bundle-Version>${sbt.version}.${version.tag}-${version.suffix}-${maven.build.timestamp}</Bundle-Version>
<!-- This defines the bundle we provide the source for -->
<Eclipse-SourceBundle>org.scala-ide.sbt.full.library;version="${sbt.version}.${version.tag}-${version.suffix}-${maven.build.timestamp}";roots:="."</Eclipse-SourceBundle>
<!-- Extract all sources into this bundle -->
<Embed-Dependency>classifier=sources;inline=true</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 60726ed

Please sign in to comment.