diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties new file mode 100644 index 0000000..f8194fb --- /dev/null +++ b/src/main/g8/default.properties @@ -0,0 +1,2 @@ +name=My Something Project +description=Say something about this template. diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties new file mode 100644 index 0000000..f8194fb --- /dev/null +++ b/src/main/g8/default.properties @@ -0,0 +1,2 @@ +name=My Something Project +description=Say something about this template. diff --git a/src/main/g8/flake.lock b/src/main/g8/flake.lock new file mode 100644 index 0000000..5dfd6c4 --- /dev/null +++ b/src/main/g8/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1611219034, + "narHash": "sha256-bgp8G3LcpvKs22/z5Cj4XQkmZq05Aa0vaP1bKl7X0zM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f217c0ea7c148ddc0103347051555c7c252dcafb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties new file mode 100644 index 0000000..f8194fb --- /dev/null +++ b/src/main/g8/default.properties @@ -0,0 +1,2 @@ +name=My Something Project +description=Say something about this template. diff --git a/src/main/g8/flake.lock b/src/main/g8/flake.lock new file mode 100644 index 0000000..5dfd6c4 --- /dev/null +++ b/src/main/g8/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1611219034, + "narHash": "sha256-bgp8G3LcpvKs22/z5Cj4XQkmZq05Aa0vaP1bKl7X0zM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f217c0ea7c148ddc0103347051555c7c252dcafb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/src/main/g8/flake.nix b/src/main/g8/flake.nix new file mode 100644 index 0000000..44ba5be --- /dev/null +++ b/src/main/g8/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.\${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties new file mode 100644 index 0000000..f8194fb --- /dev/null +++ b/src/main/g8/default.properties @@ -0,0 +1,2 @@ +name=My Something Project +description=Say something about this template. diff --git a/src/main/g8/flake.lock b/src/main/g8/flake.lock new file mode 100644 index 0000000..5dfd6c4 --- /dev/null +++ b/src/main/g8/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1611219034, + "narHash": "sha256-bgp8G3LcpvKs22/z5Cj4XQkmZq05Aa0vaP1bKl7X0zM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f217c0ea7c148ddc0103347051555c7c252dcafb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/src/main/g8/flake.nix b/src/main/g8/flake.nix new file mode 100644 index 0000000..44ba5be --- /dev/null +++ b/src/main/g8/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.\${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/src/main/g8/project/build.properties b/src/main/g8/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/src/main/g8/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties new file mode 100644 index 0000000..f8194fb --- /dev/null +++ b/src/main/g8/default.properties @@ -0,0 +1,2 @@ +name=My Something Project +description=Say something about this template. diff --git a/src/main/g8/flake.lock b/src/main/g8/flake.lock new file mode 100644 index 0000000..5dfd6c4 --- /dev/null +++ b/src/main/g8/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1611219034, + "narHash": "sha256-bgp8G3LcpvKs22/z5Cj4XQkmZq05Aa0vaP1bKl7X0zM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f217c0ea7c148ddc0103347051555c7c252dcafb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/src/main/g8/flake.nix b/src/main/g8/flake.nix new file mode 100644 index 0000000..44ba5be --- /dev/null +++ b/src/main/g8/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.\${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/src/main/g8/project/build.properties b/src/main/g8/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/src/main/g8/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/src/main/g8/project/plugins.sbt b/src/main/g8/project/plugins.sbt new file mode 100644 index 0000000..cb83d6c --- /dev/null +++ b/src/main/g8/project/plugins.sbt @@ -0,0 +1,2 @@ +lazy val root = (project in file(".")).dependsOn(iwPlugin) +lazy val iwPlugin = RootProject(file("../sbt-support")) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties new file mode 100644 index 0000000..f8194fb --- /dev/null +++ b/src/main/g8/default.properties @@ -0,0 +1,2 @@ +name=My Something Project +description=Say something about this template. diff --git a/src/main/g8/flake.lock b/src/main/g8/flake.lock new file mode 100644 index 0000000..5dfd6c4 --- /dev/null +++ b/src/main/g8/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1611219034, + "narHash": "sha256-bgp8G3LcpvKs22/z5Cj4XQkmZq05Aa0vaP1bKl7X0zM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f217c0ea7c148ddc0103347051555c7c252dcafb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/src/main/g8/flake.nix b/src/main/g8/flake.nix new file mode 100644 index 0000000..44ba5be --- /dev/null +++ b/src/main/g8/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.\${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/src/main/g8/project/build.properties b/src/main/g8/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/src/main/g8/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/src/main/g8/project/plugins.sbt b/src/main/g8/project/plugins.sbt new file mode 100644 index 0000000..cb83d6c --- /dev/null +++ b/src/main/g8/project/plugins.sbt @@ -0,0 +1,2 @@ +lazy val root = (project in file(".")).dependsOn(iwPlugin) +lazy val iwPlugin = RootProject(file("../sbt-support")) diff --git a/src/main/g8/shell.nix b/src/main/g8/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/src/main/g8/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..239f822 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local play configuration +crm/play/src/main/resources/application.local.conf + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..6ec551a --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,7 @@ +version = "3.0.0-RC5" + +fileOverride { + "glob:**/services/{documents,ares}/src/{main,test}/scala/**" { + runner.dialect = scala3 + } +} diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..9d93074 --- /dev/null +++ b/README.markdown @@ -0,0 +1,41 @@ +# IW Project Support + +A [Giter8][g8] template for Iterative Works Scala projects! + +The project contains default template for Scala projects, referencing plugins that help to maintain IW projects. + +## Vision + +The goals are: + +- to simplify new project creation with favourite tools +- to ease the maintenance of running projects, making it possible to upgrade the stack easily and uniformly accross all the projects + +The envisioned process: + +1. Create project 1 using `g8 iterative-works/iw-project-support`. +2. My favourite tools are readily available, without a need to specify versions and orgs/names. +3. Develop, launch +4. Update the dependencies to current ones, publish new version of the plugin. +7. Update the plugin and get current tools +8. Fix the code for the new libs and publish updates + +This way the overhead of maintaining multiple projects should be lower, than having to do all the version updates manually. + +Also, scalafix rewrites could be part of the project to ease the migrations even further. + +## Currently included + +- IWPluginPresets plugin that pulls in the default plugins used in all projects and shortcuts for a few other commonly used plugins (scalajs, lagom, play etc.) +- IWMaterialsBOM plugin that adds shortcuts to currently used versions and settings of libraries used in IW projects (ZIO, Laminar etc.) +- IWProjectPlugin auto triggered plugin which provides default settings for all projects and exports currently used scala versions + +Template license +---------------- +Written in 2021 by Michal Příhoda + +To the extent possible under law, the author(s) have dedicated all copyright and related +and neighboring rights to this template to the public domain worldwide. +This template is distributed without any warranty. See . + +[g8]: http://www.foundweekends.org/giter8/ diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a3fc92 --- /dev/null +++ b/build.sbt @@ -0,0 +1,41 @@ +Global / semanticdbEnabled := true + +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "works.iterative" + +lazy val `sbt-iw-plugin-presets` = (project in file("sbt-iw-plugin-presets")) + .enablePlugins(SbtPlugin) + .disablePlugins(Giter8Plugin) + .settings( + organization := "works.iterative.sbt", + name := "sbt-iw-plugin-presets", + description := "Iterative Works SBT project plugin presets", + scriptedLaunchOpts := { + scriptedLaunchOpts.value ++ + Seq("-Xmx1024M", "-Dplugin.version=" + version.value) + }, + scriptedBufferLog := false + ) + +lazy val `sbt-support` = (project in file(".")) + // .enablePlugins(ScriptedPlugin) + .settings( + name := "iw-project-support", + Test / test := { + val _ = (Test / g8Test).toTask("").value + }, + /* + scriptedLaunchOpts ++= List( + "-Xms1024m", + "-Xmx1024m", + "-XX:ReservedCodeCacheSize=128m", + "-Xss2m", + "-Dfile.encoding=UTF-8" + ), + */ + resolvers += Resolver.url( + "typesafe", + url("https://repo.typesafe.com/typesafe/ivy-releases/") + )(Resolver.ivyStylePatterns) + ) + .aggregate(`sbt-iw-plugin-presets`) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64d429a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1629292755, + "narHash": "sha256-5xMo32NVLnloY9DveqwJO/Cab1+PbTMPqU4WMmawX5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "253aecf69ed7595aaefabde779aa6449195bebb7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c827e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..4260928 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,4 @@ +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.13.1") +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value +} diff --git a/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala new file mode 100644 index 0000000..b26f8d7 --- /dev/null +++ b/sbt-iw-plugin-presets/src/main/scala/works/iterative/sbt/IWPluginPresets.scala @@ -0,0 +1,63 @@ +package works.iterative.sbt + +import sbt._ +import sbt.Keys._ + +object IWPluginPresets extends AutoPlugin { + override def requires: Plugins = empty + override def trigger = allRequirements + + object autoImport { + val addScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") + val addWebScalaJSBundler: Def.Setting[_] = + addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.20.0") + val addWebScalaJS: Def.Setting[_] = + addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") + val addScalablyTypedConverter: Seq[Def.Setting[_]] = Seq( + resolvers += Resolver.bintrayRepo("oyvindberg", "converter"), + addSbtPlugin( + "org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta32" + ) + ) + val addTzdb: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-tzdb" % "1.0.1") + val addLocales: Def.Setting[_] = + addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "2.6.0") + val addScalaJS: Def.Setting[_] = + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1") + val addScalaJSCrossproject: Def.Setting[_] = + addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + val addSbtScalaJSMap: Def.Setting[_] = + addSbtPlugin( + "com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0" + ) + val addScalaJSSupport: Seq[Def.Setting[_]] = Seq( + addScalaJS, + addScalaJSCrossproject, + addSbtScalaJSMap, + addTzdb, + addLocales + ) ++ addScalablyTypedConverter + val addLagom: Def.Setting[_] = + addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.6.5") + val addPlay: Def.Setting[_] = + addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") + val addDockerCompose: Def.Setting[_] = + addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.35") + val addPlaySupport: Seq[Def.Setting[_]] = Seq( + addPlay, + addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4") + ) + } + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.18"), + addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2"), + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1"), + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1"), + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.28"), + addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt new file mode 100644 index 0000000..6db955b --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/build.sbt @@ -0,0 +1,2 @@ +lazy val root = project + .in(file(".")) diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt new file mode 100644 index 0000000..99b14b1 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/check.sbt @@ -0,0 +1,17 @@ +lazy val root = project + .in(file(".")) + .settings( + TaskKey[Unit]("checkLibraryDependencies") := checkLibraryDependencies.value + ) + +def checkLibraryDependencies = Def.task { + if ( + !libraryDependencies.value.exists( + _.organization == "io.github.davidgregory084" + ) + ) { + sys.error("Library dependencies do not include the default plugins") + } else { + () + } +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt new file mode 100644 index 0000000..7e43e49 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/project/project/plugins.sbt @@ -0,0 +1,9 @@ +sys.props.get("plugin.version") match { + case Some(x) => + addSbtPlugin("works.iterative.sbt" % "sbt-iw-plugin-presets" % x) + case _ => + sys.error( + """|The system property 'plugin.version' is not defined. + |Specify this property using the scriptedLaunchOpts -D.""".stripMargin + ) +} diff --git a/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test new file mode 100644 index 0000000..c73efb2 --- /dev/null +++ b/sbt-iw-plugin-presets/src/sbt-test/sbt-iw-plugin-presets/simple/test @@ -0,0 +1,2 @@ +> reload plugins +> checkLibraryDependencies \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/.envrc b/src/main/g8/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/src/main/g8/.envrc @@ -0,0 +1 @@ +use flake diff --git a/src/main/g8/.gitignore b/src/main/g8/.gitignore new file mode 100644 index 0000000..17c5157 --- /dev/null +++ b/src/main/g8/.gitignore @@ -0,0 +1,88 @@ +# use glob syntax. +syntax: glob +*.ser +*.class +*~ +*.bak +*.off +*.old +.DS_Store + +# eclipse conf file +.settings +.classpath +.project +.manager + +# building +target +null +tmp* +dist +test-output + +# other scm +.svn +.CVS +.hg* + +# switch to regexp syntax. +# syntax: regexp +# ^\.pc/ + +# IntelliJ +*.iws +*.ids +.idea +#.idea/workspace.xml +#.idea/tasks.xml +#.idea/datasources.xml +#.idea/libraries +#.idea/dictionaries + +# vim files +Session.vim +tags +.tags + +# Python compiled files +*.pyc + +# Vagrant files +.vagrant + +#Cache files +.cache + +#scripts +bin + +#is modules +node_modules +ext-lib + +#netbeans project +nbproject + +.idea_modules +logs + +# ensime project files +.ensime +.ensime_cache/ + +#local ensime config +ensime.sbt + +#visual code +.vscode + +# bloop +.bloop/ +.bsp/ +.metals/ +metals.sbt +out/ + +# semanticdb +*.semanticdb diff --git a/src/main/g8/.scalafmt.conf b/src/main/g8/.scalafmt.conf new file mode 100644 index 0000000..31a6ebb --- /dev/null +++ b/src/main/g8/.scalafmt.conf @@ -0,0 +1,2 @@ +version = "2.4.2" +style = IntelliJ diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt new file mode 100644 index 0000000..31c117f --- /dev/null +++ b/src/main/g8/build.sbt @@ -0,0 +1,9 @@ +// give the user a nice default project! +ThisBuild / organization := "com.example" +ThisBuild / scalaVersion := "2.12.8" + +lazy val root = (project in file(".")) + .enablePlugins(IWEnvPlugin) + .settings( + name := "IW Project" + ) diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties new file mode 100644 index 0000000..f8194fb --- /dev/null +++ b/src/main/g8/default.properties @@ -0,0 +1,2 @@ +name=My Something Project +description=Say something about this template. diff --git a/src/main/g8/flake.lock b/src/main/g8/flake.lock new file mode 100644 index 0000000..5dfd6c4 --- /dev/null +++ b/src/main/g8/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1611219034, + "narHash": "sha256-bgp8G3LcpvKs22/z5Cj4XQkmZq05Aa0vaP1bKl7X0zM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f217c0ea7c148ddc0103347051555c7c252dcafb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/src/main/g8/flake.nix b/src/main/g8/flake.nix new file mode 100644 index 0000000..44ba5be --- /dev/null +++ b/src/main/g8/flake.nix @@ -0,0 +1,18 @@ +{ + description = "Posuzovani shody"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.\${system}; + in { + devShell = import ./shell.nix { + pkgs = pkgs.extend + (final: prev: { jre = prev.adoptopenjdk-hotspot-bin-11; }); + }; + }); +} diff --git a/src/main/g8/project/build.properties b/src/main/g8/project/build.properties new file mode 100644 index 0000000..10fd9ee --- /dev/null +++ b/src/main/g8/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/src/main/g8/project/plugins.sbt b/src/main/g8/project/plugins.sbt new file mode 100644 index 0000000..cb83d6c --- /dev/null +++ b/src/main/g8/project/plugins.sbt @@ -0,0 +1,2 @@ +lazy val root = (project in file(".")).dependsOn(iwPlugin) +lazy val iwPlugin = RootProject(file("../sbt-support")) diff --git a/src/main/g8/shell.nix b/src/main/g8/shell.nix new file mode 100644 index 0000000..600ee3f --- /dev/null +++ b/src/main/g8/shell.nix @@ -0,0 +1,6 @@ +{ pkgs ? import { } }: + +with pkgs; +mkShell { + buildInputs = [ jre ammonite coursier bloop sbt scalafmt ]; + } diff --git a/src/main/g8/src/main/scala/Stub.scala b/src/main/g8/src/main/scala/Stub.scala new file mode 100644 index 0000000..c5cb2f6 --- /dev/null +++ b/src/main/g8/src/main/scala/Stub.scala @@ -0,0 +1,3 @@ +class Stub { + // got any helpful boilerplate for your users? +}