Skip to content

Commit 6cc5793

Browse files
author
Daniel Trinh
committed
enable publishing for cli project
1 parent 46e8e87 commit 6cc5793

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

project/Build.scala

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object ScalariformBuild extends Build {
3131
crossScalaVersions := Seq(
3232
"2.11.6",
3333
"2.10.4",
34-
"2.9.3", "2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0"
34+
"2.9.3", "2.9.2" //"2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0"
3535
),
3636
exportJars := true, // Needed for cli oneJar
3737
retrieveManaged := true,
@@ -47,7 +47,8 @@ object ScalariformBuild extends Build {
4747

4848
lazy val root: Project = Project("root", file("."), settings = commonSettings ++ Seq(
4949
publish := (),
50-
publishLocal := ())) aggregate (scalariform, cli, misc)
50+
publishLocal := ())
51+
) aggregate (scalariform, cli, misc)
5152

5253

5354
implicit class Regex(sc: StringContext) {
@@ -69,22 +70,25 @@ object ScalariformBuild extends Build {
6970
case _ => Nil
7071
}
7172

73+
def publishSettings(projectName: String) = Seq(
74+
pomExtra := pomExtraXml,
75+
publishMavenStyle := true,
76+
publishArtifact in Test := false,
77+
publishArtifact in (Compile, packageDoc) := true,
78+
publishArtifact in (Compile, packageSrc) := true,
79+
pomIncludeRepository := { _ false },
80+
sbtbuildinfo.Plugin.buildInfoKeys := Seq[sbtbuildinfo.Plugin.BuildInfoKey](version),
81+
sourceGenerators in Compile <+= sbtbuildinfo.Plugin.buildInfo,
82+
sbtbuildinfo.Plugin.buildInfoPackage := projectName
83+
)
84+
7285
lazy val scalariform: Project = Project("scalariform", file("scalariform"), settings =
73-
subprojectSettings ++ sbtbuildinfo.Plugin.buildInfoSettings ++ eclipseSettings ++
86+
subprojectSettings ++ sbtbuildinfo.Plugin.buildInfoSettings ++ publishSettings("scalariform") ++ eclipseSettings ++
7487
Seq(
7588
libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps)
7689
deps ++ get2_11Dependencies(sv) :+ getScalaTestDependency(sv)
7790
},
7891
testOptions in Test += Tests.Argument("-oI"),
79-
pomExtra := pomExtraXml,
80-
publishMavenStyle := true,
81-
publishArtifact in Test := false,
82-
publishArtifact in (Compile, packageDoc) := true,
83-
publishArtifact in (Compile, packageSrc) := true,
84-
pomIncludeRepository := { _ false },
85-
sbtbuildinfo.Plugin.buildInfoKeys := Seq[sbtbuildinfo.Plugin.BuildInfoKey](version),
86-
sbtbuildinfo.Plugin.buildInfoPackage := "scalariform",
87-
sourceGenerators in Compile <+= sbtbuildinfo.Plugin.buildInfo,
8892
EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Managed,
8993
publishTo <<= isSnapshot(getPublishToRepo)))
9094

@@ -94,11 +98,13 @@ object ScalariformBuild extends Build {
9498
else
9599
Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
96100

97-
lazy val cli = Project("cli", file("cli"), settings = subprojectSettings ++
101+
lazy val cli = Project("cli", file("cli"), settings = subprojectSettings ++ publishSettings("cli") ++
102+
sbtbuildinfo.Plugin.buildInfoSettings ++
98103
Seq(
99104
libraryDependencies += "commons-io" % "commons-io" % "1.4",
100105
mainClass in (Compile, packageBin) := Some("scalariform.commandline.Main"),
101106
mainClass in assembly := Some("scalariform.commandline.Main"),
107+
publishTo <<= isSnapshot(getPublishToRepo),
102108
artifact in (Compile, assembly) := {
103109
val art = (artifact in (Compile, assembly)).value
104110
art.copy(`classifier` = Some("assembly"))

0 commit comments

Comments
 (0)