Skip to content

Commit

Permalink
Merge pull request #1 from hmrc/sbt
Browse files Browse the repository at this point in the history
Add sbt support
  • Loading branch information
nick-waddington authored Dec 7, 2018
2 parents efc2f1d + 817376e commit cd05681
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
Staticfile.auth

/vendor
/public
/target
/project/project
/project/target
/.project
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.5.1
18 changes: 18 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import uk.gov.hmrc.sbtdistributables.SbtDistributablesPlugin.publishingSettings

val appName = "vat-end-to-end"

lazy val microservice = Project(appName, file("."))
.enablePlugins(play.sbt.PlayScala, SbtAutoBuildPlugin, SbtGitVersioning, SbtDistributablesPlugin, SbtArtifactory)
.settings(
libraryDependencies ++= AppDependencies.compile ++ AppDependencies.test,
evictionWarningOptions in update := EvictionWarningOptions.default.withWarnScalaVersionEviction(false),
majorVersion := 0
)
.settings(
publishingSettings: _*
)
.settings(
resolvers += Resolver.bintrayRepo("hmrc", "releases"),
resolvers += Resolver.jcenterRepo
)
99 changes: 99 additions & 0 deletions conf/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright 2018 HM Revenue & Customs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include "backend.conf"

# This is the main configuration file for the application.
# ~~~~~

appName=vat-service-guide
appUrl="http://"${appName}".local"
incapacityBenefitPAYEReference="892/BA500"
employmentAndSupportAllowancePAYEReference="267/ESA500"

# An ApplicationLoader that uses Guice to bootstrap the application.
play.application.loader = "uk.gov.hmrc.play.bootstrap.ApplicationLoader"

# Primary entry point for all HTTP requests on Play applications
#play.http.requestHandler = "uk.gov.hmrc.play.bootstrap.http.RequestHandler"

# Provides an implementation of AuditConnector. Use `uk.gov.hmrc.play.bootstrap.AuditModule` or create your own.
# An audit connector must be provided.
#play.modules.enabled += "uk.gov.hmrc.play.bootstrap.AuditModule"

# Provides an implementation of MetricsFilter. Use `uk.gov.hmrc.play.graphite.GraphiteMetricsModule` or create your own.
# A metric filter must be provided
#play.modules.enabled += "uk.gov.hmrc.play.bootstrap.graphite.GraphiteMetricsModule"

# Play Modules
# ~~~~
# Additional play modules can be added here

# Session Timeout
# ~~~~
# The default session timeout for the app is 15 minutes (900seconds).
# Updating this is the responsibility of the app - it must issue a new cookie with each request or the session will
# timeout 15 minutes after login (regardless of user activity).
# session.maxAge=900

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
play.crypto.secret="DUMMY"

# Session configuration
# ~~~~~
application.session.httpOnly=false
application.session.secure=false

# The application languages
# ~~~~~
application.langs="en"

# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `my.application.Router`,
# you may need to define a router file `conf/my.application.routes`.
# Default to Routes in the root package (and conf/routes)
# !!!WARNING!!! DO NOT CHANGE THIS ROUTER
play.http.router=prod.Routes

# Metrics plugin settings - graphite reporting is configured on a per env basis
metrics {
name = ${appName}
rateUnit = SECONDS
durationUnit = SECONDS
showSamples = true
jvm = true
enabled = true
}


# Microservice specific config

auditing {
enabled=false
traceRequests=true
consumer {
baseUri {
host = localhost
port = 8100
}
}
}
2 changes: 2 additions & 0 deletions conf/prod.routes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GET / controllers.Assets.at(path="/public", file="index.html")
GET /*file controllers.Assets.at(path="/public", file)
15 changes: 15 additions & 0 deletions project/AppDependencies.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import play.core.PlayVersion
import play.sbt.PlayImport._
import sbt._

object AppDependencies {
val bootStrapPlayVersion = "3.14.0"

val compile = Seq(
ws,
"uk.gov.hmrc" %% "bootstrap-play-25" % bootStrapPlayVersion)

val test = Seq(
"org.pegdown" % "pegdown" % "1.6.0" % "test",
"org.scalatest" %% "scalatest" % "3.0.5" % "test")
}
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=0.13.17
9 changes: 9 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resolvers += Resolver.url("hmrc-sbt-plugin-releases", url("https://dl.bintray.com/hmrc/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += "HMRC Releases" at "https://dl.bintray.com/hmrc/releases"

addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "1.13.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-git-versioning" % "1.15.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-artifactory" % "0.14.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "1.2.0")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.12")
30 changes: 30 additions & 0 deletions test/BuildSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2018 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package test

import org.scalatest.{Matchers, WordSpec}
import sys.process._

class BuildSpec extends WordSpec with Matchers {
"Building the content" should {
"produce static files" in {
val result = "bundle install" #&& "bundle exec middleman build --build-dir=public/" !

result shouldBe 0
}
}
}

0 comments on commit cd05681

Please sign in to comment.