Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid deprecated java.net.URL constructor #328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Then in your `build.sbt` configure the following settings:
```scala
organizationName := "Heiko Seeberger"
startYear := Some(2015)
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt"))
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt"))
```

This configuration will apply Apache License 2.0 headers to Scala and Java files. sbt-header provides two tasks: `headerCreate` and `headerCheck`, which are described in the following sub sections. For more information on how to customize sbt-header, please refer to the [Configuration](#configuration) section.
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-header/auto-detection-end-year/test.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
organizationName := "Heiko Seeberger"
startYear := Some(2015)
headerEndYear := Some(2022)
licenses := List(("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")))
licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")))

val checkFileContents = taskKey[Unit]("Verify file contents match expected contents")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
organizationName := "Heiko Seeberger"
startYear := Some(2015)
licenses := List(("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")))
licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")))
headerLicenseStyle := HeaderLicenseStyle.SpdxSyntax
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-header/auto-detection/test.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
organizationName := "Heiko Seeberger"
startYear := Some(2015)
licenses := List(("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")))
licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")))

val checkFileContents = taskKey[Unit]("Verify file contents match expected contents")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package de.heikoseeberger.sbtheader

import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.HeaderLicense._
import sbt.URL
import sbt.url
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

Expand All @@ -27,47 +28,47 @@ class LicenseDetectionSpec extends AnyWordSpec with Matchers {
val yyyy = "2017"
val startYear = Some(yyyy)
val apache: (String, URL) =
("Apache-2.0", new URL("https://spdx.org/licenses/Apache-2.0.html#licenseText"))
val mit: (String, URL) = ("MIT", new URL("https://spdx.org/licenses/MIT.html#licenseText"))
("Apache-2.0", url("https://spdx.org/licenses/Apache-2.0.html#licenseText"))
val mit: (String, URL) = ("MIT", url("https://spdx.org/licenses/MIT.html#licenseText"))

val licenses: Map[License, (String, URL)] = Map(
BSD2Clause(yyyy.toString, organizationName) -> ("BSD-2-Clause", new URL(
BSD2Clause(yyyy.toString, organizationName) -> ("BSD-2-Clause", url(
"https://spdx.org/licenses/BSD-2-Clause.html#licenseText"
)),
BSD3Clause(yyyy.toString, organizationName) -> ("BSD-3-Clause", new URL(
BSD3Clause(yyyy.toString, organizationName) -> ("BSD-3-Clause", url(
"https://spdx.org/licenses/BSD-3-Clause.html#licenseText"
)),
AGPLv3OrLater(yyyy.toString, organizationName) -> ("AGPL-3.0-or-later", new URL(
AGPLv3OrLater(yyyy.toString, organizationName) -> ("AGPL-3.0-or-later", url(
"https://spdx.org/licenses/AGPL-3.0-or-later.html#licenseText"
)),
AGPLv3Only(yyyy.toString, organizationName) -> ("AGPL-3.0-only", new URL(
AGPLv3Only(yyyy.toString, organizationName) -> ("AGPL-3.0-only", url(
"https://spdx.org/licenses/AGPL-3.0-only.html#licenseText"
)),
AGPLv3(yyyy.toString, organizationName) -> ("AGPL-3.0", new URL(
AGPLv3(yyyy.toString, organizationName) -> ("AGPL-3.0", url(
"https://spdx.org/licenses/AGPL-3.0.html#licenseText"
)),
ALv2(yyyy.toString, organizationName) ->
apache,
GPLv3OrLater(yyyy.toString, organizationName) -> ("GPL-3.0-or-later", new URL(
GPLv3OrLater(yyyy.toString, organizationName) -> ("GPL-3.0-or-later", url(
"https://spdx.org/licenses/GPL-3.0-or-later.html#licenseText"
)),
GPLv3Only(yyyy.toString, organizationName) -> ("GPL-3.0-only", new URL(
GPLv3Only(yyyy.toString, organizationName) -> ("GPL-3.0-only", url(
"https://spdx.org/licenses/GPL-3.0-only.html#licenseText"
)),
GPLv3(yyyy.toString, organizationName) -> ("GPL-3.0", new URL(
GPLv3(yyyy.toString, organizationName) -> ("GPL-3.0", url(
"https://spdx.org/licenses/GPL-3.0.html#licenseText"
)),
LGPLv3OrLater(yyyy.toString, organizationName) -> ("LGPL-3.0-or-later", new URL(
LGPLv3OrLater(yyyy.toString, organizationName) -> ("LGPL-3.0-or-later", url(
"https://spdx.org/licenses/LGPL-3.0-or-later.html#licenseText"
)),
LGPLv3Only(yyyy.toString, organizationName) -> ("LGPL-3.0-only", new URL(
LGPLv3Only(yyyy.toString, organizationName) -> ("LGPL-3.0-only", url(
"https://spdx.org/licenses/LGPL-3.0-only.html#licenseText"
)),
LGPLv3(yyyy.toString, organizationName) -> ("LGPL-3.0", new URL(
LGPLv3(yyyy.toString, organizationName) -> ("LGPL-3.0", url(
"https://spdx.org/licenses/LGPL-3.0.html#licenseText"
)),
MIT(yyyy.toString, organizationName) -> mit,
MPLv2(yyyy.toString, organizationName) -> ("MPL-2.0", new URL(
MPLv2(yyyy.toString, organizationName) -> ("MPL-2.0", url(
"https://spdx.org/licenses/MPL-2.0.html#licenseText"
))
)
Expand Down
Loading