mirror of https://github.com/sbt/sbt.git
export repo using Coursier (#267)
export repo using Coursier Ref https://github.com/sbt/sbt/issues/4661
This commit is contained in:
parent
77ad65ed73
commit
a85b486b4c
|
|
@ -22,7 +22,7 @@ install:
|
||||||
- SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8
|
- SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- sbt "-Dsbt.build.version=1.2.8" universal:packageBin
|
- sbt "-Dsbt.build.version=1.3.0-M4" universal:packageBin
|
||||||
- cd citest
|
- cd citest
|
||||||
- test.bat
|
- test.bat
|
||||||
- test1.bat
|
- test1.bat
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ language: scala
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- SBT_VER=1.2.8
|
- SBT_VER=1.3.0-M4
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,95 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set HOME=%HOMEDRIVE%%HOMEPATH%)
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" @setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
for /f %%j in ("java.exe") do (
|
||||||
|
set JAVA_EXE="%%~$PATH:j"
|
||||||
|
goto init
|
||||||
|
)
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" (
|
||||||
|
SET JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
goto init
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory.
|
||||||
|
echo JAVA_HOME = %JAVA_HOME%
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:init
|
||||||
|
@REM Decide how to startup depending on the version of windows
|
||||||
|
|
||||||
|
@REM -- Win98ME
|
||||||
|
if NOT "%OS%"=="Windows_NT" goto Win9xArg
|
||||||
|
|
||||||
|
@REM -- 4NT shell
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NTArgs
|
||||||
|
|
||||||
|
@REM -- Regular WinNT shell
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto endInit
|
||||||
|
|
||||||
|
@REM The 4NT Shell from jp software
|
||||||
|
:4NTArgs
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
goto endInit
|
||||||
|
|
||||||
|
:Win9xArg
|
||||||
|
@REM Slurp the command line arguments. This loop allows for an unlimited number
|
||||||
|
@REM of agruments (up to the command line limit, anyway).
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
:Win9xApp
|
||||||
|
if %1a==a goto endInit
|
||||||
|
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
|
||||||
|
shift
|
||||||
|
goto Win9xApp
|
||||||
|
|
||||||
|
@REM Reaching here means variables are defined and arguments have been captured
|
||||||
|
:endInit
|
||||||
|
|
||||||
|
set JAR_PATH=%~dp0\%~n0
|
||||||
|
SET PROG_DIR=%~dp0
|
||||||
|
SET PSEP=;
|
||||||
|
|
||||||
|
@REM Start Java program
|
||||||
|
:runm2
|
||||||
|
SET CMDLINE=%JAVA_EXE% -noverify %JAVA_OPTS% -Dprog.dir="%PROG_DIR:\=\\%" -jar "%JAR_PATH%" %CMD_LINE_ARGS%
|
||||||
|
%CMDLINE%
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
if "%OS%"=="Windows_NT" @endlocal
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@REM set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" goto endNT
|
||||||
|
|
||||||
|
@REM For old DOS remove the set variables from ENV - we assume they were not set
|
||||||
|
@REM before we started - at least we don't leave any baggage around
|
||||||
|
set JAVA_EXE=
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set CMDLINE=
|
||||||
|
set PSEP=
|
||||||
|
goto postExec
|
||||||
|
|
||||||
|
:endNT
|
||||||
|
@endlocal
|
||||||
|
|
||||||
|
:postExec
|
||||||
|
exit /B %ERROR_CODE%
|
||||||
46
build.sbt
46
build.sbt
|
|
@ -32,6 +32,7 @@ lazy val sbt013ExtraDeps = {
|
||||||
else Seq()
|
else Seq()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lazy val isWindows: Boolean = sys.props("os.name").toLowerCase(java.util.Locale.ENGLISH).contains("windows")
|
||||||
lazy val isExperimental = (sbtVersionToRelease contains "RC") || (sbtVersionToRelease contains "M")
|
lazy val isExperimental = (sbtVersionToRelease contains "RC") || (sbtVersionToRelease contains "M")
|
||||||
val sbtLaunchJarUrl = SettingKey[String]("sbt-launch-jar-url")
|
val sbtLaunchJarUrl = SettingKey[String]("sbt-launch-jar-url")
|
||||||
val sbtLaunchJarLocation = SettingKey[File]("sbt-launch-jar-location")
|
val sbtLaunchJarLocation = SettingKey[File]("sbt-launch-jar-location")
|
||||||
|
|
@ -51,6 +52,9 @@ val bintrayReleaseAllStaged = TaskKey[Unit]("bintray-release-all-staged", "Relea
|
||||||
val windowsBuildId = settingKey[Int]("build id for Windows installer")
|
val windowsBuildId = settingKey[Int]("build id for Windows installer")
|
||||||
val debianBuildId = settingKey[Int]("build id for Debian")
|
val debianBuildId = settingKey[Int]("build id for Debian")
|
||||||
|
|
||||||
|
val exportRepoUsingCoursier = taskKey[File]("export Maven style repository")
|
||||||
|
val exportRepoCsrDirectory = settingKey[File]("")
|
||||||
|
|
||||||
// This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution.
|
// This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution.
|
||||||
val root = (project in file(".")).
|
val root = (project in file(".")).
|
||||||
enablePlugins(UniversalPlugin, LinuxPlugin, DebianPlugin, RpmPlugin, WindowsPlugin,
|
enablePlugins(UniversalPlugin, LinuxPlugin, DebianPlugin, RpmPlugin, WindowsPlugin,
|
||||||
|
|
@ -186,7 +190,12 @@ val root = (project in file(".")).
|
||||||
Seq(launchJar -> "bin/sbt-launch.jar", rtExportJar -> "bin/java9-rt-export.jar")
|
Seq(launchJar -> "bin/sbt-launch.jar", rtExportJar -> "bin/java9-rt-export.jar")
|
||||||
},
|
},
|
||||||
mappings in Universal ++= (Def.taskDyn {
|
mappings in Universal ++= (Def.taskDyn {
|
||||||
if (sbtOfflineInstall)
|
if (sbtOfflineInstall && sbtVersionToRelease.startsWith("1."))
|
||||||
|
Def.task {
|
||||||
|
val _ = (exportRepoUsingCoursier in dist).value
|
||||||
|
directory((target in dist).value / "lib")
|
||||||
|
}
|
||||||
|
else if (sbtOfflineInstall)
|
||||||
Def.task {
|
Def.task {
|
||||||
val _ = (exportRepo in dist).value
|
val _ = (exportRepo in dist).value
|
||||||
directory((target in dist).value / "lib")
|
directory((target in dist).value / "lib")
|
||||||
|
|
@ -330,15 +339,7 @@ lazy val dist = (project in file("dist"))
|
||||||
val old = exportRepo.value
|
val old = exportRepo.value
|
||||||
sbtVersionToRelease match {
|
sbtVersionToRelease match {
|
||||||
case v if v.startsWith("1.") =>
|
case v if v.startsWith("1.") =>
|
||||||
val zincBase = exportRepoDirectory.value / "org.scala-sbt" / "zinc_2.12"
|
sys.error("sbt 1.x should use coursier")
|
||||||
val zincVersion = (zincBase * DirectoryFilter).get.head.getName
|
|
||||||
val utilBase = exportRepoDirectory.value / "org.scala-sbt" / "util-logging_2.12"
|
|
||||||
val utilVersion = (utilBase * DirectoryFilter).get.head.getName
|
|
||||||
val outbase = exportRepoDirectory.value / "org" / "scala-sbt" / "compiler-interface" / zincVersion
|
|
||||||
val uribase = s"https://oss.sonatype.org/content/repositories/public/org/scala-sbt/compiler-interface/$zincVersion/"
|
|
||||||
downloadUrl(uri(uribase + s"compiler-interface-${zincVersion}.jar"), outbase / s"compiler-interface-${zincVersion}.jar")
|
|
||||||
downloadUrl(uri(uribase + s"compiler-interface-${zincVersion}-sources.jar"), outbase / s"compiler-interface-${zincVersion}-sources.jar")
|
|
||||||
downloadUrl(uri(uribase + s"compiler-interface-${zincVersion}.pom"), outbase / s"compiler-interface-${zincVersion}.pom")
|
|
||||||
case v if v.startsWith("0.13.") =>
|
case v if v.startsWith("0.13.") =>
|
||||||
val outbase = exportRepoDirectory.value / "org.scala-sbt" / "compiler-interface" / v
|
val outbase = exportRepoDirectory.value / "org.scala-sbt" / "compiler-interface" / v
|
||||||
val uribase = s"https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/$v/"
|
val uribase = s"https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/$v/"
|
||||||
|
|
@ -350,6 +351,31 @@ lazy val dist = (project in file("dist"))
|
||||||
old
|
old
|
||||||
},
|
},
|
||||||
exportRepoDirectory := target.value / "lib" / "local-preloaded",
|
exportRepoDirectory := target.value / "lib" / "local-preloaded",
|
||||||
|
exportRepoCsrDirectory := exportRepoDirectory.value,
|
||||||
|
exportRepoUsingCoursier := {
|
||||||
|
val outDirectory = exportRepoCsrDirectory.value
|
||||||
|
val csr =
|
||||||
|
if (isWindows) (baseDirectory in LocalRootProject).value / "bin" / "coursier.bat"
|
||||||
|
else (baseDirectory in LocalRootProject).value / "bin" / "coursier"
|
||||||
|
val cache = target.value / "coursier"
|
||||||
|
IO.delete(cache)
|
||||||
|
val v = sbtVersionToRelease
|
||||||
|
s"$csr fetch --cache $cache org.scala-sbt:sbt:$v".!
|
||||||
|
val mavenCache = cache / "https" / "repo1.maven.org" / "maven2"
|
||||||
|
val compilerBridgeVer = IO.listFiles(mavenCache / "org" / "scala-sbt" / "compiler-bridge_2.12", DirectoryFilter).toList.headOption
|
||||||
|
compilerBridgeVer match {
|
||||||
|
case Some(bridgeDir) =>
|
||||||
|
val bridgeVer = bridgeDir.getName
|
||||||
|
s"$csr fetch --cache $cache --sources org.scala-sbt:compiler-bridge_2.10:$bridgeVer".!
|
||||||
|
s"$csr fetch --cache $cache --sources org.scala-sbt:compiler-bridge_2.11:$bridgeVer".!
|
||||||
|
s"$csr fetch --cache $cache --sources org.scala-sbt:compiler-bridge_2.12:$bridgeVer".!
|
||||||
|
s"$csr fetch --cache $cache --sources org.scala-sbt:compiler-bridge_2.13:$bridgeVer".!
|
||||||
|
case _ =>
|
||||||
|
sys.error("bridge not found")
|
||||||
|
}
|
||||||
|
IO.copyDirectory(mavenCache, outDirectory, true, true)
|
||||||
|
outDirectory
|
||||||
|
},
|
||||||
conflictWarning := ConflictWarning.disable,
|
conflictWarning := ConflictWarning.disable,
|
||||||
publish := (),
|
publish := (),
|
||||||
publishLocal := (),
|
publishLocal := (),
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,10 @@ lazy val root = (project in file("."))
|
||||||
println(xs)
|
println(xs)
|
||||||
|
|
||||||
assert(xs(0) startsWith "[info] Loading project definition")
|
assert(xs(0) startsWith "[info] Loading project definition")
|
||||||
assert(xs(1) startsWith "[info] Loading settings from build.sbt")
|
assert(xs(1) startsWith "[info] Loading settings")
|
||||||
assert(xs(2) startsWith "[info] Set current project to Hello")
|
assert(xs(2) startsWith "[info] Set current project to Hello")
|
||||||
assert(xs(3) startsWith "[info] This is sbt")
|
assert(xs(3) startsWith "[info] This is sbt")
|
||||||
assert(xs(4) startsWith "[info] The current project")
|
assert(xs(4) startsWith "[info] The current project")
|
||||||
assert(xs(5) startsWith "[info] The current project is built against Scala 2.12.4")
|
|
||||||
|
|
||||||
val ys = IO.readLines(file("err.txt")).toVector.distinct
|
val ys = IO.readLines(file("err.txt")).toVector.distinct
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
sbt.version=1.1.1
|
sbt.version=1.3.0-M4
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ SET JAVA_HOME=C:\jdk11
|
||||||
SET PATH=C:\jdk11\bin;%PATH%
|
SET PATH=C:\jdk11\bin;%PATH%
|
||||||
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
||||||
|
|
||||||
"freshly-baked\sbt\bin\sbt" about
|
"freshly-baked\sbt\bin\sbt" "-Dsbt.no.format=true" about
|
||||||
|
|
||||||
ENDLOCAL
|
ENDLOCAL
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,14 @@ fail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
env HOME=./target/home1 ./freshly-baked/sbt/bin/sbt about
|
env HOME=./target/home1 ./freshly-baked/sbt/bin/sbt about
|
||||||
test -d ./target/home1/.sbt/preloaded/org.scala-sbt || fail "expected to find preloaded in ./target/home1/.sbt"
|
test -d ./target/home1/.sbt/preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home1/.sbt"
|
||||||
|
|
||||||
env HOME=./target/home2 ./freshly-baked/sbt/bin/sbt -sbt-dir ./target/home2/alternate-sbt about
|
env HOME=./target/home2 ./freshly-baked/sbt/bin/sbt -sbt-dir ./target/home2/alternate-sbt about
|
||||||
test -d ./target/home2/alternate-sbt/preloaded/org.scala-sbt || fail "expected to find preloaded in ./target/home2/alternate-sbt"
|
test -d ./target/home2/alternate-sbt/preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home2/alternate-sbt"
|
||||||
|
|
||||||
env HOME=./target/home3 ./freshly-baked/sbt/bin/sbt -J-Dsbt.preloaded=./target/home3/alternate-preloaded about
|
env HOME=./target/home3 ./freshly-baked/sbt/bin/sbt -J-Dsbt.preloaded=./target/home3/alternate-preloaded about
|
||||||
test -d ./target/home3/alternate-preloaded/org.scala-sbt || fail "expected to find preloaded in ./target/home3/alternate-preloaded"
|
test -d ./target/home3/alternate-preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home3/alternate-preloaded"
|
||||||
|
|
||||||
env HOME=./target/home4 ./freshly-baked/sbt/bin/sbt -J-Dsbt.global.base=./target/home4/global-base about
|
env HOME=./target/home4 ./freshly-baked/sbt/bin/sbt -J-Dsbt.global.base=./target/home4/global-base about
|
||||||
test -d ./target/home4/global-base/preloaded/org.scala-sbt || fail "expected to find preloaded in ./target/home4/global-base"
|
test -d ./target/home4/global-base/preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home4/global-base"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,6 @@ SET JAVA_HOME=C:\jdk11
|
||||||
SET PATH=C:\jdk11\bin;%PATH%
|
SET PATH=C:\jdk11\bin;%PATH%
|
||||||
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
||||||
|
|
||||||
"freshly-baked\sbt\bin\sbt" about 1> output.txt 2> err.txt
|
"freshly-baked\sbt\bin\sbt" "-Dsbt.no.format=true" about 1> output.txt 2> err.txt
|
||||||
|
|
||||||
ENDLOCAL
|
ENDLOCAL
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,6 @@ SET JAVA_HOME=C:\jdk11
|
||||||
SET PATH=C:\jdk11\bin;%PATH%
|
SET PATH=C:\jdk11\bin;%PATH%
|
||||||
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
||||||
|
|
||||||
"freshly-baked\sbt\bin\sbt" check
|
"freshly-baked\sbt\bin\sbt" "-Dsbt.no.format=true" check
|
||||||
|
|
||||||
ENDLOCAL
|
ENDLOCAL
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ syncPreloaded() {
|
||||||
local target_preloaded="$(getPreloaded)"
|
local target_preloaded="$(getPreloaded)"
|
||||||
if [[ "$init_sbt_version" == "" ]]; then
|
if [[ "$init_sbt_version" == "" ]]; then
|
||||||
# FIXME: better $init_sbt_version detection
|
# FIXME: better $init_sbt_version detection
|
||||||
init_sbt_version="$(ls -1 "$source_preloaded/org.scala-sbt/sbt/")"
|
init_sbt_version="$(ls -1 "$source_preloaded/org/scala-sbt/sbt/")"
|
||||||
fi
|
fi
|
||||||
[[ -f "$target_preloaded/org.scala-sbt/sbt/$init_sbt_version/jars/sbt.jar" ]] || {
|
[[ -f "$target_preloaded/org.scala-sbt/sbt/$init_sbt_version/jars/sbt.jar" ]] || {
|
||||||
# lib/local-preloaded exists (This is optional)
|
# lib/local-preloaded exists (This is optional)
|
||||||
|
|
|
||||||
|
|
@ -190,11 +190,11 @@ exit /B 0
|
||||||
:sync_preloaded
|
:sync_preloaded
|
||||||
if "%INIT_SBT_VERSION%"=="" (
|
if "%INIT_SBT_VERSION%"=="" (
|
||||||
rem FIXME: better %INIT_SBT_VERSION% detection
|
rem FIXME: better %INIT_SBT_VERSION% detection
|
||||||
FOR /F "tokens=* USEBACKQ" %%F IN (`dir /b "%SBT_HOME%\..\lib\local-preloaded\org.scala-sbt\sbt" /B`) DO (
|
FOR /F "tokens=* USEBACKQ" %%F IN (`dir /b "%SBT_HOME%\..\lib\local-preloaded\org\scala-sbt\sbt" /B`) DO (
|
||||||
SET INIT_SBT_VERSION=%%F
|
SET INIT_SBT_VERSION=%%F
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
set PRELOAD_SBT_JAR="%UserProfile%\.sbt\preloaded\org.scala-sbt\sbt\%INIT_SBT_VERSION%\jars\sbt.jar"
|
set PRELOAD_SBT_JAR="%UserProfile%\.sbt\preloaded\org\scala-sbt\sbt\%INIT_SBT_VERSION%\"
|
||||||
if /I %JAVA_VERSION% GEQ 8 (
|
if /I %JAVA_VERSION% GEQ 8 (
|
||||||
where robocopy >nul 2>nul
|
where robocopy >nul 2>nul
|
||||||
if %ERRORLEVEL% equ 0 (
|
if %ERRORLEVEL% equ 0 (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue