mirror of https://github.com/sbt/sbt.git
Merge branch 'full-packaging' of github.com:sbt/sbt-launcher-package into full-packaging
This commit is contained in:
commit
3d19938968
|
|
@ -0,0 +1 @@
|
|||
src/windows/sbtconfig.txt eol=crlf
|
||||
|
|
@ -3,7 +3,11 @@ import Keys._
|
|||
|
||||
object SbtExtras extends Build {
|
||||
// This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution.
|
||||
val root = Project("sbt-packaging", file(".")) settings(Packaging.settings:_*)
|
||||
val root = Project("sbt-packaging", file(".")) settings(Packaging.settings:_*) settings(
|
||||
sbtVersion <<= sbtVersion apply { v =>
|
||||
sys.props.getOrElse("sbt.build.version", sys.env.getOrElse("sbt.build.version", v))
|
||||
}
|
||||
)
|
||||
|
||||
val meta = Project("metapackage", file("metapackage")) settings(MetaPackaging.settings(root):_*)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ object Packaging {
|
|||
fixedLinuxScriptDir <<= target / "linux-scripts",
|
||||
fixedUniversalScriptDir <<= target / "universal-scripts",
|
||||
linuxFixedScripts <<= (fixedScriptDir, fixedLinuxScriptDir) map fixScripts("/usr/lib/sbt/sbt-launch.jar", "/usr/share/sbt/sbt-launch-lib.bash"),
|
||||
universalFixedScripts <<= (fixedScriptDir, fixedUniversalScriptDir) map fixScripts("\\$(dirname \\$0)/sbt-launch.jar", "\\$(dirname \\$0)/sbt-launch-lib.bash"),
|
||||
universalFixedScripts <<= (fixedScriptDir, fixedUniversalScriptDir) map fixScripts("\\$(dirname \\$(realpath \\$0))/sbt-launch.jar", "\\$(dirname \\$(realpath \\$0))/sbt-launch-lib.bash"),
|
||||
sbtLaunchJarUrl <<= sbtVersion apply downloadUrlForVersion,
|
||||
sbtLaunchJarLocation <<= target apply (_ / "sbt-launch.jar"),
|
||||
sbtLaunchJar <<= (sbtLaunchJarUrl, sbtLaunchJarLocation) map { (uri, file) =>
|
||||
|
|
@ -143,7 +143,10 @@ object Packaging {
|
|||
|
||||
// WINDOWS SPECIFIC
|
||||
name in Windows := "sbt",
|
||||
lightOptions ++= Seq("-ext", "WixUIExtension", "-cultures:en-us"),
|
||||
candleOptions ++= Seq("-ext", "WixUtilExtension"),
|
||||
lightOptions ++= Seq("-ext", "WixUIExtension",
|
||||
"-ext", "WixUtilExtension",
|
||||
"-cultures:en-us"),
|
||||
wixConfig <<= (sbtVersion, sourceDirectory in Windows) map makeWindowsXml,
|
||||
//wixFile <<= sourceDirectory in Windows map (_ / "sbt.xml"),
|
||||
mappings in packageMsi in Windows <+= sbtLaunchJar map { f => f -> "sbt-launch.jar" },
|
||||
|
|
@ -151,6 +154,7 @@ object Packaging {
|
|||
mappings in packageMsi in Windows <++= sourceDirectory in Windows map { d => Seq(
|
||||
(d / "sbt.bat") -> "sbt.bat",
|
||||
(d / "sbt") -> "sbt",
|
||||
(d / "sbtconfig.txt") -> "sbtconfig.txt",
|
||||
(d / "jansi-license.txt") -> "jansi-license.txt"
|
||||
)},
|
||||
mappings in packageMsi in Windows <+= (compile in Compile, classDirectory in Compile) map { (c, d) =>
|
||||
|
|
@ -190,13 +194,14 @@ object Packaging {
|
|||
)
|
||||
|
||||
def makeWindowsXml(sbtVersion: String, sourceDir: File): scala.xml.Node = {
|
||||
val version = (sbtVersion split "\\.") match {
|
||||
val version = (sbtVersion split "[^\\d]" filterNot (_.isEmpty)) match {
|
||||
case Array(major,minor,bugfix, _*) => Seq(major,minor,bugfix, "1") mkString "."
|
||||
case Array(major,minor) => Seq(major,minor,"0","1") mkString "."
|
||||
case Array(major) => Seq(major,"0","0","1") mkString "."
|
||||
}
|
||||
(
|
||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>
|
||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'
|
||||
xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>
|
||||
<Product Id='ce07be71-510d-414a-92d4-dff47631848a'
|
||||
Name='Simple Build Tool'
|
||||
Language='1033'
|
||||
|
|
@ -211,9 +216,18 @@ object Packaging {
|
|||
Compressed='yes' />
|
||||
|
||||
<Media Id='1' Cabinet='sbt.cab' EmbedCab='yes' />
|
||||
|
||||
<Property Id='NOTEPADEXE'>
|
||||
<DirectorySearch Id='NotePadContainer' Path='[SystemFolder]' Depth='0'>
|
||||
<FileSearch Id='NotepadFile' Name='notepad.exe'/>
|
||||
</DirectorySearch>
|
||||
</Property>
|
||||
|
||||
<Directory Id='TARGETDIR' Name='SourceDir'>
|
||||
<Directory Id='ProgramFilesFolder' Name='PFiles'>
|
||||
<Directory Id="ProgramMenuFolder">
|
||||
<Directory Id="ApplicationProgramsFolder" Name="sbt"/>
|
||||
</Directory>
|
||||
<Directory Id='ProgramFilesFolder' Name='PFiles'>
|
||||
<Directory Id='INSTALLDIR' Name='sbt'>
|
||||
<Directory Id='classes_dir' Name='classes'>
|
||||
<Component Id='JansiLaunch' Guid='*'>
|
||||
|
|
@ -222,12 +236,19 @@ object Packaging {
|
|||
</Directory>
|
||||
<Component Id='SbtLauncherScript' Guid='DE0A5B50-0792-40A9-AEE0-AB97E9F845F5'>
|
||||
<File Id='sbt_bat' Name='sbt.bat' DiskId='1' Source='sbt.bat'>
|
||||
<!-- <util:PermissionEx User="Users" Domain="[LOCAL_MACHINE_NAME]" GenericRead="yes" Read="yes" GenericExecute="yes" ChangePermission="yes"/> -->
|
||||
<util:PermissionEx User="Administrators" GenericAll="yes" />
|
||||
<util:PermissionEx User="Users" GenericAll="yes" />
|
||||
</File>
|
||||
<File Id='sbt_sh' Name='sbt' DiskId='1' Source='sbt'>
|
||||
<!-- <util:PermissionEx User="Users" Domain="[LOCAL_MACHINE_NAME]" GenericRead="yes" Read="yes" GenericExecute="yes" ChangePermission="yes"/> -->
|
||||
</File>
|
||||
</Component>
|
||||
<Component Id='SbtConfigFile' Guid='*'>
|
||||
<File Id='sbtconfig_txt' Name='sbtconfig.txt' DiskId='1' Source='sbtconfig.txt'>
|
||||
<util:PermissionEx User="Administrators" GenericAll="yes" />
|
||||
<util:PermissionEx User="Users" GenericAll="yes" />
|
||||
</File>
|
||||
</Component>
|
||||
<Component Id='JansiJar' Guid='3370A26B-E8AB-4143-B837-CE9A8573BF60'>
|
||||
<File Id='jansi_jar' Name='jansi.jar' DiskId='1' Source='jansi.jar' />
|
||||
<File Id='jansi_license' Name='jansi-license.txt' DiskId='1' Source='jansi-license.txt' />
|
||||
|
|
@ -243,7 +264,19 @@ object Packaging {
|
|||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<!-- Step 2: Add the shortcut to your installer package -->
|
||||
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||
<Component Id="ConfigShortcut" Guid="3370A26B-E8AB-4143-B837-CE9A8573BF61">
|
||||
<Shortcut Id="ConfigStartMenuShortcut"
|
||||
Name="sbt configuration"
|
||||
Description="Modify sbt configuration settings"
|
||||
Target="[INSTALLDIR]sbtconfig.txt"
|
||||
WorkingDirectory="INSTALLDIR"/>
|
||||
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
||||
<RegistryValue Root="HKCU" Key="Software\Typesafe\sbt" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<Feature Id='Complete' Title='Simple Build Tool' Description='The windows installation of Simple Build Tool.'
|
||||
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
|
||||
<Feature Id='SbtLauncher' Title='Sbt Launcher Script' Description='The application which downloads and launches SBT.' Level='1' Absent='disallow'>
|
||||
|
|
@ -251,10 +284,14 @@ object Packaging {
|
|||
<ComponentRef Id='SbtLauncherJar' />
|
||||
<ComponentRef Id='JansiLaunch' />
|
||||
<ComponentRef Id='JansiJar' />
|
||||
<ComponentRef Id='SbtConfigFile' />
|
||||
</Feature>
|
||||
<Feature Id='SbtLauncherPathF' Title='Add SBT to windows system PATH' Description='This will append SBT to your windows system path.' Level='1'>
|
||||
<Feature Id='SbtLauncherPathF' Title='Add SBT to windows system PATH' Description='This will append SBT to your windows system path (Requires Restart).' Level='1'>
|
||||
<ComponentRef Id='SbtLauncherPath'/>
|
||||
</Feature>
|
||||
<Feature Id='SbtLauncherConfigF' Title='Add Menu Shortcuts' Description='This will add menu shortcuts for sbt configuration.' Level='1'>
|
||||
<ComponentRef Id='ConfigShortcut'/>
|
||||
</Feature>
|
||||
</Feature>
|
||||
<!--<Property Id="JAVAVERSION">
|
||||
<RegistrySearch Id="JavaVersion"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
realpath () {
|
||||
(
|
||||
TARGET_FILE=$1
|
||||
|
||||
cd $(dirname $TARGET_FILE)
|
||||
TARGET_FILE=$(basename $TARGET_FILE)
|
||||
|
||||
COUNT=0
|
||||
while [ -L "$TARGET_FILE" -a $COUNT -lt 100 ]
|
||||
do
|
||||
TARGET_FILE=$(readlink $TARGET_FILE)
|
||||
cd $(dirname $TARGET_FILE)
|
||||
TARGET_FILE=$(basename $TARGET_FILE)
|
||||
COUNT=$(($COUNT + 1))
|
||||
done
|
||||
|
||||
echo $(pwd -P)/$TARGET_FILE
|
||||
)
|
||||
}
|
||||
|
||||
. @@BASH-LIB-LOCATION@@
|
||||
|
||||
|
||||
|
|
@ -81,4 +101,4 @@ loadConfigFile() {
|
|||
[[ -f "$etc_sbt_opts_file" ]] && set -- $(loadConfigFile "$etc_sbt_opts_file") "$@"
|
||||
[[ -f "$sbt_opts_file" ]] && set -- $(loadConfigFile "$sbt_opts_file") "$@"
|
||||
|
||||
run $@
|
||||
run "$@"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
#!/bin/sh
|
||||
# sbt launcher script for Cygwin and MSYS
|
||||
#
|
||||
# Environment:
|
||||
# JAVA_HOME - location of a JDK home dir (mandatory)
|
||||
# SBT_OPTS - JVM options (optional)
|
||||
# Configuration:
|
||||
# sbtconfig.txt found in the SBT_HOME.
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
JAVA_CMD=java
|
||||
JAVA_OPTS=-Xmx512M
|
||||
else
|
||||
JAVA_CMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
|
||||
UDIR=`dirname "$0"`
|
||||
if [ -z "$MSYSTEM" ]; then
|
||||
|
|
@ -11,12 +20,16 @@ else
|
|||
WDIR=`echo "$UDIR" | sed -e 's~^/\([^/]*\)/~\1:/~'`
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_OPTS" ]; then
|
||||
JAVA_OPTS=$(cat "$WDIR/sbtconfig.txt" | sed -e 's/\r//g' -e 's/^#.*$//g' | sed ':a;N;$!ba;s/\n/ /g')
|
||||
fi
|
||||
|
||||
if [ "_$TERM" = "_xterm" ]; then
|
||||
# Let the terminal handle ANSI sequences
|
||||
stty -icanon min 1 -echo > /dev/null 2>&1
|
||||
$JAVA_CMD $JAVA_OPTS -Djline.terminal=jline.UnixTerminal -jar "$WDIR/sbt-launch.jar" $@
|
||||
"$JAVA_CMD" $JAVA_OPTS -Djline.terminal=jline.UnixTerminal $SBT_OPTS -jar "$WDIR/sbt-launch.jar" "$@"
|
||||
stty icanon echo > /dev/null 2>&1
|
||||
else
|
||||
# Use Jansi to intercept ANSI sequences
|
||||
$JAVA_CMD $JAVA_OPTS -Dsbt.log.format=true -cp "$WDIR/jansi.jar;$WDIR/sbt-launch.jar;$WDIR/classes" SbtJansiLaunch $@
|
||||
"$JAVA_CMD" -Dsbt.log.format=true $JAVA_OPTS $SBT_OPTS -cp "$WDIR/jansi.jar;$WDIR/sbt-launch.jar;$WDIR/classes" SbtJansiLaunch "$@"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -3,14 +3,26 @@
|
|||
@REM Envioronment:
|
||||
@REM JAVA_HOME - location of a JDK home dir (mandatory)
|
||||
@REM SBT_OPTS - JVM options (optional)
|
||||
@REM Configuration:
|
||||
@REM sbtconfig.txt found in the SBT_HOME.
|
||||
|
||||
|
||||
@setlocal
|
||||
@REM ZOMG! We need delayed expansion to build up CFG_OPTS later
|
||||
@setlocal enabledelayedexpansion
|
||||
|
||||
@echo off
|
||||
set SBT_HOME=%~dp0
|
||||
set ERROR_CODE=0
|
||||
|
||||
rem FIRST we load the config file of extra options.
|
||||
set FN=%SBT_HOME%sbtconfig.txt
|
||||
set CFG_OPTS=
|
||||
FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%FN%") DO (
|
||||
set DO_NOT_REUSE_ME=%%i
|
||||
rem ZOMG (Part #2) WE use !! here to delay the expansion of
|
||||
rem CFG_OPTS, otherwise it remains "" for this loop.
|
||||
set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME!
|
||||
)
|
||||
|
||||
rem We use the value of the JAVACMD environment variable if defined
|
||||
set _JAVACMD=%JAVACMD%
|
||||
|
||||
|
|
@ -22,9 +34,9 @@ if "%_JAVACMD%"=="" (
|
|||
|
||||
if "%_JAVACMD%"=="" set _JAVACMD=java
|
||||
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
|
||||
set _JAVA_OPTS=%JAVA_OPTS%
|
||||
if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=-Xmx512M -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=128m -Dsbt.log.format=true
|
||||
if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=%CFG_OPTS%
|
||||
|
||||
:run
|
||||
|
||||
|
|
@ -39,4 +51,4 @@ set ERROR_CODE=1
|
|||
|
||||
@endlocal
|
||||
|
||||
exit /B %ERROR_CODE%
|
||||
exit /B %ERROR_CODE%
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
# Set the java args to high
|
||||
|
||||
-Xmx512M
|
||||
|
||||
-XX:MaxPermSize=256m
|
||||
|
||||
-XX:ReservedCodeCacheSize=128m
|
||||
|
||||
|
||||
|
||||
# Set the extra SBT options
|
||||
|
||||
-Dsbt.log.format=true
|
||||
|
||||
Loading…
Reference in New Issue