mirror of
				https://github.com/gitbucket/gitbucket.git
				synced 2025-11-03 20:15:59 +01:00 
			
		
		
		
	(refs #1346)Update to use blocking-slick for Scala 2.12 support
This commit is contained in:
		@@ -37,6 +37,7 @@ libraryDependencies ++= Seq(
 | 
			
		||||
  "org.apache.tika"                 %  "tika-core"                    % "1.13",
 | 
			
		||||
  //"com.typesafe.slick"              %% "slick"                        % "3.2.0-M1",
 | 
			
		||||
  "com.github.takezoe"              %% "blocking-slick"               % "0.0.3-SNAPSHOT",
 | 
			
		||||
  "joda-time"                       % "joda-time"                     % "2.9.6",
 | 
			
		||||
  "com.novell.ldap"                 %  "jldap"                        % "2009-10-07",
 | 
			
		||||
  "com.h2database"                  %  "h2"                           % "1.4.192",
 | 
			
		||||
  "mysql"                           %  "mysql-connector-java"         % "5.1.39",
 | 
			
		||||
@@ -46,7 +47,7 @@ libraryDependencies ++= Seq(
 | 
			
		||||
  "com.typesafe"                    %  "config"                       % "1.3.0",
 | 
			
		||||
  "com.typesafe.akka"               %% "akka-actor"                   % "2.4.12",
 | 
			
		||||
  "fr.brouillard.oss.security.xhub" %  "xhub4j-core"                  % "1.0.0",
 | 
			
		||||
  "com.enragedginger"               % "akka-quartz-scheduler_2.11"    % "1.5.0-akka-2.4.x" exclude("c3p0","c3p0"), // TODO Scala 2.12
 | 
			
		||||
  "com.enragedginger"               %% "akka-quartz-scheduler"         % "1.6.0-akka-2.4.x" exclude("c3p0","c3p0"),
 | 
			
		||||
  "org.eclipse.jetty"               %  "jetty-webapp"                 % JettyVersion     % "provided",
 | 
			
		||||
  "javax.servlet"                   %  "javax.servlet-api"            % "3.1.0"          % "provided",
 | 
			
		||||
  "junit"                           %  "junit"                        % "4.12"           % "test",
 | 
			
		||||
@@ -56,7 +57,7 @@ libraryDependencies ++= Seq(
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Compiler settings
 | 
			
		||||
scalacOptions := Seq("-deprecation", "-language:postfixOps", "-Ybackend:GenBCode", "-Ydelambdafy:method", "-target:jvm-1.8")
 | 
			
		||||
scalacOptions := Seq("-deprecation", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-1.8")
 | 
			
		||||
javacOptions in compile ++= Seq("-target", "8", "-source", "8")
 | 
			
		||||
javaOptions in Jetty += "-Dlogback.configurationFile=/logback-dev.xml"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
 | 
			
		||||
 | 
			
		||||
addSbtPlugin("com.typesafe.sbt"     % "sbt-twirl"         % "1.1.1")
 | 
			
		||||
addSbtPlugin("com.typesafe.sbt"     % "sbt-twirl"         % "1.3.0")
 | 
			
		||||
addSbtPlugin("com.eed3si9n"         % "sbt-assembly"      % "0.14.3")
 | 
			
		||||
addSbtPlugin("com.earldouglas"      % "xsbt-web-plugin"   % "2.1.1")
 | 
			
		||||
addSbtPlugin("fi.gekkio.sbtplugins" % "sbt-jrebel-plugin" % "0.10.0")
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,8 @@
 | 
			
		||||
package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.{Account, AccessToken}
 | 
			
		||||
import gitbucket.core.util.StringUtil
 | 
			
		||||
 | 
			
		||||
@@ -21,7 +20,7 @@ trait AccessTokenService {
 | 
			
		||||
  def tokenToHash(token: String): String = StringUtil.sha1(token)
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @retuen (TokenId, Token)
 | 
			
		||||
   * @return (TokenId, Token)
 | 
			
		||||
   */
 | 
			
		||||
  def generateAccessToken(userName: String, note: String)(implicit s: Session): (Int, String) = {
 | 
			
		||||
    var token: String = null
 | 
			
		||||
@@ -43,8 +42,8 @@ trait AccessTokenService {
 | 
			
		||||
  def getAccountByAccessToken(token: String)(implicit s: Session): Option[Account] =
 | 
			
		||||
    Accounts
 | 
			
		||||
      .join(AccessTokens)
 | 
			
		||||
      .filter{ case (ac, t) => (ac.userName === t.userName) && (t.tokenHash === tokenToHash(token).bind) && (ac.removed === false.bind) }
 | 
			
		||||
      .map{ case (ac, t) => ac }
 | 
			
		||||
      .filter { case (ac, t) => (ac.userName === t.userName) && (t.tokenHash === tokenToHash(token).bind) && (ac.removed === false.bind) }
 | 
			
		||||
      .map { case (ac, t) => ac }
 | 
			
		||||
      .firstOption
 | 
			
		||||
 | 
			
		||||
  def getAccessTokens(userName: String)(implicit s: Session): List[AccessToken] =
 | 
			
		||||
 
 | 
			
		||||
@@ -3,12 +3,12 @@ package gitbucket.core.service
 | 
			
		||||
import org.slf4j.LoggerFactory
 | 
			
		||||
import gitbucket.core.model.{GroupMember, Account}
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.dateColumnType
 | 
			
		||||
import gitbucket.core.util.{StringUtil, LDAPUtil}
 | 
			
		||||
import StringUtil._
 | 
			
		||||
import gitbucket.core.service.SystemSettingsService.SystemSettings
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.dateColumnType
 | 
			
		||||
 | 
			
		||||
trait AccountService {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.Activity
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.util.JGitUtil
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
 | 
			
		||||
trait ActivityService {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.dateColumnType
 | 
			
		||||
import gitbucket.core.model.{CommitState, CommitStatus, Account}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,8 @@ package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.CommitComment
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.dateColumnType
 | 
			
		||||
 | 
			
		||||
trait CommitsService {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,8 @@ import gitbucket.core.util.StringUtil._
 | 
			
		||||
import gitbucket.core.util.Implicits._
 | 
			
		||||
import gitbucket.core.model._
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.dateColumnType
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,8 @@ package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.Label
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
 | 
			
		||||
trait LabelsService {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,8 @@ package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.Milestone
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.dateColumnType
 | 
			
		||||
 | 
			
		||||
trait MilestonesService {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.{ProtectedBranch, ProtectedBranchContext, CommitState}
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.plugin.ReceiveHook
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
 | 
			
		||||
import org.eclipse.jgit.transport.{ReceivePack, ReceiveCommand}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,10 @@
 | 
			
		||||
package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.{Account, Issue, PullRequest, WebHook, CommitStatus, CommitState}
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.model.{Issue, PullRequest, CommitStatus, CommitState}
 | 
			
		||||
import gitbucket.core.util.JGitUtil
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
 | 
			
		||||
trait PullRequestService { self: IssuesService =>
 | 
			
		||||
  import PullRequestService._
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ import gitbucket.core.controller.Context
 | 
			
		||||
import gitbucket.core.util.JGitUtil
 | 
			
		||||
import gitbucket.core.model.{Collaborator, Repository, RepositoryOptions, Account, Permission}
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.dateColumnType
 | 
			
		||||
 | 
			
		||||
trait RepositoryService { self: AccountService =>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,8 @@ package gitbucket.core.service
 | 
			
		||||
 | 
			
		||||
import gitbucket.core.model.SshKey
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
 | 
			
		||||
trait SshKeyService {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,9 +5,9 @@ import fr.brouillard.oss.security.xhub.XHub.{XHubDigest, XHubConverter}
 | 
			
		||||
import gitbucket.core.api._
 | 
			
		||||
import gitbucket.core.model.{WebHook, Account, Issue, PullRequest, IssueComment, WebHookEvent, CommitComment}
 | 
			
		||||
import gitbucket.core.model.Profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile._
 | 
			
		||||
import gitbucket.core.model.Profile.profile.blockingApi._
 | 
			
		||||
import org.apache.http.client.utils.URLEncodedUtils
 | 
			
		||||
import profile._
 | 
			
		||||
import profile.blockingApi._
 | 
			
		||||
import gitbucket.core.util.JGitUtil.CommitInfo
 | 
			
		||||
import gitbucket.core.util.RepositoryName
 | 
			
		||||
import gitbucket.core.service.RepositoryService.RepositoryInfo
 | 
			
		||||
 
 | 
			
		||||
@@ -101,18 +101,18 @@ object StringUtil {
 | 
			
		||||
      .findAllIn(message).matchData.map(_.group(1)).toSeq.distinct
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Encode search string for LIKE condition.
 | 
			
		||||
   * This method has been copied from Slick's SqlUtilsComponent.
 | 
			
		||||
   */
 | 
			
		||||
  def likeEncode(s: String) = {
 | 
			
		||||
    val b = new StringBuilder
 | 
			
		||||
    for(c <- s) c match {
 | 
			
		||||
      case '%' | '_' | '^' => b append '^' append c
 | 
			
		||||
      case _ => b append c
 | 
			
		||||
    }
 | 
			
		||||
    b.toString
 | 
			
		||||
  }
 | 
			
		||||
//  /**
 | 
			
		||||
//   * Encode search string for LIKE condition.
 | 
			
		||||
//   * This method has been copied from Slick's SqlUtilsComponent.
 | 
			
		||||
//   */
 | 
			
		||||
//  def likeEncode(s: String) = {
 | 
			
		||||
//    val b = new StringBuilder
 | 
			
		||||
//    for(c <- s) c match {
 | 
			
		||||
//      case '%' | '_' | '^' => b append '^' append c
 | 
			
		||||
//      case _ => b append c
 | 
			
		||||
//    }
 | 
			
		||||
//    b.toString
 | 
			
		||||
//  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user