Skip to content

Commit

Permalink
udpate ivy releases to publish an assembly jar if it exists. Some tid…
Browse files Browse the repository at this point in the history
…y up.
  • Loading branch information
Charles Kubicek committed Dec 2, 2015
1 parent 1a7b530 commit 93052ee
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/main/scala/uk/gov/hmrc/releaser/MavenArtefacts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ object IvyArtefacts{
class IvyArtefacts(map:VersionMapping, localDir:Path) extends TransformerProvider{

val parentDirTransformers = Map(
map.artefactName+"-sources.jar" -> None,
map.artefactName+"-javadoc.jar" -> None,
map.artefactName+".jar" -> Some(new JarManifestTransformer),
"ivy.xml" -> Some(new IvyTransformer)
map.artefactName+"-sources.jar" -> None,
map.artefactName+"-javadoc.jar" -> None,
map.artefactName+"-assembly.jar" -> None,
map.artefactName+".jar" -> Some(new JarManifestTransformer),
"ivy.xml" -> Some(new IvyTransformer)
)

def isTheJarFile(f:String):Boolean={
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/uk/gov/hmrc/releaser/Releaser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import scala.util.{Failure, Success, Try}
class Logger{
def info(st:String) = println("[INFO] " + st)
def debug(st:String) = println("[DEBUG] " + st)
def warn(st:String) = println("[WARN] " + st)
}

object ReleaserMain {
Expand All @@ -57,7 +58,7 @@ object ReleaserMain {
}

object ReleaseType extends Enumeration {
type Margin = Value
type ReleaseType = Value
val MAJOR, MINOR, PATCH = Value

val stringValues: SortedSet[String] = this.values.map(_.toString)
Expand Down
4 changes: 3 additions & 1 deletion src/test/scala/uk/gov/hmrc/releaser/ArtefactsSpecs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ArtefactsSpecs extends WordSpec with Matchers with OptionValues{
val artefacts = new IvyArtefacts(ver, Files.createTempDirectory("test"))
val files = List(
"sbt-bobby.jar",
"sbt-bobby-assembly.jar",
"sbt-bobby-sources.jar",
"ivy.xml"
)
Expand All @@ -65,7 +66,8 @@ class ArtefactsSpecs extends WordSpec with Matchers with OptionValues{

result foreach println

result.size shouldBe 3
result.size shouldBe 4
result("sbt-bobby-assembly.jar") shouldBe None
result("sbt-bobby.jar") should not be None
result("sbt-bobby-sources.jar") shouldBe None
result("ivy.xml") should not be None
Expand Down
16 changes: 16 additions & 0 deletions src/test/scala/uk/gov/hmrc/releaser/HttpSpecs.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2015 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 uk.gov.hmrc.releaser

import java.net.URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ class IvyTransformerSpecs extends WordSpec with Matchers with BeforeAndAfterEach

"re-write the ivy with a new version 1.4.0" in {
val dir = Files.createTempDirectory("test-release")
val outFile = transformer(bobbyIvyFile, "artefact", ReleaseCandidateVersion("1.3.0-1-234235"), ReleaseVersion("1.4.0"), dir.resolve("ivy.xml")).success.get
val outFile = transformer(
bobbyIvyFile,
"artefact",
ReleaseCandidateVersion("1.3.0-1-234235"),
ReleaseVersion("1.4.0"),
dir.resolve("ivy.xml")
).success.get

val ivyVersionText = (XML.loadFile(outFile.toFile) \ "info" \ "@revision").text

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ class PomTransformerSpecs extends WordSpec with Matchers with BeforeAndAfterEach
"the pom transformer" should {

"re-write the pom with a new version 1.4.0" in {
val outFile = transformer(timePomFile, "time", ReleaseCandidateVersion("1.3.0-1-g21312cc"), ReleaseVersion("1.4.0"), tempDir().resolve("time-1.4.0.pom")).success.get
val outFile = transformer(
timePomFile,
"time",
ReleaseCandidateVersion("1.3.0-1-g21312cc"),
ReleaseVersion("1.4.0"),
tempDir().resolve("time-1.4.0.pom")
).success.get

val pomVersionText = (XML.loadFile(outFile.toFile) \ "version").text

Expand Down

0 comments on commit 93052ee

Please sign in to comment.