diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7dda07..99143e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/setup-java@v3.11.0 + with: + java-version: '11' + distribution: 'temurin' + cache: 'sbt' + - name: Run tests - run: SBT_VERSION="${{ matrix.sbt_version }}" make test + run: sbt scripted diff --git a/build.sbt b/build.sbt index 6c0a739..10e42bf 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,6 @@ enablePlugins(SbtPlugin) sbtPlugin := true name := """sbt-slick-codegen""" organization := "com.tubitv" -version := "0.0.1-SNAPSHOT" libraryDependencies ++= Seq( "com.typesafe.slick" %% "slick" % Versions.slick, diff --git a/jd-gui.cfg b/jd-gui.cfg deleted file mode 100644 index 60aaf01..0000000 --- a/jd-gui.cfg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - true - - com.apple.laf.AquaLookAndFeel - - - /Users/chunsenwang/tubi/sbt-slick-codegen/target/scala-2.12/sbt-1.0/classes/com/github/tototoshi/sbt/slick/CodegenPlugin$.class - - - /Users/chunsenwang/tubi/sbt-slick-codegen/target/scala-2.12/sbt-1.0/classes/com/github/tototoshi/sbt/slick - /Users/chunsenwang/tubi/sbt-slick-codegen - - - 0xFF6666 - 1.1.3 - - \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 8b02da5..8eb9873 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,4 @@ //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") diff --git a/src/sbt-test/test/basic/build.sbt b/src/sbt-test/test/basic/build.sbt index 2057d74..ab3552e 100644 --- a/src/sbt-test/test/basic/build.sbt +++ b/src/sbt-test/test/basic/build.sbt @@ -1,17 +1,14 @@ + crossScalaVersions := Seq("2.12.15", "2.13.8") Global / onChangedBuildSource := ReloadOnSourceChanges -libraryDependencies += "com.typesafe.slick" %% "slick" % System.getProperty("slick.version") - enablePlugins(CodegenPlugin) -Compile / sourceGenerators += slickCodegen - -slickCodegenDatabaseUrl := "jdbc:postgresql://postgres/example" - -slickCodegenDatabaseUser := "test" - -slickCodegenDatabasePassword := "test" +slickCodegenOutputContainer := "Table" +slickCodegenOutputPackage := "com.demo" +//) -slickCodegenOutputToMultipleFiles := true +codeGen("etl")( + slickCodegenOutputContainer := "Etl", +) diff --git a/src/sbt-test/test/basic/project/plugins.sbt b/src/sbt-test/test/basic/project/plugins.sbt index 1a21b61..1e5f998 100644 --- a/src/sbt-test/test/basic/project/plugins.sbt +++ b/src/sbt-test/test/basic/project/plugins.sbt @@ -1,5 +1,5 @@ sys.props.get("plugin.version") match { - case Some(x) => addSbtPlugin("com.github.tototoshi" % "sbt-slick-codegen" % x) + case Some(x) => addSbtPlugin("com.tubitv" % "sbt-slick-codegen" % x) case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } diff --git a/src/sbt-test/test/basic/src/main/resources/db/migration/V001__create-demo-table.sql b/src/sbt-test/test/basic/src/main/resources/db/migration/V001__create-demo-table.sql new file mode 100644 index 0000000..e69de29 diff --git a/src/sbt-test/test/basic/test b/src/sbt-test/test/basic/test index 0287d84..730ff77 100644 --- a/src/sbt-test/test/basic/test +++ b/src/sbt-test/test/basic/test @@ -1,5 +1,4 @@ -$ exec psql -c 'create table if not exists users (id bigint primary key, name varchar(256));' -U test -h postgres example -> + compile +> + slickCodegenAll -$ exists target/scala-2.13/src_managed/main/com/example/Tables.scala -$ exists target/scala-2.13/src_managed/main/com/example/UsersTable.scala +$ exists src/main/scala/com/demo/Table.scala +$ exists src/main/scala/com/example/Etl.scala