1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils java-pkg-2
11 DESCRIPTION="sbt is a build tool for Scala and Java projects that aims to do the basics well"
12 HOMEPAGE="https://www.scala-sbt.org/"
14 EGIT_REPO_URI="https://github.com/sbt/sbt.git"
17 https://github.com/sbt/sbt/archive/v${PV}.tar.gz -> ${P}.tar.gz
18 https://dev.gentoo.org/~gienah/snapshots/${P}-ivy2-deps.tar.xz
19 https://dev.gentoo.org/~gienah/snapshots/${P}-sbt-deps.tar.xz
20 http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/${L_PN}/${PV}/${L_PN}.jar -> ${L_P}.jar
23 https://dev.gentoo.org/~gienah/files/dist/${P}-gentoo-binary.tar.xz
27 KEYWORDS="~amd64 ~x86"
41 # Note: to bump sbt, some things to try are:
42 # 1. remove the https://dev.gentoo.org/~gienah/snapshots/${P}-ivy2-deps.tar.xz
43 # https://dev.gentoo.org/~gienah/snapshots/${P}-sbt-deps.tar.xz and
44 # binary? ( https://dev.gentoo.org/~gienah/files/dist/${P}-gentoo-binary.tar.xz )
46 # 2. Comment the sbt publishLocal line in src_compile.
48 # FEATURES='noclean -test' emerge -v -1 dev-java/sbt
49 # It should fail in src_install since the sbt publishLocal is not done.
50 # Check if it downloads more stuff in
51 # src_compile to ${WORKDIR}/.ivy2 and ${WORKDIR}/.sbt.
52 # 4. If some of the downloads fail, it might be necessary to run the sbt compile
53 # again manually to obtain all the dependencies, if so:
56 # export WORKDIR='/var/tmp/portage/dev-java/${P}/work'
58 # export PATH="${WORKDIR}/${L_P}:${PATH}"
61 # find .ivy2 .sbt -uid 0 -exec chown portage:portage {} \;
63 # XZ_OPT=-9 tar --owner=portage --group=portage \
64 # -cJf /usr/portage/distfiles/${P}-ivy2-deps.tar.xz .ivy2/cache
65 # XZ_OPT=-9 tar --owner=portage --group=portage \
66 # -cJf /usr/portage/distfiles/${P}-sbt-deps.tar.xz .sbt
67 # Uncomment the sbt publishLocal line in src_compile.
68 # 6. It *might* download more dependencies for src_test, however the presence
69 # of some of these may cause the src_compile to fail. So download them
70 # seperately as root so we can identify the
71 # additional files. As root:
75 # XZ_OPT=-9 tar --owner=portage --group=portage \
76 # -cJf /usr/portage/distfiles/${P}-test-deps.tar.xz \
77 # $(find .ivy2/cache .sbt -uid 0 -type f -print)
78 # Note: It might not download anything in src_test, in which case
79 # ${P}-test-deps.tar.xz is not required.
80 # 7. Create the binary
82 # XZ_OPT=-9 tar --owner=portage --group=portage \
83 # -cJf /usr/portage/distfiles/${P}-gentoo-binary.tar.xz ${P} .ivy2/local
84 # 9. Undo the earlier temporary edits to the ebuild.
87 # Unpack tar files only.
89 [[ ${f} == *".tar."* ]] && unpack ${f}
96 mkdir "${WORKDIR}/${L_P}" || die
97 cp -p "${DISTDIR}/${L_P}.jar" "${WORKDIR}/${L_P}/${L_PN}.jar" || die
98 cat <<- EOF > "${WORKDIR}/${L_P}/sbt"
100 SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled"
101 java -Djavac.args="-encoding UTF-8" -Duser.home="${WORKDIR}" \${SBT_OPTS} -jar "${WORKDIR}/${L_P}/sbt-launch.jar" "\$@"
103 cat <<- EOF > "${S}/${P}"
105 SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled"
106 java -Djavac.args="-encoding UTF-8" -Duser.home="${WORKDIR}" \${SBT_OPTS} -jar "${S}/launch/target/sbt-launch.jar" "\$@"
108 chmod u+x "${WORKDIR}/${L_P}/sbt" "${S}/${P}" || die
110 # suppress this warning in build.log:
111 # [warn] Credentials file /var/tmp/portage/dev-java/${P}/work/.bintray/.credentials does not exist
112 mkdir -p "${WORKDIR}/.bintray" || die
113 cat <<- EOF > "${WORKDIR}/.bintray/.credentials"
114 realm = Bintray API Realm
115 host = api.bintray.com
123 if ! use binary; then
124 einfo "=== sbt compile ..."
125 "${WORKDIR}/${L_P}/sbt" -Dsbt.log.noformat=true compile || die
126 einfo "=== sbt publishLocal with jdk $(java-pkg_get-vm-version) ..."
127 cat <<- EOF | "${WORKDIR}/${L_P}/sbt" -Dsbt.log.noformat=true || die
128 set every javaVersionPrefix in javaVersionCheck := Some("$(java-pkg_get-vm-version)")
135 "${S}/${P}" -Dsbt.log.noformat=true test || die
139 # Place sbt-launch.jar at the end of the CLASSPATH
140 java-pkg_dojar $(find "${WORKDIR}"/.ivy2/local -name \*.jar -print | grep -v sbt-launch.jar) \
141 $(find "${WORKDIR}"/.ivy2/local -name sbt-launch.jar -print)
142 local ja="-Dsbt.version=${PV} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled"
143 java-pkg_dolauncher sbt --jar sbt-launch.jar --java_args "${ja}"