Skip to content

Commit

Permalink
Prep to publish to Sonatype
Browse files Browse the repository at this point in the history
Ref #43
  • Loading branch information
eed3si9n committed Dec 4, 2021
1 parent 0be52fc commit 09dd9d0
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 19 deletions.
56 changes: 47 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
sbtPlugin := true
enablePlugins(SbtPlugin)
ThisBuild / version := {
if ((ThisBuild / isSnapshot).value) "0.5.0" + "-SNAPSHOT"
else (ThisBuild / version).value
}
ThisBuild / scalaVersion := "2.12.15"

organization := "com.lightbend.sbt"
homepage := Some(url("https://github.com/sbt/sbt-proguard"))
name := "sbt-proguard"
publishMavenStyle := false
lazy val root = (project in file("."))
.enablePlugins(SbtPlugin)
.settings(nocomma {
name := "sbt-proguard"

scriptedDependencies := publishLocal.value
scriptedLaunchOpts ++= Seq("-Xms512m", "-Xmx512m", s"-Dproject.version=${version.value}")
//scriptedBufferLog := false
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-feature",
"-Xlint",
"-Xfatal-warnings",
)

scriptedDependencies := publishLocal.value
scriptedLaunchOpts ++= Seq("-Xms512m", "-Xmx512m", s"-Dproject.version=${version.value}")
// scriptedBufferLog := false

pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" => "1.1.6" // minimum sbt version
}
}
})

Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / organization := "com.github.sbt"
ThisBuild / description := "an sbt plugin for Proguard"
ThisBuild / homepage := Some(url("https://github.com/sbt/sbt-proguard"))
ThisBuild / licenses := List("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / developers := List(
Developer(
"pvlugter",
"Peter Vlugter",
"@pvlugter",
url("https://github.com/pvlugter")
)
)
ThisBuild / publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
ThisBuild / dynverSonatypeSnapshots := true
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("com.eed3si9n" % "sbt-nocomma" % "0.1.0")
3 changes: 0 additions & 3 deletions src/main/scala/com/typesafe/sbt/SbtProguard.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package com.lightbend.sbt
import com.lightbend.sbt.proguard.Merge
import sbt.Keys._
import sbt._
import sbt.internal.inc.Analysis
import xsbti.PathBasedFile

import java.nio.file.FileSystems
import scala.sys.process.Process

Expand Down
11 changes: 9 additions & 2 deletions src/main/scala/com/typesafe/sbt/proguard/Merge.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.lightbend.sbt.proguard

import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.util.regex.Pattern

import sbt._
import scala.util.matching.Regex
import sbt.io.Path._
import sbt.internal.inc.classpath.ClasspathUtil

object Merge {

Expand Down Expand Up @@ -38,7 +39,7 @@ object Merge {

def entries(sources: Seq[File], tmp: File): Seq[Entry] = {
sources flatMap { source =>
val base = if (ClasspathUtil.isArchive(source.toPath)) {
val base = if (isArchive(source.toPath)) {
val path =
if (source.getCanonicalPath.indexOf(":") > 0)
source.getCanonicalPath.substring(source.getCanonicalPath.indexOf("\\") + 1,
Expand All @@ -53,6 +54,12 @@ object Merge {
}
}

// copy-pasted from Zinc instead of using internal code
private def isArchive(file: Path): Boolean =
Files.isRegularFile(file) && isArchiveName(file.getFileName.toString)

private def isArchiveName(fileName: String) = fileName.endsWith(".jar") || fileName.endsWith(".zip")

trait Strategy {
def claims(path: EntryPath): Boolean
def merge(path: EntryPath, entries: Seq[Entry], target: File, log: Logger): Unit
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/proguard/filter/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.lightbend.sbt" % "sbt-proguard" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-proguard" % sys.props("project.version"))
2 changes: 1 addition & 1 deletion src/sbt-test/proguard/merge/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.lightbend.sbt" % "sbt-proguard" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-proguard" % sys.props("project.version"))
2 changes: 1 addition & 1 deletion src/sbt-test/proguard/simple/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.lightbend.sbt" % "sbt-proguard" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-proguard" % sys.props("project.version"))
1 change: 0 additions & 1 deletion version.sbt

This file was deleted.

0 comments on commit 09dd9d0

Please sign in to comment.