Skip to content

Commit

Permalink
Merge pull request #399 from eed3si9n/wip/gigahorse
Browse files Browse the repository at this point in the history
Drop OkHttp dependency
  • Loading branch information
eed3si9n authored Jun 13, 2022
2 parents c571b46 + 76452e5 commit da80b6a
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 484 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
case ${{ matrix.jobtype }} in
1)
sbt -v -Dfile.encoding=UTF8 scalafmtCheckAll whitesourceCheckPolicies +test +packagedArtifacts
sbt -v -Dfile.encoding=UTF8 scalafmtCheckAll +test +packagedArtifacts
;;
*)
echo unknown jobtype
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ __pycache__

scripted-test/src/sbt-test/*/*/project/build.properties
scripted-test/src/sbt-test/*/*/project/plugins.sbt
metals.sbt
31 changes: 16 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ val _ = {
//https://github.com/sbt/contraband/issues/122
sys.props += ("line.separator" -> "\n")
}

Global / semanticdbEnabled := true
Global / semanticdbVersion := "4.5.9"
ThisBuild / version := {
val old = (ThisBuild / version).value
nightlyVersion match {
Expand Down Expand Up @@ -88,6 +89,7 @@ val mimaSettings = Def settings (
"1.3.0",
"1.4.0",
"1.5.0",
"1.6.0",
) map (
version =>
organization.value %% moduleName.value % version
Expand Down Expand Up @@ -118,8 +120,7 @@ lazy val lmCore = (project in file("core"))
scalaReflect.value,
scalaCompiler.value,
launcherInterface,
gigahorseOkhttp,
okhttpUrlconnection,
gigahorseApacheHttp,
sjsonnewScalaJson.value % Optional,
scalaTest % Test,
scalaCheck % Test,
Expand Down Expand Up @@ -260,7 +261,9 @@ lazy val lmCore = (project in file("core"))
"sbt.librarymanagement.ResolverFunctions.validateArtifact"
),
exclude[IncompatibleResultTypeProblem]("sbt.librarymanagement.*.validateProtocol"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.cross.CrossVersionUtil.TransitionDottyVersion"),
exclude[DirectMissingMethodProblem](
"sbt.internal.librarymanagement.cross.CrossVersionUtil.TransitionDottyVersion"
),
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ScalaArtifacts.dottyID"),
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ScalaArtifacts.DottyIDPrefix"),
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ScalaArtifacts.toolDependencies*"),
Expand Down Expand Up @@ -351,6 +354,15 @@ lazy val lmIvy = (project in file("ivy"))
"sbt.internal.librarymanagement.CustomPomParser.versionRangeFlag"
),
exclude[MissingClassProblem]("sbt.internal.librarymanagement.FixedParser*"),
exclude[MissingClassProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler*"),
exclude[MissingClassProblem]("sbt.internal.librarymanagement.JavaNetAuthenticator"),
exclude[MissingClassProblem]("sbt.internal.librarymanagement.CustomHttp*"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.IvySbt.http"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.IvySbt.this"),
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ivy.IvyPublisher.apply"),
exclude[DirectMissingMethodProblem](
"sbt.librarymanagement.ivy.IvyDependencyResolution.apply"
),
),
)

Expand Down Expand Up @@ -387,16 +399,5 @@ def customCommands: Seq[Setting[_]] = Seq(
}
)

inThisBuild(
Seq(
whitesourceProduct := "Lightbend Reactive Platform",
whitesourceAggregateProjectName := "sbt-lm-master",
whitesourceAggregateProjectToken := "9bde4ccbaab7401a91f8cda337af84365d379e13abaf473b85cb16e3f5c65cb6",
whitesourceIgnoredScopes += "scalafmt",
whitesourceFailOnError := sys.env.contains("WHITESOURCE_PASSWORD"), // fail if pwd is present
whitesourceForceCheckAllDependencies := true,
)
)

def inCompileAndTest(ss: SettingsDefinition*): Seq[Setting[_]] =
Seq(Compile, Test) flatMap (inConfig(_)(Def.settings(ss: _*)))
2 changes: 1 addition & 1 deletion core/src/main/scala/sbt/librarymanagement/Http.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sbt.librarymanagement

import gigahorse._, support.okhttp.Gigahorse
import gigahorse._, support.apachehttp.Gigahorse
import scala.concurrent.duration.DurationInt

object Http {
Expand Down

This file was deleted.

21 changes: 0 additions & 21 deletions ivy/src/main/scala/sbt/internal/librarymanagement/CustomHttp.scala

This file was deleted.

10 changes: 2 additions & 8 deletions ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import java.io.File
import java.net.URI
import java.util.concurrent.Callable

import okhttp3.OkHttpClient
import org.apache.ivy.Ivy
import org.apache.ivy.core.IvyPatternHelper
import org.apache.ivy.core.cache.{ CacheMetadataOptions, DefaultRepositoryCacheManager }
Expand Down Expand Up @@ -50,17 +49,13 @@ import ivyint.{
CachedResolutionResolveEngine,
ParallelResolveEngine,
SbtDefaultDependencyDescriptor,
GigahorseUrlHandler
}
import sjsonnew.JsonFormat
import sjsonnew.support.murmurhash.Hasher

final class IvySbt(
val configuration: IvyConfiguration,
val http: OkHttpClient
) { self =>
def this(configuration: IvyConfiguration) = this(configuration, CustomHttp.defaultHttpClient)

/*
* ========== Configuration/Setup ============
* This part configures the Ivy instance by first creating the logger interface to ivy, then IvySettings, and then the Ivy instance.
Expand Down Expand Up @@ -90,7 +85,6 @@ final class IvySbt(
}

private lazy val basicUrlHandler: URLHandler = new BasicURLHandler
private lazy val gigahorseUrlHandler: URLHandler = new GigahorseUrlHandler(http)

private lazy val settings: IvySettings = {
val dispatcher: URLHandlerDispatcher = URLHandlerRegistry.getDefault match {
Expand All @@ -106,8 +100,8 @@ final class IvySbt(
disp
}

val urlHandler: URLHandler =
if (configuration.updateOptions.gigahorse) gigahorseUrlHandler else basicUrlHandler
// Ignore configuration.updateOptions.gigahorse due to sbt/sbt#6912
val urlHandler: URLHandler = basicUrlHandler

// Only set the urlHandler for the http/https protocols so we do not conflict with any other plugins
// that might register other protocol handlers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class IvyCache(val ivyHome: Option[File]) {
.withResolvers(Vector(local))
.withLock(lock)
.withLog(log)
(new IvySbt(conf, CustomHttp.defaultHttpClient), local)
(new IvySbt(conf), local)
}

/** Creates a default jar artifact based on the given ID.*/
Expand Down
Loading

0 comments on commit da80b6a

Please sign in to comment.