@@ -7,80 +7,53 @@ import com.typesafe.sbt.SbtNativePackager.Universal
77import com .typesafe .sbt .packager .universal .Keys .packageZipTarball
88
99object ApplicationBuild extends Build {
10-
1110 val appName = " graylog2-web-interface"
1211 val appVersion = " 0.21.0-beta3-SNAPSHOT"
13-
14-
15- // use this to potentially add a timestamp to the built package name
16- def packageSnapshot = Command .command(" package-snapshot" ) { state =>
17- val extracted = Project extract state
18-
19- val configFile : File = new File (" conf/graylog2-web-interface.conf" )
20- val exampleConfigFile : File = new File (" misc/graylog2-web-interface.conf.example" )
21-
22- // this will overwrite the config file with the sample one
23- IO .copyFile(exampleConfigFile, configFile, preserveLastModified = true )
24-
25- val task : (State , File ) = extracted.runTask(packageZipTarball in Universal , state)
26-
27- val snapshot = extracted.getOpt(isSnapshot).get // getting current version
28- if (snapshot) {
29- val dateFormat = { val df = new SimpleDateFormat (" yyyyMMddhhmmss" );
30- df.setTimeZone(TimeZone .getTimeZone(" UTC" )); df
31- }
32- val timestamp = dateFormat.format(new Date ())
33- // fuck it sbt, really.
34- // changing the state to use a different package name is not possible, because the artifact name has already been
35- // constructed at the time this runs. instead of doing it lazily the native packager does it eagerly, so we can't
36- // change it anymore.
37- val packageDir : File = new File (task._2.getParentFile, " package" )
38- packageDir.mkdir()
39- task._2.renameTo(new File (packageDir, task._2.getName.replace(" .tgz" , " -" + timestamp + " .tgz" )))
40- }
41- task._1
42- }
43-
4412 val appDependencies = Seq (
4513 cache,
4614 javaCore,
47- javaJdbc,
4815 javaEbean,
49-
5016 " com.google.code.gson" % " gson" % " 2.2" ,
5117 " com.google.guava" % " guava" % " 14.0" ,
5218 " com.ning" % " async-http-client" % " 1.7.17" ,
5319 " org.apache.shiro" % " shiro-core" % " 1.2.2" ,
5420 " com.google.inject" % " guice" % " 3.0" ,
5521 " com.google.inject.extensions" % " guice-assistedinject" % " 3.0" ,
5622 " javax.inject" % " javax.inject" % " 1" ,
57-
5823 " org.graylog2" % " play2-graylog2_2.10" % " 1.0" ,
59- // "org.graylog2" % "graylog2-rest-client" % "0.21.0-SNAPSHOT" changing(),
60-
61- " org.elasticsearch" % " elasticsearch" % " 0.90.5" % " test" ,
62-
63- " org.fluentlenium" % " fluentlenium-core" % " 0.9.0" % " test" ,
64- " org.fluentlenium" % " fluentlenium-festassert" % " 0.9.0" % " test" ,
65- " org.mockito" % " mockito-all" % " 1.9.5" % " test" ,
6624
6725 // TODO this is stupid, just to get that UriBuilder...
6826 " javax.ws.rs" % " jsr311-api" % " 0.11" ,
6927 " com.sun.jersey" % " jersey-server" % " 1.17.1" ,
7028 " com.sun.jersey" % " jersey-grizzly2" % " 1.17.1" ,
7129 " com.sun.jersey" % " jersey-bundle" % " 1.17.1" ,
7230
31+ " org.mockito" % " mockito-all" % " 1.9.5" % " test" ,
32+ " org.elasticsearch" % " elasticsearch" % " 0.90.5" % " test" ,
33+ " org.fluentlenium" % " fluentlenium-core" % " 0.9.0" % " test" ,
34+ " org.fluentlenium" % " fluentlenium-festassert" % " 0.9.0" % " test" ,
7335 " org.codehaus.jackson" % " jackson-core-asl" % " 1.9.12" % " test"
7436 )
37+ val repositories = Seq (
38+ Resolver .url(" Graylog2 Play Repository" , url(" http://graylog2.github.io/play2-graylog2/releases/" ))(Resolver .ivyStylePatterns),
39+ Resolver .url(" Graylog2 Play Snapshot Repository" , url(" http://graylog2.github.io/play2-graylog2/snapshots/" ))(Resolver .ivyStylePatterns),
40+ Resolver .sonatypeRepo(" releases" ),
41+ (" Sonatype OSS Snapshots" at " https://oss.sonatype.org/content/repositories/snapshots" )
42+ )
7543
44+ // Submodule
7645 lazy val restClient = Project (" graylog2-rest-client" , file(" modules/graylog2-rest-client" ))
7746
47+ // Helper
48+ val isSnapshot : Boolean = appVersion.endsWith(" SNAPSHOT" )
49+ val timestamp : String = {
50+ val df = new SimpleDateFormat (" yyyyMMddHHmmss" )
51+ df.setTimeZone(TimeZone .getTimeZone(" UTC" ))
52+ df.format(new Date ())
53+ }
54+
7855 val main = play.Project (appName, appVersion, appDependencies).settings(
79- resolvers += Resolver .url(" Graylog2 Play Repository" , url(" http://graylog2.github.io/play2-graylog2/releases/" ))(Resolver .ivyStylePatterns),
80- resolvers += Resolver .url(" Graylog2 Play Snapshot Repository" , url(" http://graylog2.github.io/play2-graylog2/snapshots/" ))(Resolver .ivyStylePatterns),
81- resolvers += Resolver .url(" Typesafe Maven Releases" , url(" http://repo.typesafe.com/typesafe/maven-releases" ))(Resolver .mavenStylePatterns),
82- resolvers += (" Sonatype OSS Snapshots" at " https://oss.sonatype.org/content/repositories/snapshots" ),
83- commands ++= Seq (packageSnapshot),
56+ resolvers ++= repositories,
8457 resourceGenerators in Compile <+= resourceManaged in Compile map { dir =>
8558 val propsFile = new File (dir, " git.properties" )
8659 val currentGitSha = " git.sha1=%s\n " .format(" git rev-parse HEAD" !! )
@@ -98,7 +71,16 @@ object ApplicationBuild extends Build {
9871 IO .write(propsFile, currentGitSha)
9972 }
10073 Seq (propsFile)
74+ },
75+ sources in doc in Compile := List (),
76+ mappings in Universal in packageZipTarball += file(" misc/graylog2-web-interface.conf.example" ) -> " conf/graylog2-web-interface.conf" ,
77+ name in Universal := {
78+ val originalName = (name in Universal ).value
79+ if (isSnapshot) {
80+ s " ${appName}- ${appVersion}- ${timestamp}"
81+ } else {
82+ originalName
83+ }
10184 }
102-
10385 ).dependsOn(restClient)
10486}
0 commit comments