forked from tototoshi/sbt-slick-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from adRise/chunsenwang/plugin-enhance
plugin enhancement
- Loading branch information
Showing
23 changed files
with
542 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,12 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 11 # it auto caches https://github.com/actions/setup-java#caching-packages-dependencies | ||
uses: actions/[email protected] | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: 'sbt' | ||
|
||
- name: Run tests | ||
run: SBT_VERSION="${{ matrix.sbt_version }}" make test | ||
run: sbt scalafmtAll scripted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,51 @@ name: Publish | |
|
||
on: | ||
workflow_dispatch: | ||
|
||
# can maybe test via https://github.com/nektos/act | ||
# act -s DOCKER_USERNAME=abc -s DOCKER_PASSWORD=xyz --container-architecture linux/arm64 -W .github/workflows/release.yml release | ||
jobs: | ||
release: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
|
||
- name: Configure git user to push | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "sbt" | ||
- name: Clone and checkout to current branch | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK 11 # it auto caches https://github.com/actions/setup-java#caching-packages-dependencies | ||
uses: actions/[email protected] | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: 'sbt' | ||
|
||
- name: Publish | ||
run: ./scripts/github-actions/publish.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
|
||
# - name: notify build status | ||
# if: always() | ||
# uses: slackapi/[email protected] | ||
# with: | ||
# # Slack channel id, channel name, or user id to post message. | ||
# # See also: https://api.slack.com/methods/chat.postMessage#channels | ||
# # You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs. | ||
# channel-id: ${{ github.event.repository.name }}-cicd | ||
# # For posting a simple plain text message, no md just for link shortening | ||
# slack-message: "${{ steps.build_info.outputs.tubi-project-name }}-v${{ steps.build_info.outputs.tubi-project-version }} release ${{ job.status }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
# env: | ||
# SLACK_BOT_TOKEN: ${{ secrets.BUILD_NOTIFY_SLACK_APP_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ | |
/project/project/ | ||
/project/target/ | ||
/target/ | ||
/.idea/ | ||
/.bsp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version = "3.4.3" | ||
runner.dialect = scala213 | ||
preset = IntelliJ | ||
maxColumn = 120 | ||
docstrings.style = SpaceAsterisk | ||
docstrings.wrap = "no" | ||
newlines.beforeCurlyLambdaParams = multiline | ||
rewrite.rules = [Imports] | ||
rewrite.imports.sort = scalastyle | ||
rewrite.imports.groups = [["sbt\\..*"], ["java\\..*", "javax\\..*"], ["scala\\..*"]] | ||
rewrite.trailingCommas.style = keep |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,28 @@ | ||
import scalariform.formatter.preferences._ | ||
import scala.collection.JavaConverters._ | ||
import java.lang.management.ManagementFactory | ||
|
||
enablePlugins(SbtPlugin) | ||
import scala.collection.JavaConverters.* | ||
//import scalariform.formatter.preferences.* | ||
|
||
scalariformPreferences := scalariformPreferences.value | ||
.setPreference(AlignSingleLineCaseStatements, true) | ||
.setPreference(DoubleIndentConstructorArguments, true) | ||
.setPreference(DanglingCloseParenthesis, Preserve) | ||
enablePlugins(SbtPlugin) | ||
|
||
sbtPlugin := true | ||
|
||
name := """sbt-slick-codegen""" | ||
|
||
organization := "com.github.tototoshi" | ||
|
||
version := "2.0.0" | ||
|
||
crossSbtVersions := Seq("1.8.0") | ||
|
||
val slickVersion = SettingKey[String]("slickVersion") | ||
|
||
slickVersion := "3.3.3" | ||
organization := "com.tubitv" | ||
|
||
libraryDependencies ++= Seq( | ||
"com.typesafe.slick" %% "slick" % slickVersion.value, | ||
"com.typesafe.slick" %% "slick-codegen" % slickVersion.value | ||
"com.typesafe.slick" %% "slick" % Versions.slick, | ||
"com.typesafe.slick" %% "slick-codegen" % Versions.slick, | ||
"org.postgresql" % "postgresql" % Versions.postgresql, | ||
"com.github.docker-java" % "docker-java" % Versions.dockerJava, | ||
) | ||
addSbtPlugin("io.github.davidmweber" % "flyway-sbt" % Versions.flywaySbt) | ||
|
||
publishMavenStyle := true | ||
|
||
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (version.value.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots") | ||
else Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
} | ||
|
||
publishTo := Some(if (isSnapshot.value) Repo.Jfrog.Tubins.sbtDev else Repo.Jfrog.Tubins.sbtRelease) | ||
ThisBuild / versionScheme := Some("early-semver") | ||
Test / publishArtifact := false | ||
|
||
pomExtra := | ||
<url>https://github.com/tototoshi/sbt-slick-codegen</url> | ||
<licenses> | ||
<license> | ||
<name>Apache License, Version 2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<url>git@github.com:tototoshi/sbt-slick-codegen</url> | ||
<connection>scm:git:git@github.com:tototoshi/sbt-slick-codegen.git</connection> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>tototoshi</id> | ||
<name>Toshiyuki Takahashi</name> | ||
<url>https://tototoshi.github.io</url> | ||
</developer> | ||
</developers> | ||
|
||
scriptedBufferLog := false | ||
scriptedLaunchOpts ++= ManagementFactory.getRuntimeMXBean.getInputArguments.asScala.toList.filter(a => | ||
Seq("-Xmx", "-Xms", "-XX", "-Dsbt.log.noformat").exists(a.startsWith) | ||
) | ||
scriptedLaunchOpts ++= Seq( | ||
"-Dplugin.version=" + version.value, | ||
"-Dslick.version=" + slickVersion.value | ||
scriptedLaunchOpts ++= ManagementFactory.getRuntimeMXBean.getInputArguments.asScala.toList.filter( | ||
a => Seq("-Xmx", "-Xms", "-XX", "-Dsbt.log.noformat").exists(a.startsWith) | ||
) | ||
scriptedLaunchOpts ++= Seq("-Dplugin.version=" + version.value, "-Dslick.version=" + Versions.slick) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import sbt.* | ||
|
||
object Repo { | ||
|
||
object Jfrog { | ||
private val domain = "tubins.jfrog.io" | ||
private val jFrogRoot = s"https://$domain" | ||
|
||
object Tubins { | ||
private val pathPrefix = "tubins" | ||
|
||
lazy val sbtDev: MavenRepository = "sbt-dev" at s"$jFrogRoot/$pathPrefix/sbt-dev" | ||
|
||
lazy val sbtRelease: MavenRepository = "sbt-release" at s"$jFrogRoot/$pathPrefix/sbt-release" | ||
|
||
lazy val jvmSnapshot: MavenRepository = "jvm-snapshot" at s"$jFrogRoot/$pathPrefix/jvm-snapshots" | ||
|
||
lazy val jvm: MavenRepository = "jvm-release" at s"$jFrogRoot/$pathPrefix/jvm" | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
object Versions { | ||
val slick = "3.4.0" | ||
val postgresql = "42.6.0" | ||
val dockerJava = "3.3.4" | ||
val flywaySbt = "7.4.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ThisBuild / credentials ++= { | ||
val logger = streams.value.log | ||
if (sys.env.contains("ARTIFACTORY_USERNAME")) { | ||
logger.info("spotted credential in env, will add to credentials") | ||
Some( | ||
Credentials( | ||
"Artifactory Realm", | ||
"tubins.jfrog.io", | ||
sys.env.getOrElse("ARTIFACTORY_USERNAME", ""), | ||
sys.env.getOrElse("ARTIFACTORY_PASSWORD", "") | ||
) | ||
) | ||
} else { | ||
Credentials.loadCredentials(Path.userHome / ".artifactory" / "credentials") match { | ||
case Right(credentials: DirectCredentials) => | ||
logger.info(s"Using credentials found in the home directory for host ${credentials.host}") | ||
Some(credentials) | ||
case Left(err: String) => | ||
logger.warn(s"Could not find artifactory credentials in home directory: $err") | ||
None | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3") | ||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.18") | ||
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") | ||
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1") | ||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") | ||
|
Oops, something went wrong.