From 6558c7c4009e5dfbb4b11ee8fa5d97af12bb02fd Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 17:52:01 +0000 Subject: [PATCH 01/70] Start afresh --- .gitignore | 32 +-- .scalafmt.conf | 63 ++++++ .travis.yml | 4 - CODE_OF_CONDUCT.md | 14 ++ CREDITS | 207 ------------------ LICENSE | 204 ----------------- LICENSE.txt | 176 +++++++++++++++ README.md | 169 -------------- build.sbt | 56 ----- project/build.properties | 2 +- project/plugins.sbt | 3 - project/scripted.sbt | 1 - scripted.sbt | 7 - src/main/scala/Dependencies.scala | 88 -------- src/main/scala/Developer.scala | 12 - src/main/scala/Publishing.scala | 30 --- src/main/scala/ReleaseSeries.scala | 23 -- src/main/scala/Releasing.scala | 168 -------------- src/main/scala/Stability.scala | 8 - src/main/scala/TypelevelPlugin.scala | 164 -------------- src/main/scala/Version.scala | 69 ------ src/main/scala/package.scala | 5 - .../sbt-typelevel/buildinfo/.gitignore | 2 - .../sbt-typelevel/buildinfo/build.sbt | 9 - .../sbt-typelevel/buildinfo/new/package.scala | 5 - .../buildinfo/project/build.properties | 1 - .../buildinfo/project/plugins.sbt | 1 - .../buildinfo/src/main/scala/package.scala | 3 - .../src/test/scala/BuildInfoTest.scala | 17 -- src/sbt-test/sbt-typelevel/buildinfo/test | 12 - src/sbt-test/sbt-typelevel/deps/.gitignore | 2 - src/sbt-test/sbt-typelevel/deps/bad/deps.sbt | 3 - src/sbt-test/sbt-typelevel/deps/build.sbt | 3 - src/sbt-test/sbt-typelevel/deps/good/deps.sbt | 3 - .../deps/project/build.properties | 1 - .../sbt-typelevel/deps/project/plugins.sbt | 1 - src/sbt-test/sbt-typelevel/deps/test | 7 - src/sbt-test/sbt-typelevel/docs/.gitignore | 2 - src/sbt-test/sbt-typelevel/docs/build.sbt | 10 - src/sbt-test/sbt-typelevel/docs/code.scala | 2 - .../sbt-typelevel/docs/new/version.sbt | 7 - .../docs/project/build.properties | 1 - .../sbt-typelevel/docs/project/plugins.sbt | 1 - src/sbt-test/sbt-typelevel/docs/test | 27 --- src/sbt-test/sbt-typelevel/docs/version.sbt | 7 - .../sbt-typelevel/release-bump/.gitignore | 3 - .../sbt-typelevel/release-bump/build.sbt | 33 --- .../release-bump/project/build.properties | 1 - .../release-bump/project/plugins.sbt | 1 - .../release-bump/ref/version.sbt | 6 - src/sbt-test/sbt-typelevel/release-bump/test | 16 -- .../sbt-typelevel/release-bump/version.sbt | 6 - src/sbt-test/sbt-typelevel/release/.gitignore | 3 - src/sbt-test/sbt-typelevel/release/A.scala | 4 - src/sbt-test/sbt-typelevel/release/build.sbt | 38 ---- .../sbt-typelevel/release/new/A.scala | 5 - .../release/project/build.properties | 1 - .../sbt-typelevel/release/project/plugins.sbt | 1 - .../sbt-typelevel/release/ref/pom.xml | 32 --- .../sbt-typelevel/release/ref/version.sbt | 8 - src/sbt-test/sbt-typelevel/release/test | 25 --- .../sbt-typelevel/release/version.sbt | 6 - 62 files changed, 271 insertions(+), 1550 deletions(-) create mode 100644 .scalafmt.conf delete mode 100644 .travis.yml create mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CREDITS delete mode 100644 LICENSE create mode 100644 LICENSE.txt delete mode 100644 README.md delete mode 100644 project/plugins.sbt delete mode 100644 project/scripted.sbt delete mode 100644 scripted.sbt delete mode 100644 src/main/scala/Dependencies.scala delete mode 100644 src/main/scala/Developer.scala delete mode 100644 src/main/scala/Publishing.scala delete mode 100644 src/main/scala/ReleaseSeries.scala delete mode 100644 src/main/scala/Releasing.scala delete mode 100644 src/main/scala/Stability.scala delete mode 100644 src/main/scala/TypelevelPlugin.scala delete mode 100644 src/main/scala/Version.scala delete mode 100644 src/main/scala/package.scala delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/.gitignore delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/build.sbt delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/new/package.scala delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/project/build.properties delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/project/plugins.sbt delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/src/main/scala/package.scala delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/src/test/scala/BuildInfoTest.scala delete mode 100644 src/sbt-test/sbt-typelevel/buildinfo/test delete mode 100644 src/sbt-test/sbt-typelevel/deps/.gitignore delete mode 100644 src/sbt-test/sbt-typelevel/deps/bad/deps.sbt delete mode 100644 src/sbt-test/sbt-typelevel/deps/build.sbt delete mode 100644 src/sbt-test/sbt-typelevel/deps/good/deps.sbt delete mode 100644 src/sbt-test/sbt-typelevel/deps/project/build.properties delete mode 100644 src/sbt-test/sbt-typelevel/deps/project/plugins.sbt delete mode 100644 src/sbt-test/sbt-typelevel/deps/test delete mode 100644 src/sbt-test/sbt-typelevel/docs/.gitignore delete mode 100644 src/sbt-test/sbt-typelevel/docs/build.sbt delete mode 100644 src/sbt-test/sbt-typelevel/docs/code.scala delete mode 100644 src/sbt-test/sbt-typelevel/docs/new/version.sbt delete mode 100644 src/sbt-test/sbt-typelevel/docs/project/build.properties delete mode 100644 src/sbt-test/sbt-typelevel/docs/project/plugins.sbt delete mode 100644 src/sbt-test/sbt-typelevel/docs/test delete mode 100644 src/sbt-test/sbt-typelevel/docs/version.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release-bump/.gitignore delete mode 100644 src/sbt-test/sbt-typelevel/release-bump/build.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release-bump/project/build.properties delete mode 100644 src/sbt-test/sbt-typelevel/release-bump/project/plugins.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release-bump/ref/version.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release-bump/test delete mode 100644 src/sbt-test/sbt-typelevel/release-bump/version.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release/.gitignore delete mode 100644 src/sbt-test/sbt-typelevel/release/A.scala delete mode 100644 src/sbt-test/sbt-typelevel/release/build.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release/new/A.scala delete mode 100644 src/sbt-test/sbt-typelevel/release/project/build.properties delete mode 100644 src/sbt-test/sbt-typelevel/release/project/plugins.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release/ref/pom.xml delete mode 100644 src/sbt-test/sbt-typelevel/release/ref/version.sbt delete mode 100644 src/sbt-test/sbt-typelevel/release/test delete mode 100644 src/sbt-test/sbt-typelevel/release/version.sbt diff --git a/.gitignore b/.gitignore index f507c638..c7681b7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,19 @@ -*.class -*.log - -# sbt specific -.lib/ -dist/* target/ -lib_managed/ -src_managed/ -project/boot/ -project/plugins/project/ -# IDE specific -.scala_dependencies -.*.swp -.*.swo -.idea* +.sbtopts + +# vim +*.sw? + +# intellij +.idea/ + +# Ignore [ce]tags files +tags + +# Metals +.metals/ +.bsp/ +.bloop/ +metals.sbt +.vscode diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 00000000..83ce2563 --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,63 @@ +version = 3.3.0 + +runner.dialect = Scala212 + +maxColumn = 96 + +includeCurlyBraceInSelectChains = true +includeNoParensInSelectChains = true + +optIn { + breakChainOnFirstMethodDot = false + forceBlankLineBeforeDocstring = true +} + +binPack { + literalArgumentLists = true + parentConstructors = Never +} + +danglingParentheses { + defnSite = false + callSite = false + ctrlSite = false + + exclude = [] +} + +newlines { + beforeCurlyLambdaParams = multilineWithCaseOnly + afterCurlyLambda = squash + implicitParamListModifierPrefer = before + sometimesBeforeColonInMethodReturnType = true +} + +align.preset = none +align.stripMargin = true + +assumeStandardLibraryStripMargin = true + +docstrings { + style = Asterisk + oneline = unfold +} + +project.git = true + +trailingCommas = never + +rewrite { + // RedundantBraces honestly just doesn't work, otherwise I'd love to use it + rules = [PreferCurlyFors, RedundantParens, SortImports] + + redundantBraces { + maxLines = 1 + stringInterpolation = true + } +} + +rewriteTokens { + "⇒": "=>" + "→": "->" + "←": "<-" +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5a676384..00000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: scala - -script: - - sbt scripted diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..6003256e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,14 @@ +# Code of Conduct + +We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other such characteristics. + +Everyone is expected to follow the [Scala Code of Conduct] when discussing the project on the available communication channels. + +## Moderation + +Any questions, concerns, or moderation requests please contact a member of the project. + +- Ross A. Baker: [gitter](https://gitter.im/rossabaker) | [twitter](https://twitter.com/rossabaker) | [email](mailto:ross@rossabaker.com) +- Arman Bilge: [twitter](https://twitter.com/armanbilge) | [email](mailto:arman@armanbilge.com) + +[Scala Code of Conduct]: https://typelevel.org/code-of-conduct.html diff --git a/CREDITS b/CREDITS deleted file mode 100644 index 0715dea6..00000000 --- a/CREDITS +++ /dev/null @@ -1,207 +0,0 @@ -sbt-release -=========== - -Copyright (c) 2011-2014 Gerolf Seitz - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 03877f97..00000000 --- a/LICENSE +++ /dev/null @@ -1,204 +0,0 @@ -Copyright (c) 2014 Lars Hupel - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..7a774156 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,176 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md deleted file mode 100644 index edee646a..00000000 --- a/README.md +++ /dev/null @@ -1,169 +0,0 @@ -sbt-typelevel -============= - -SBT plugin which understands binary compatibility - -[![Build Status](https://secure.travis-ci.org/typelevel/sbt-typelevel.png?branch=master)](http://travis-ci.org/typelevel/sbt-typelevel) - - -Purpose -------- - -`sbt-typelevel` tries to provide a set of good standards for some widely-used SBT plugins, in order to enforce policies with respect to: -* versioning -* binary compatibility -* releasing -* version control system integration - -Because of that, `sbt-typelevel` is a meta-plugin and pulls in the following plugins into your build: -* [`sbt-pgp`](https://github.com/sbt/sbt-pgp) - Used to sign artifacts when uploading to Sonatype. -* [`sbt-release`](https://github.com/sbt/sbt-release/) - Provides a workflow for cutting releases, including bumping of version numbers, and tagging in the repository. -* [`sbt-mima-plugin`](https://github.com/typesafehub/migration-manager) - In a stable branch of a library, ensure that newer versions are backward binary compatible to older versions. -* [`sbt-dependency-graph`](https://github.com/jrudolph/sbt-dependency-graph) - Prints a graph of all transitive dependencies. Here, just used to extract all transitive dependencies from the Ivy resolution reports. -* [`sbt-buildinfo`](https://github.com/sbt/sbt-buildinfo) - Generates a source file containing information about the build, such as the Scala version. -* [`sbt-sonatype`](https://github.com/xerial/sbt-sonatype) - Publishing defaults for Sonatype. - - -Usage ------ - -`sbt-typelevel` is available for SBT 0.13.x. To use it, add it to your `project/plugins.sbt`: - -```scala -addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.3.1") -``` - - -The plugin provides three settings, which you can add to your `build.sbt`. *Read this carefully in order to not bloat your build or produce conflicts with other plugins.* - -```scala -// useful if you're just consuming libraries, but don't publish yourself, -// don't care about binary compatibility etc. -typelevelConsumerSettings - -// configures all the plugins mentioned above -// contains `typelevelConsumerSettings` -typelevelDefaultSettings - -// should only be used for one submodule in the build -// configures `sbt-buildinfo` -typelevelBuildInfoSettings -``` - -*If in doubt, only use `typelevelConsumerSettings`.* - -Please read on for further instructions, since some of these settings require additional settings to work properly. - -### Versioning & Releasing - -If you choose to use `typelevelDefaultSettings`, the version number of your project will be computed from a release series and a patch number. It is expected that these settings live in a file `version.sbt` in the root of your project: - -```scala -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2,3) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(0,Snapshot) -``` - -By default, the `release` command will perform the following steps: - -1. Check if all dependencies are non-`SNAPSHOT`. -2. Run tests. -3. Ask for the patch number of the version which is to be released, and the following patch number. -4. Update the `version.sbt` file. -5. Commit changes, if working directory is not dirty with other changes. -6. Tag the current commit. -7. Publish (signed) artifacts. -8. Update the `version.sbt` file. -9. Commit changes. - -Note that this will not automatically push the two commits and the tag to the remote repository; you have to do that yourself. - -If you don't want tests to run, pass the `skip-tests` option to `release`. If you're publishing a cross-Scala-versioned project, pass the `cross` option to `release`. Both options can be combined: - -``` -sbt> release skip-tests cross -``` - -Typically, after a release, the `version.sbt` file will look like this: - -```scala -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2,3) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(1,Snapshot) - -TypelevelKeys.lastRelease in ThisBuild := Relative(0,Final) -``` - -### Scaladoc - -If you're hosting your project on GitHub, this plugin can automatically instruct Scaladoc to link to the sources. - -```scala -// (user name, repository name) -TypelevelKeys.githubProject := ("example", "example-docs") -``` - -A released version (i.e. not a snapshot version) will link to the appropriate tag (which is assumed to be of the form `v0.1.2`). -Snapshot versions will be linked using their commit hash. - -### Binary compatibility - -To check if there are any problems with binary compatibility, run the command `mimaReportBinaryIssues`. This will work out of the box, no configuration needed. - -### Dependency checks - -The `typelevelConsumerSettings` provide the `checkDependencies` task. For example, if your library dependencies are this: - -```scala -libraryDependencies += "org.scalaz" %% "scalaz-scalacheck-binding" % "7.0.5" - -libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0" -``` - -Then, the plugin will tell you: - -``` -sbt> checkDependencies -[info] Compatible versions in org.scalacheck#scalacheck_2.10: 1.10.0 and 1.10.1 -[info] Compatible versions in org.scala-lang#scala-library: 2.10.1 and 2.10.3 -``` - -It can do that because it knows that both the Scala library and Scalacheck adhere to certain binary compatibility standards. - -However, changing the Scalacheck version to `1.11.0` will print: - -``` -sbt> checkDependencies -[error] Version mismatch in org.scalacheck#scalacheck_2.10: 1.10.1 and 1.11.0 are different -[info] Compatible versions in org.scala-lang#scala-library: 2.10.1 and 2.10.3 -[error] (*:checkDependencies) Dependency check failed, found 1 version mismatch(es) -``` - -It is important that you do not overwrite the `conflictManager` key in SBT. It will only give reliable results with the `latest` strategy, which is enabled by default. - -Make sure to run `checkDependencies` in all relevant configurations, e.g. for your test dependencies: - -``` -sbt> test:checkDependencies -``` - -By default, it will only check the `compile` configuration. - - -Limitations ------------ - -* The `typelevelConsumerSettings` pull the `release` command into your build, but it is not configured properly. You don't have to use that command. -* Both the build info and the releasing will only work if you're using either Git or Mercurial. diff --git a/build.sbt b/build.sbt index c9cfb65b..aeda4bb7 100644 --- a/build.sbt +++ b/build.sbt @@ -1,57 +1 @@ -sbtPlugin := true - name := "sbt-typelevel" - -organization := "org.typelevel" - -version := "0.4-SNAPSHOT" - -licenses := Seq("Apache 2" → url("https://www.apache.org/licenses/LICENSE-2.0.html")) - -homepage := Some(url("http://typelevel.org/")) - -resolvers += Resolver.sonatypeRepo("releases") - -// This is both a plugin and a meta-plugin - -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.2") - -addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.4") - -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.6") - -addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2") - -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.3.2") - -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.1") - -// Publishing - -publishTo <<= (version).apply { v => - val nexus = "https://oss.sonatype.org/" - if (v.trim.endsWith("SNAPSHOT")) - Some("Snapshots" at nexus + "content/repositories/snapshots") - else - Some("Releases" at nexus + "service/local/staging/deploy/maven2") -} - -credentials += Credentials( - Option(System.getProperty("build.publish.credentials")) map (new File(_)) getOrElse (Path.userHome / ".ivy2" / ".credentials") -) - -pomIncludeRepository := Function.const(false) - -pomExtra := ( - - https://github.com/typelevel/sbt-typelevel - scm:git:git://github.com/typelevel/sbt-typelevel.git - - - - larsrh - Lars Hupel - https://github.com/larsrh - - -) diff --git a/project/build.properties b/project/build.properties index 43b8278c..e64c208f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.11 +sbt.version=1.5.8 diff --git a/project/plugins.sbt b/project/plugins.sbt deleted file mode 100644 index 2dd6cca9..00000000 --- a/project/plugins.sbt +++ /dev/null @@ -1,3 +0,0 @@ -resolvers += Resolver.sonatypeRepo("releases") - -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1") diff --git a/project/scripted.sbt b/project/scripted.sbt deleted file mode 100644 index c693c139..00000000 --- a/project/scripted.sbt +++ /dev/null @@ -1 +0,0 @@ -libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value diff --git a/scripted.sbt b/scripted.sbt deleted file mode 100644 index 729b8138..00000000 --- a/scripted.sbt +++ /dev/null @@ -1,7 +0,0 @@ -ScriptedPlugin.scriptedSettings - -scriptedLaunchOpts := { scriptedLaunchOpts.value ++ - Seq("-Xmx1024M", "-XX:MaxPermSize=256M", "-Dplugin.version=" + version.value) -} - -scriptedBufferLog := false diff --git a/src/main/scala/Dependencies.scala b/src/main/scala/Dependencies.scala deleted file mode 100644 index 9211ee7e..00000000 --- a/src/main/scala/Dependencies.scala +++ /dev/null @@ -1,88 +0,0 @@ -package org.typelevel.sbt - -import sbt._ -import sbt.Keys._ - -import org.typelevel.sbt.TypelevelPlugin.TypelevelKeys - -import net.virtualvoid.sbt.graph.{DependencyGraphKeys, Module, ModuleId} - -object Dependencies { - - object known { - def scala(module: String) = Dependency("org.scala-lang", s"scala-$module", ReleaseSeries(2, 10), false) - - def scalaz(module: String) = Dependency("org.scalaz", s"scalaz-$module", ReleaseSeries(7, 0)) - - val scodec = Dependency("org.typelevel", "scodec-core", ReleaseSeries(1, 0)) - val scalacheck = Dependency("org.scalacheck", "scalacheck", ReleaseSeries(1, 10)) - - val all = List( - scala("library"), scala("reflect"), - scalaz("core"), scalaz("scalacheck-binding"), - scodec, - scalacheck - ) - } - - def findFromIDs(all: List[Dependency], groupID: String, rawArtifactID: String): Option[Dependency] = - all.filter(_.matches(groupID, rawArtifactID)) match { - case head :: Nil => Some(head) - case Nil => None - case _ => sys.error(s"Internal error: found more than one match for $groupID:$rawArtifactID; check your `knownDependencies` setting") - } - - def check(all: List[Dependency], logger: Logger, modules: Seq[Module]) = { - val notices = modules.collect { - case Module(ModuleId(groupID, artifactID, olderV), _, _, Some(newerV), _, _) => - val msg = s"Version mismatch in $groupID#$artifactID: $olderV and $newerV are different" - - findFromIDs(all, groupID, artifactID) match { - case Some(dep) => - (Version.fromString(olderV), Version.fromString(newerV)) match { - case (Some(o), Some(n)) => - if (dep.minCompatible <= o.series && o.compatible(n)) - Right(s"Compatible versions in $groupID#$artifactID: $olderV and $newerV") - else - Left(msg) - case _ => - Left("$msg, and version numbers cannot be parsed") - } - case None => - Left(s"$msg, and no dependency information available") - } - } - - notices.foreach(_.fold(logger.error(_), logger.info(_))) - - val count = notices.filter(_.isLeft).length - if (count > 0) - sys.error(s"Dependency check failed, found $count version mismatch(es)") - } - - def checkSettings(config: Configuration) = inConfig(config)(seq( - TypelevelKeys.checkDependencies := - check( - TypelevelKeys.knownDependencies.value.toList, - streams.value.log, - DependencyGraphKeys.moduleGraph.value.nodes - ) - )) - -} - -case class Dependency(groupID: String, artifactID: String, minCompatible: ReleaseSeries, scalaSuffix: Boolean = true) { - - def matches(thatGroupID: String, thatArtifactID: String): Boolean = { - val ScalaSuffix = """(.*)_[.0-9]*""".r - if (groupID != thatGroupID) - false - else - thatArtifactID match { - case ScalaSuffix(`artifactID`) if scalaSuffix => true - case `artifactID` if !scalaSuffix => true - case _ => false - } - } - -} diff --git a/src/main/scala/Developer.scala b/src/main/scala/Developer.scala deleted file mode 100644 index 96328dc3..00000000 --- a/src/main/scala/Developer.scala +++ /dev/null @@ -1,12 +0,0 @@ -package org.typelevel.sbt - -case class Developer(name: String, id: String) { - - def pomExtra: xml.NodeSeq = - - { id } - { name } - https://github.com/{ id } - - -} diff --git a/src/main/scala/Publishing.scala b/src/main/scala/Publishing.scala deleted file mode 100644 index ecba6c46..00000000 --- a/src/main/scala/Publishing.scala +++ /dev/null @@ -1,30 +0,0 @@ -package org.typelevel.sbt - -import scala.sys.props - -import sbt._ - -object Publishing { - - def fromFile: Option[Credentials] = - props.get("build.publish.credentials").map(file => Credentials(new File(file))) - - def fromUserPass: Option[Credentials] = - (props.get("build.publish.user"), props.get("build.publish.password")) match { - case (Some(user), Some(pass)) => - val realm = props.get("build.publish.realm").getOrElse("Sonatype Nexus Repository Manager") - val host = props.get("build.publish.host").getOrElse("oss.sonatype.org") - Some(Credentials(realm, host, user, pass)) - case _ => - None - } - - def fromFallbackFile: Option[Credentials] = { - val file = Path.userHome / ".ivy2" / ".credentials" - if (file.exists()) - Some(Credentials(file)) - else - None - } - -} diff --git a/src/main/scala/ReleaseSeries.scala b/src/main/scala/ReleaseSeries.scala deleted file mode 100644 index 6434e204..00000000 --- a/src/main/scala/ReleaseSeries.scala +++ /dev/null @@ -1,23 +0,0 @@ -package org.typelevel.sbt - -import scala.util.control.Exception._ - -object ReleaseSeries { - private val SeriesR = """(\d+)\.(\d+)""".r - - def fromString(str: String): Option[ReleaseSeries] = - allCatch opt { - str match { - case SeriesR(major, minor) => ReleaseSeries(major.toInt, minor.toInt) - } - } -} - -case class ReleaseSeries(major: Int, minor: Int) { - def id = s"$major.$minor" - - def <=(that: ReleaseSeries) = - this.major < that.major || (this.major == that.major && this.minor <= that.minor) - - override def toString = s"ReleaseSeries($major, $minor)" -} diff --git a/src/main/scala/Releasing.scala b/src/main/scala/Releasing.scala deleted file mode 100644 index 5a04721f..00000000 --- a/src/main/scala/Releasing.scala +++ /dev/null @@ -1,168 +0,0 @@ -package org.typelevel.sbt - -import sbt._ -import sbt.Keys._ - -import com.typesafe.sbt.pgp.PgpKeys._ - -import sbtrelease._ -import sbtrelease.ReleasePlugin._ -import sbtrelease.ReleasePlugin.ReleaseKeys._ -import sbtrelease.ReleaseStateTransformations._ - -import org.typelevel.sbt.TypelevelPlugin.TypelevelKeys -import org.typelevel.sbt.Version.{Final, Snapshot} - -object Releasing { - - object Stages { - val checks: Seq[ReleaseStep] = List( - checkSnapshotDependencies, - runTest - ) - - val versions: Seq[ReleaseStep] = List( - inquireVersions - ) - - val pre: Seq[ReleaseStep] = List( - setReleaseVersion, - commitReleaseVersion, - tagRelease - ) - - val publish: Seq[ReleaseStep] = List( - publishArtifacts - ) - - val post: Seq[ReleaseStep] = List( - setNextVersion, - setMimaVersion, - commitNextVersion - ) - } - - lazy val versions = AttributeKey[Versions]("typelevel-release-versions") - - private def readSeries(prompt: String): Option[ReleaseSeries] = - SimpleReader.readLine(prompt) match { - case Some("") => - None - case Some(input) => - Some(ReleaseSeries.fromString(input).getOrElse(sys.error("version format error"))) - case None => - None - } - - private def readVersion(prompt: String): Option[Version.Relative] = - SimpleReader.readLine(prompt) match { - case Some("") => - None - case Some(input) => - Some(Version.Relative.fromString(input).getOrElse(sys.error("version format error"))) - case None => - None - } - - val inquireVersions: ReleaseStep = { st: State => - val extracted = Project.extract(st) - val releaseS = extracted.get(TypelevelKeys.series) - - val currentV = extracted.get(TypelevelKeys.relativeVersion) - - st.log.info(s"Current version is: ${extracted.get(version)}") - - val defaultReleaseV = Version.Relative(currentV.value, Final) - val releaseV = readVersion(s"Release (relative) version [${defaultReleaseV.id}]: ").getOrElse(defaultReleaseV) - - val (nextS, nextV) = readSeries(s"Next release series [${releaseS.id}]: ") match { - case None | Some(`releaseS`) => - st.log.info("Not bumping release series") - val defaultNextV = Version.Relative(currentV.value + 1, Snapshot) - (releaseS, readVersion(s"Next (relative) version [${defaultNextV.id}]: ").getOrElse(defaultNextV)) - case Some(series) => - st.log.info(s"Bumping release series to ${series.id}, setting next relative version to 0-SNAPSHOT") - (series, Version.Relative(0, Version.Snapshot)) - } - - st.put(versions, (Version(releaseS, releaseV), Version(nextS, nextV))) - } - - private def writeVersion(st: State, version: Version): Unit = { - val extracted = Project.extract(st) - - val file = extracted.get(versionFile) - - val contents = s"""|import org.typelevel.sbt.ReleaseSeries - |import org.typelevel.sbt.Version._ - | - |TypelevelKeys.series in ThisBuild := ${version.series} - | - |TypelevelKeys.relativeVersion in ThisBuild := ${version.relative} - |""".stripMargin - - IO.write(file, contents, append = false) - } - - private def setVersions(select: Versions => Version): ReleaseStep = { st: State => - val version = select(st.get(versions).getOrElse(sys.error("versions must be set"))) - - st.log.info(s"Setting version to ${version.id}") - - writeVersion(st, version) - - reapply(Seq( - TypelevelKeys.series in ThisBuild := version.series, - TypelevelKeys.relativeVersion in ThisBuild := version.relative - ), st) - } - - val setReleaseVersion: ReleaseStep = setVersions(_._1) - val setNextVersion: ReleaseStep = setVersions(_._2) - - val setMimaVersion: ReleaseStep = { st: State => - val extracted = Project.extract(st) - - val (releaseV, nextV) = st.get(versions).getOrElse(sys.error("versions must be set")) - - extracted.get(TypelevelKeys.stability) match { - case Stability.Stable if releaseV.series == nextV.series => - val file = extracted.get(versionFile) - - val contents = s"""| - |TypelevelKeys.lastRelease in ThisBuild := ${releaseV.relative} - |""".stripMargin - - IO.write(file, contents, append = true) - - reapply(Seq(TypelevelKeys.lastRelease in ThisBuild := releaseV.relative), st) - - case Stability.Stable => - st.log.info("Bumped release series; not setting `lastRelease`") - st - - case Stability.Development => - st.log.info("Unstable branch; not setting `lastRelease`") - st - } - } - - - val publishArtifacts: ReleaseStep = ReleaseStep( - action = st => { - val extracted = Project.extract(st) - val ref = extracted.get(thisProjectRef) - val task = if (extracted.get(TypelevelKeys.signArtifacts)) publishSigned else publish - extracted.runAggregated(task in ref, st) - }, - check = st => { - // getPublishTo fails if no publish repository is set up. - val ex = Project.extract(st) - val ref = ex.get(thisProjectRef) - Classpaths.getPublishTo(ex.get(publishTo in Global in ref)) - st - }, - enableCrossBuild = true - ) - -} diff --git a/src/main/scala/Stability.scala b/src/main/scala/Stability.scala deleted file mode 100644 index 7b396683..00000000 --- a/src/main/scala/Stability.scala +++ /dev/null @@ -1,8 +0,0 @@ -package org.typelevel.sbt - -object Stability { - case object Stable extends Stability - case object Development extends Stability -} - -sealed abstract class Stability diff --git a/src/main/scala/TypelevelPlugin.scala b/src/main/scala/TypelevelPlugin.scala deleted file mode 100644 index beb418a4..00000000 --- a/src/main/scala/TypelevelPlugin.scala +++ /dev/null @@ -1,164 +0,0 @@ -package org.typelevel.sbt - -import sbt._ -import sbt.Keys._ - -import sbtrelease.{ReleasePlugin, Vcs} -import sbtrelease.ReleasePlugin.ReleaseKeys -import com.typesafe.tools.mima.plugin.{MimaPlugin, MimaKeys} -import net.virtualvoid.sbt.graph.DependencyGraphSettings -import sbtbuildinfo.{Plugin => BuildInfoPlugin} -import sbtbuildinfo.Plugin.BuildInfoKey -import xerial.sbt.{Sonatype => SonatypePlugin} - -import Releasing.Stages - -object TypelevelPlugin extends Plugin { - - object TypelevelKeys { - - lazy val series = - SettingKey[ReleaseSeries]("series", "The current release series of this branch") - - lazy val stability = - SettingKey[Stability]("stability", "The current stability of this branch") - - // used to compute `version` - lazy val relativeVersion = - SettingKey[Version.Relative]("relativeVersion", "The current version of this branch, relative to the current series") - - // can be left unset - lazy val lastRelease = - SettingKey[Version.Relative]("lastRelease", "The last release in the series of this branch") - - lazy val signArtifacts = - SettingKey[Boolean]("signArtifacts", "Sign artifacts before publishing") - - lazy val knownDependencies = - SettingKey[Seq[Dependency]]("knownDependencies", "List of dependencies known to satisfy binary compatibility") - - lazy val checkDependencies = - TaskKey[Unit]("checkDependencies", "Check that there are no conflicting dependencies") - - lazy val githubDevs = - SettingKey[Seq[Developer]]("githubDevs", "Developers of this project") - - // can be left unset - lazy val githubProject = - SettingKey[(String, String)]("githubProject", "User/organization and project name") - - } - - def typelevelConsumerSettings: Seq[Def.Setting[_]] = - DependencyGraphSettings.graphSettings ++ - List(TypelevelKeys.knownDependencies := Dependencies.known.all) ++ - List(Compile, Test, Runtime, Provided, Optional).flatMap(Dependencies.checkSettings) - - def typelevelDefaultSettings: Seq[Def.Setting[_]] = - ReleasePlugin.releaseSettings ++ - MimaPlugin.mimaDefaultSettings ++ - SonatypePlugin.sonatypeSettings ++ - typelevelConsumerSettings ++ - List( - version in ThisBuild := - Version(TypelevelKeys.series.value, TypelevelKeys.relativeVersion.value).id, - - TypelevelKeys.stability := { - if (TypelevelKeys.relativeVersion.value.isStable) - Stability.Stable - else - Stability.Development - }, - - TypelevelKeys.signArtifacts := - TypelevelKeys.relativeVersion.value.suffix != Version.Snapshot, - - scalacOptions in (Compile, doc) ++= { - (for { - (org, project) <- TypelevelKeys.githubProject.?.value - vcs <- ReleaseKeys.versionControlSystem.value - } yield { - val tagOrBranch = - if (version.value endsWith "SNAPSHOT") - vcs.currentHash - else - "v" + version.value - - Seq( - "-sourcepath", vcs.baseDir.getAbsolutePath(), - "-doc-source-url", s"https://github.com/$org/$project/blob/$tagOrBranch€{FILE_PATH}.scala" - ) - }).getOrElse(Seq()) - }, - - ReleaseKeys.releaseProcess := - Stages.checks ++ - Stages.versions ++ - Stages.pre ++ - Stages.publish ++ - Stages.post, - - MimaKeys.previousArtifact := { - TypelevelKeys.stability.value match { - case Stability.Stable => - TypelevelKeys.lastRelease.?.value match { - case Some(lR) => - val ver = Version(TypelevelKeys.series.value, lR) - Some(organization.value % (name.value + "_" + scalaBinaryVersion.value) % ver.id) - case None => - None - } - case Stability.Development => - None - } - }, - - MimaKeys.reportBinaryIssues := { - if (TypelevelKeys.stability.value == Stability.Stable && MimaKeys.previousArtifact.value == None) - streams.value.log.warn("Suspicious `previousArtifact` setting: no previous artifact set, but branch is stable") - MimaKeys.reportBinaryIssues.value - }, - - TypelevelKeys.githubDevs := List(), - - pomExtra := pomExtra.value ++ { - - { TypelevelKeys.githubDevs.value.map(_.pomExtra) } - - } ++ { - TypelevelKeys.githubProject.?.value match { - case Some((org, project)) => - - scm:git:github.com/{ org }/{ project }.git - scm:git:git@github.com:{ org }/{ project }.git - https://github.com/{ org }/{ project } - - case None => - Seq() - } - }, - - publishMavenStyle := true, - publishArtifact in Test := false, - pomIncludeRepository := Function.const(false), - - credentials ++= { - Publishing.fromFile orElse - Publishing.fromUserPass orElse - Publishing.fromFallbackFile - }.toList - ) - - def typelevelBuildInfoSettings: Seq[Def.Setting[_]] = - BuildInfoPlugin.buildInfoSettings ++ - List( - ReleaseKeys.versionControlSystem := Vcs.detect(baseDirectory.value), - sourceGenerators in Compile <+= BuildInfoPlugin.buildInfo, - BuildInfoPlugin.buildInfoKeys ++= List[BuildInfoKey]( - scalaBinaryVersion, - ("vcsHash", ReleaseKeys.versionControlSystem.value.map(_.currentHash)) - ), - BuildInfoPlugin.buildInfoPackage := name.value - ) - -} diff --git a/src/main/scala/Version.scala b/src/main/scala/Version.scala deleted file mode 100644 index de90aa8a..00000000 --- a/src/main/scala/Version.scala +++ /dev/null @@ -1,69 +0,0 @@ -package org.typelevel.sbt - -import scala.util.control.Exception._ - -object Version { - object Relative { - private val SnapshotR = """(\d+)-SNAPSHOT""".r - private val MilestoneR = """(\d+)-M(\d+)""".r - private val RCR = """(\d+)-RC(\d+)""".r - private val FinalR = """(\d+)""".r - - def fromString(str: String): Option[Relative] = allCatch opt { - val (value, suffix) = - str match { - case SnapshotR(value) => (value, Snapshot) - case MilestoneR(value, count) => (value, Milestone(count.toInt)) - case RCR(value, count) => (value, RC(count.toInt)) - case FinalR(value) => (value, Final) - } - Relative(value.toInt, suffix) - } - } - - private val VersionR = """(\d+)\.(\d+)\.(.*)""".r - - def fromString(str: String): Option[Version] = { - val parsed = allCatch opt { - str match { - case VersionR(major, minor, rest) => (ReleaseSeries(major.toInt, minor.toInt), rest) - } - } - - for { - (series, rest) <- parsed - relative <- Relative.fromString(rest) - } yield Version(series, relative) - } - - case class Relative(value: Int, suffix: Suffix) { - def id = suffix.id.fold(value.toString)(s => s"$value-$s") - - def isStable: Boolean = - value > 0 || suffix == Final - - override def toString = s"Relative($value, $suffix)" - } - - sealed trait Suffix { - def id = this match { - case Snapshot => Some("SNAPSHOT") - case Milestone(c) => Some(s"M$c") - case RC(c) => Some(s"RC$c") - case Final => None - } - } - - case object Snapshot extends Suffix - case class Milestone(count: Int) extends Suffix - case class RC(count: Int) extends Suffix - case object Final extends Suffix -} - -case class Version(series: ReleaseSeries, relative: Version.Relative) { - def id = s"${series.id}.${relative.id}" - - def compatible(that: Version) = - (this.series == that.series) && this.relative.isStable && that.relative.isStable - -} diff --git a/src/main/scala/package.scala b/src/main/scala/package.scala deleted file mode 100644 index 3a938be7..00000000 --- a/src/main/scala/package.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.typelevel - -package object sbt { - type Versions = (Version, Version) -} diff --git a/src/sbt-test/sbt-typelevel/buildinfo/.gitignore b/src/sbt-test/sbt-typelevel/buildinfo/.gitignore deleted file mode 100644 index 5e067908..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -target -global diff --git a/src/sbt-test/sbt-typelevel/buildinfo/build.sbt b/src/sbt-test/sbt-typelevel/buildinfo/build.sbt deleted file mode 100644 index 61240726..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/build.sbt +++ /dev/null @@ -1,9 +0,0 @@ -scalaVersion := "2.10.3" - -version := "0.1-SNAPSHOT" - -name := "binfo" - -libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.11.3" - -typelevelBuildInfoSettings diff --git a/src/sbt-test/sbt-typelevel/buildinfo/new/package.scala b/src/sbt-test/sbt-typelevel/buildinfo/new/package.scala deleted file mode 100644 index c764a213..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/new/package.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.sys.process._ - -package object binfo { - def vcsHash: Option[String] = Some("git rev-parse HEAD".!!.trim) -} diff --git a/src/sbt-test/sbt-typelevel/buildinfo/project/build.properties b/src/sbt-test/sbt-typelevel/buildinfo/project/build.properties deleted file mode 100644 index be6c454f..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.5 diff --git a/src/sbt-test/sbt-typelevel/buildinfo/project/plugins.sbt b/src/sbt-test/sbt-typelevel/buildinfo/project/plugins.sbt deleted file mode 100644 index c5b28ef0..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.typelevel" % "sbt-typelevel" % System.getProperty("plugin.version")) diff --git a/src/sbt-test/sbt-typelevel/buildinfo/src/main/scala/package.scala b/src/sbt-test/sbt-typelevel/buildinfo/src/main/scala/package.scala deleted file mode 100644 index 0f0897f2..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/src/main/scala/package.scala +++ /dev/null @@ -1,3 +0,0 @@ -package object binfo { - def vcsHash: Option[String] = None -} diff --git a/src/sbt-test/sbt-typelevel/buildinfo/src/test/scala/BuildInfoTest.scala b/src/sbt-test/sbt-typelevel/buildinfo/src/test/scala/BuildInfoTest.scala deleted file mode 100644 index b4d4759b..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/src/test/scala/BuildInfoTest.scala +++ /dev/null @@ -1,17 +0,0 @@ -package binfo - -import org.scalacheck._ -import org.scalacheck.Prop._ -import org.scalacheck.util.Pretty - -object BuildInfoTest extends Properties("buildinfo") { - def field[A <% Pretty](str: String, ref: A)(accessor: BuildInfo.type => A) = - property(str) = { accessor(BuildInfo) ?= ref } - - field("name", "binfo") { _.name } - field("version", "0.1-SNAPSHOT") { _.version } - field("scalaVersion", "2.10.3") { _.scalaVersion } - field("sbtVersion", "0.13.5") { _.sbtVersion } - field("scalaBinaryVersion", "2.10") { _.scalaBinaryVersion } - field("vcsHash", vcsHash) { _.vcsHash } -} diff --git a/src/sbt-test/sbt-typelevel/buildinfo/test b/src/sbt-test/sbt-typelevel/buildinfo/test deleted file mode 100644 index 17ef831e..00000000 --- a/src/sbt-test/sbt-typelevel/buildinfo/test +++ /dev/null @@ -1,12 +0,0 @@ -> test - -$ exec git init -$ exec git config user.email "typelevel@example.org" -$ exec git config user.name "Typelevel" -$ exec git add -A -$ exec git commit -m init - -$ copy-file new/package.scala src/main/scala/package.scala - -> reload -> test diff --git a/src/sbt-test/sbt-typelevel/deps/.gitignore b/src/sbt-test/sbt-typelevel/deps/.gitignore deleted file mode 100644 index 5e067908..00000000 --- a/src/sbt-test/sbt-typelevel/deps/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -target -global diff --git a/src/sbt-test/sbt-typelevel/deps/bad/deps.sbt b/src/sbt-test/sbt-typelevel/deps/bad/deps.sbt deleted file mode 100644 index c79d1ed3..00000000 --- a/src/sbt-test/sbt-typelevel/deps/bad/deps.sbt +++ /dev/null @@ -1,3 +0,0 @@ -libraryDependencies += "org.scalaz" %% "scalaz-scalacheck-binding" % "7.0.5" - -libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.11.0" % "test" diff --git a/src/sbt-test/sbt-typelevel/deps/build.sbt b/src/sbt-test/sbt-typelevel/deps/build.sbt deleted file mode 100644 index 58789257..00000000 --- a/src/sbt-test/sbt-typelevel/deps/build.sbt +++ /dev/null @@ -1,3 +0,0 @@ -scalaVersion := "2.10.3" - -typelevelConsumerSettings diff --git a/src/sbt-test/sbt-typelevel/deps/good/deps.sbt b/src/sbt-test/sbt-typelevel/deps/good/deps.sbt deleted file mode 100644 index d93fc8be..00000000 --- a/src/sbt-test/sbt-typelevel/deps/good/deps.sbt +++ /dev/null @@ -1,3 +0,0 @@ -libraryDependencies += "org.scalaz" %% "scalaz-scalacheck-binding" % "7.0.5" - -libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0" diff --git a/src/sbt-test/sbt-typelevel/deps/project/build.properties b/src/sbt-test/sbt-typelevel/deps/project/build.properties deleted file mode 100644 index be6c454f..00000000 --- a/src/sbt-test/sbt-typelevel/deps/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.5 diff --git a/src/sbt-test/sbt-typelevel/deps/project/plugins.sbt b/src/sbt-test/sbt-typelevel/deps/project/plugins.sbt deleted file mode 100644 index c5b28ef0..00000000 --- a/src/sbt-test/sbt-typelevel/deps/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.typelevel" % "sbt-typelevel" % System.getProperty("plugin.version")) diff --git a/src/sbt-test/sbt-typelevel/deps/test b/src/sbt-test/sbt-typelevel/deps/test deleted file mode 100644 index 8eea8cc4..00000000 --- a/src/sbt-test/sbt-typelevel/deps/test +++ /dev/null @@ -1,7 +0,0 @@ -$ copy-file good/deps.sbt deps.sbt -> checkDependencies - -$ copy-file bad/deps.sbt deps.sbt -> reload -> checkDependencies --> test:checkDependencies diff --git a/src/sbt-test/sbt-typelevel/docs/.gitignore b/src/sbt-test/sbt-typelevel/docs/.gitignore deleted file mode 100644 index 5e067908..00000000 --- a/src/sbt-test/sbt-typelevel/docs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -target -global diff --git a/src/sbt-test/sbt-typelevel/docs/build.sbt b/src/sbt-test/sbt-typelevel/docs/build.sbt deleted file mode 100644 index 78610fde..00000000 --- a/src/sbt-test/sbt-typelevel/docs/build.sbt +++ /dev/null @@ -1,10 +0,0 @@ -organization := "org.example" - -name := "docs" - -scalaVersion := "2.10.3" - - -typelevelDefaultSettings - -TypelevelKeys.githubProject := ("example", "example-docs") \ No newline at end of file diff --git a/src/sbt-test/sbt-typelevel/docs/code.scala b/src/sbt-test/sbt-typelevel/docs/code.scala deleted file mode 100644 index a891285a..00000000 --- a/src/sbt-test/sbt-typelevel/docs/code.scala +++ /dev/null @@ -1,2 +0,0 @@ -/** Some documentation. */ -class Code diff --git a/src/sbt-test/sbt-typelevel/docs/new/version.sbt b/src/sbt-test/sbt-typelevel/docs/new/version.sbt deleted file mode 100644 index 347d4718..00000000 --- a/src/sbt-test/sbt-typelevel/docs/new/version.sbt +++ /dev/null @@ -1,7 +0,0 @@ - -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2,3) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(0,Final) \ No newline at end of file diff --git a/src/sbt-test/sbt-typelevel/docs/project/build.properties b/src/sbt-test/sbt-typelevel/docs/project/build.properties deleted file mode 100644 index be6c454f..00000000 --- a/src/sbt-test/sbt-typelevel/docs/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.5 diff --git a/src/sbt-test/sbt-typelevel/docs/project/plugins.sbt b/src/sbt-test/sbt-typelevel/docs/project/plugins.sbt deleted file mode 100644 index c5b28ef0..00000000 --- a/src/sbt-test/sbt-typelevel/docs/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.typelevel" % "sbt-typelevel" % System.getProperty("plugin.version")) diff --git a/src/sbt-test/sbt-typelevel/docs/test b/src/sbt-test/sbt-typelevel/docs/test deleted file mode 100644 index 9de72765..00000000 --- a/src/sbt-test/sbt-typelevel/docs/test +++ /dev/null @@ -1,27 +0,0 @@ -> doc - -$ exec grep --silent --invert -F "github" target/scala-2.10/api/Code.html - -> clean - - -$ exec git init -$ exec git config user.email "typelevel@example.org" -$ exec git config user.name "Typelevel" -$ exec git add -A -$ exec git commit -m init - -> reload -> doc - -$ exec grep --silent -E "[0-9a-f]{40}" target/scala-2.10/api/Code.html - -> clean - - -$ copy-file new/version.sbt version.sbt - -> reload -> doc - -$ exec grep --silent -F "v2.3.0" target/scala-2.10/api/Code.html \ No newline at end of file diff --git a/src/sbt-test/sbt-typelevel/docs/version.sbt b/src/sbt-test/sbt-typelevel/docs/version.sbt deleted file mode 100644 index 56e3f3b2..00000000 --- a/src/sbt-test/sbt-typelevel/docs/version.sbt +++ /dev/null @@ -1,7 +0,0 @@ - -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2,3) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(0,Snapshot) diff --git a/src/sbt-test/sbt-typelevel/release-bump/.gitignore b/src/sbt-test/sbt-typelevel/release-bump/.gitignore deleted file mode 100644 index 07b0b0db..00000000 --- a/src/sbt-test/sbt-typelevel/release-bump/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -target -global -repo diff --git a/src/sbt-test/sbt-typelevel/release-bump/build.sbt b/src/sbt-test/sbt-typelevel/release-bump/build.sbt deleted file mode 100644 index a5677538..00000000 --- a/src/sbt-test/sbt-typelevel/release-bump/build.sbt +++ /dev/null @@ -1,33 +0,0 @@ -import org.typelevel.sbt.{Version => TVersion, _} -import org.typelevel.sbt.Releasing.Stages - - -organization := "org.example" - -name := "release" - -resolvers := Seq("r-repo" at s"file://${System.getProperty("user.dir")}/repo") - -scalaVersion := "2.10.3" - - -typelevelDefaultSettings - -TypelevelKeys.signArtifacts := false - -val dummyVersions = List[sbtrelease.ReleaseStep]({ st: State => - val releaseS = ReleaseSeries(2, 3) - val releaseV = TVersion.Relative(0, TVersion.Final) - val nextS = ReleaseSeries(2, 4) - val nextV = TVersion.Relative(0, TVersion.Snapshot) - st.put(Releasing.versions, (TVersion(releaseS, releaseV), TVersion(nextS, nextV))) -}) - -ReleaseKeys.releaseProcess := - Stages.checks ++ - dummyVersions ++ - Stages.pre ++ - Stages.publish ++ - Stages.post - -publishTo := Some(Resolver.file("repo", new File("./repo"))) diff --git a/src/sbt-test/sbt-typelevel/release-bump/project/build.properties b/src/sbt-test/sbt-typelevel/release-bump/project/build.properties deleted file mode 100644 index be6c454f..00000000 --- a/src/sbt-test/sbt-typelevel/release-bump/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.5 diff --git a/src/sbt-test/sbt-typelevel/release-bump/project/plugins.sbt b/src/sbt-test/sbt-typelevel/release-bump/project/plugins.sbt deleted file mode 100644 index c5b28ef0..00000000 --- a/src/sbt-test/sbt-typelevel/release-bump/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.typelevel" % "sbt-typelevel" % System.getProperty("plugin.version")) diff --git a/src/sbt-test/sbt-typelevel/release-bump/ref/version.sbt b/src/sbt-test/sbt-typelevel/release-bump/ref/version.sbt deleted file mode 100644 index afbae83c..00000000 --- a/src/sbt-test/sbt-typelevel/release-bump/ref/version.sbt +++ /dev/null @@ -1,6 +0,0 @@ -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2, 4) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(0, Snapshot) diff --git a/src/sbt-test/sbt-typelevel/release-bump/test b/src/sbt-test/sbt-typelevel/release-bump/test deleted file mode 100644 index bb532d1e..00000000 --- a/src/sbt-test/sbt-typelevel/release-bump/test +++ /dev/null @@ -1,16 +0,0 @@ -$ exec mkdir repo - -$ exec git init -$ exec git config user.email "typelevel@example.org" -$ exec git config user.name "Typelevel" -$ exec git add -A -$ exec git commit -m init - -> reload -> release -$ exists repo/org/example/release_2.10/2.3.0/release_2.10-2.3.0.jar - -$ exec cmp ref/version.sbt version.sbt - -> publish -$ exists repo/org/example/release_2.10/2.4.0-SNAPSHOT/release_2.10-2.4.0-SNAPSHOT.jar \ No newline at end of file diff --git a/src/sbt-test/sbt-typelevel/release-bump/version.sbt b/src/sbt-test/sbt-typelevel/release-bump/version.sbt deleted file mode 100644 index 65094b96..00000000 --- a/src/sbt-test/sbt-typelevel/release-bump/version.sbt +++ /dev/null @@ -1,6 +0,0 @@ -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2, 3) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(0, Snapshot) diff --git a/src/sbt-test/sbt-typelevel/release/.gitignore b/src/sbt-test/sbt-typelevel/release/.gitignore deleted file mode 100644 index 07b0b0db..00000000 --- a/src/sbt-test/sbt-typelevel/release/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -target -global -repo diff --git a/src/sbt-test/sbt-typelevel/release/A.scala b/src/sbt-test/sbt-typelevel/release/A.scala deleted file mode 100644 index d841a3a0..00000000 --- a/src/sbt-test/sbt-typelevel/release/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -package org.example - -trait A { -} diff --git a/src/sbt-test/sbt-typelevel/release/build.sbt b/src/sbt-test/sbt-typelevel/release/build.sbt deleted file mode 100644 index 9b884099..00000000 --- a/src/sbt-test/sbt-typelevel/release/build.sbt +++ /dev/null @@ -1,38 +0,0 @@ -import org.typelevel.sbt.{Version => TVersion, _} -import org.typelevel.sbt.Releasing.Stages - - -organization := "org.example" - -name := "release" - -resolvers := Seq("r-repo" at s"file://${System.getProperty("user.dir")}/repo") - -scalaVersion := "2.10.3" - -crossScalaVersions := Seq("2.9.3", "2.10.3") - - -typelevelDefaultSettings - -TypelevelKeys.signArtifacts := false - -TypelevelKeys.githubDevs += Developer("Lars Hupel", "larsrh") - -TypelevelKeys.githubProject := ("typelevel", "sbt-typelevel") - -val dummyVersions = List[sbtrelease.ReleaseStep]({ st: State => - val series = ReleaseSeries(2, 3) - val releaseV = TVersion.Relative(0, TVersion.Final) - val nextV = TVersion.Relative(1, TVersion.Snapshot) - st.put(Releasing.versions, (TVersion(series, releaseV), TVersion(series, nextV))) -}) - -ReleaseKeys.releaseProcess := - Stages.checks ++ - dummyVersions ++ - Stages.pre ++ - Stages.publish ++ - Stages.post - -publishTo := Some(Resolver.file("repo", new File("./repo"))) diff --git a/src/sbt-test/sbt-typelevel/release/new/A.scala b/src/sbt-test/sbt-typelevel/release/new/A.scala deleted file mode 100644 index d2bd0e55..00000000 --- a/src/sbt-test/sbt-typelevel/release/new/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.example - -trait A { - def x: Int -} diff --git a/src/sbt-test/sbt-typelevel/release/project/build.properties b/src/sbt-test/sbt-typelevel/release/project/build.properties deleted file mode 100644 index be6c454f..00000000 --- a/src/sbt-test/sbt-typelevel/release/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.5 diff --git a/src/sbt-test/sbt-typelevel/release/project/plugins.sbt b/src/sbt-test/sbt-typelevel/release/project/plugins.sbt deleted file mode 100644 index c5b28ef0..00000000 --- a/src/sbt-test/sbt-typelevel/release/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.typelevel" % "sbt-typelevel" % System.getProperty("plugin.version")) diff --git a/src/sbt-test/sbt-typelevel/release/ref/pom.xml b/src/sbt-test/sbt-typelevel/release/ref/pom.xml deleted file mode 100644 index ccf6523d..00000000 --- a/src/sbt-test/sbt-typelevel/release/ref/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - org.example - release_2.10 - jar - release - 2.3.0 - release - - org.example - - - - larsrh - Lars Hupel - https://github.com/larsrh - - - - scm:git:github.com/typelevel/sbt-typelevel.git - scm:git:git@github.com:typelevel/sbt-typelevel.git - https://github.com/typelevel/sbt-typelevel - - - - org.scala-lang - scala-library - 2.10.3 - - - \ No newline at end of file diff --git a/src/sbt-test/sbt-typelevel/release/ref/version.sbt b/src/sbt-test/sbt-typelevel/release/ref/version.sbt deleted file mode 100644 index 7990377a..00000000 --- a/src/sbt-test/sbt-typelevel/release/ref/version.sbt +++ /dev/null @@ -1,8 +0,0 @@ -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2, 3) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(1, Snapshot) - -TypelevelKeys.lastRelease in ThisBuild := Relative(0, Final) diff --git a/src/sbt-test/sbt-typelevel/release/test b/src/sbt-test/sbt-typelevel/release/test deleted file mode 100644 index 02c4fea9..00000000 --- a/src/sbt-test/sbt-typelevel/release/test +++ /dev/null @@ -1,25 +0,0 @@ -$ exec mkdir repo - -$ exec git init -$ exec git config user.email "typelevel@example.org" -$ exec git config user.name "Typelevel" -$ exec git add -A -$ exec git commit -m init - -> reload -> release cross -$ exists repo/org/example/release_2.10/2.3.0/release_2.10-2.3.0.jar -$ exists repo/org/example/release_2.9.3/2.3.0/release_2.9.3-2.3.0.jar - -$ exec cmp ref/pom.xml repo/org/example/release_2.10/2.3.0/release_2.10-2.3.0.pom - -$ exec cmp ref/version.sbt version.sbt - -> publish -$ exists repo/org/example/release_2.10/2.3.1-SNAPSHOT/release_2.10-2.3.1-SNAPSHOT.jar - -$ copy-file new/A.scala A.scala --> mimaReportBinaryIssues - -$ exec git checkout A.scala -> mimaReportBinaryIssues diff --git a/src/sbt-test/sbt-typelevel/release/version.sbt b/src/sbt-test/sbt-typelevel/release/version.sbt deleted file mode 100644 index 65094b96..00000000 --- a/src/sbt-test/sbt-typelevel/release/version.sbt +++ /dev/null @@ -1,6 +0,0 @@ -import org.typelevel.sbt.ReleaseSeries -import org.typelevel.sbt.Version._ - -TypelevelKeys.series in ThisBuild := ReleaseSeries(2, 3) - -TypelevelKeys.relativeVersion in ThisBuild := Relative(0, Snapshot) From 3077a90eb34d8baeac1339423feb123a0a2f5547 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 18:30:00 +0000 Subject: [PATCH 02/70] Create NoPublishPlugin --- build.sbt | 14 ++++++++++++++ .../scala/org/typelevel/sbt/NoPublishPlugin.scala | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala diff --git a/build.sbt b/build.sbt index aeda4bb7..d4cf5c3e 100644 --- a/build.sbt +++ b/build.sbt @@ -1 +1,15 @@ name := "sbt-typelevel" + +ThisBuild / organization := "org.typelevel" +ThisBuild / organizationName := "Typelevel" + +ThisBuild / scalaVersion := "2.12.15" + +lazy val root = project.in(file(".")) + +lazy val noPublish = project + .in(file("no-publish")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typlevel-no-publish" + ) diff --git a/no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala b/no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala new file mode 100644 index 00000000..71f1b2cb --- /dev/null +++ b/no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala @@ -0,0 +1,14 @@ +package org.typelevel.sbt + +import sbt._, Keys._ + +object NoPublishPlugin extends AutoPlugin { + override def trigger = noTrigger + + override def projectSettings = Seq( + publish := {}, + publishLocal := {}, + publishArtifact := false, + publish / skip := true + ) +} From 035cc79908121496fe3eb8ea9f4dc2c3967f9577 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 19:04:49 +0000 Subject: [PATCH 03/70] we are self-hosting! --- build.sbt | 2 +- project/src/main/scala/no-publish | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 120000 project/src/main/scala/no-publish diff --git a/build.sbt b/build.sbt index d4cf5c3e..6bf87fd2 100644 --- a/build.sbt +++ b/build.sbt @@ -9,7 +9,7 @@ lazy val root = project.in(file(".")) lazy val noPublish = project .in(file("no-publish")) - .enablePlugins(SbtPlugin) + .enablePlugins(SbtPlugin, NoPublishPlugin) .settings( name := "sbt-typlevel-no-publish" ) diff --git a/project/src/main/scala/no-publish b/project/src/main/scala/no-publish new file mode 120000 index 00000000..e7f29cc3 --- /dev/null +++ b/project/src/main/scala/no-publish @@ -0,0 +1 @@ +../../../../no-publish \ No newline at end of file From 98e2e7472588ce6b777dbc73d06b694af2539aae Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 19:12:12 +0000 Subject: [PATCH 04/70] Use no-publish on root actually :) --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 6bf87fd2..643b5b5a 100644 --- a/build.sbt +++ b/build.sbt @@ -5,11 +5,11 @@ ThisBuild / organizationName := "Typelevel" ThisBuild / scalaVersion := "2.12.15" -lazy val root = project.in(file(".")) +lazy val root = project.in(file(".")).enablePlugins(NoPublishPlugin) lazy val noPublish = project .in(file("no-publish")) - .enablePlugins(SbtPlugin, NoPublishPlugin) + .enablePlugins(SbtPlugin) .settings( name := "sbt-typlevel-no-publish" ) From b21d41cd2cd8b0631a280f1c1410fa09e3a957b8 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 19:19:10 +0000 Subject: [PATCH 05/70] typo --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 643b5b5a..3e9d58c4 100644 --- a/build.sbt +++ b/build.sbt @@ -11,5 +11,5 @@ lazy val noPublish = project .in(file("no-publish")) .enablePlugins(SbtPlugin) .settings( - name := "sbt-typlevel-no-publish" + name := "sbt-typelevel-no-publish" ) From 570c49666fc42b2fa9ea6e1660496d67873ad8c0 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 20:51:06 +0000 Subject: [PATCH 06/70] Setup basic versioning --- build.sbt | 8 +++ project/src/main/scala/versioning | 1 + project/versioning.sbt | 1 + versioning/build.sbt | 1 + .../org/typelevel/sbt/VersioningPlugin.scala | 51 +++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 120000 project/src/main/scala/versioning create mode 120000 project/versioning.sbt create mode 100644 versioning/build.sbt create mode 100644 versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala diff --git a/build.sbt b/build.sbt index 3e9d58c4..dcbdd2b8 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,6 @@ name := "sbt-typelevel" +ThisBuild / tlBaseVersion := "0.4" ThisBuild / organization := "org.typelevel" ThisBuild / organizationName := "Typelevel" @@ -13,3 +14,10 @@ lazy val noPublish = project .settings( name := "sbt-typelevel-no-publish" ) + +lazy val versioning = project + .in(file("versioning")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-versioning" + ) diff --git a/project/src/main/scala/versioning b/project/src/main/scala/versioning new file mode 120000 index 00000000..d20c25ad --- /dev/null +++ b/project/src/main/scala/versioning @@ -0,0 +1 @@ +../../../../versioning/ \ No newline at end of file diff --git a/project/versioning.sbt b/project/versioning.sbt new file mode 120000 index 00000000..ba96276c --- /dev/null +++ b/project/versioning.sbt @@ -0,0 +1 @@ +../versioning/build.sbt \ No newline at end of file diff --git a/versioning/build.sbt b/versioning/build.sbt new file mode 100644 index 00000000..688233f6 --- /dev/null +++ b/versioning/build.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") diff --git a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala new file mode 100644 index 00000000..393f2637 --- /dev/null +++ b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala @@ -0,0 +1,51 @@ +package org.typelevel.sbt + +import sbt._, Keys._ +import com.typesafe.sbt.GitPlugin +import com.typesafe.sbt.SbtGit.git + +object VersioningPlugin extends AutoPlugin { + + override def requires = GitPlugin + override def trigger = allRequirements + + object autoImport { + lazy val tlBaseVersion = + settingKey[String]("The base version for the series your project is in. e.g., 0.2, 3.5") + lazy val tlHashSnapshots = + settingKey[Boolean]("If true, a hash version implies this is a snapshot.") + } + + import autoImport._ + + val ReleaseTag = """^v((?:\d+\.){2}\d+(?:-.*)?)$""".r + + override def buildSettings: Seq[Setting[_]] = Seq( + tlHashSnapshots := true, + isSnapshot := { + val isVersionTagged = findVersionTag(git.gitCurrentTags.value).isDefined + val dirty = git.gitUncommittedChanges.value + !isVersionTagged && (tlHashSnapshots.value || dirty) + }, + version := { + val taggedVersion = git.gitCurrentTags.value.find(ReleaseTag.unapplySeq(_).isDefined) + taggedVersion.getOrElse { + var version = tlBaseVersion.value + git.gitHeadCommit.value.foreach { head => version += s"-${head.take(7)}" } + if (git.gitUncommittedChanges.value) { + import java.time.Instant + // Drop the sub-second precision + val now = Instant.ofEpochSecond(Instant.now().getEpochSecond()) + val formatted = now.toString.replace("-", "").replace(":", "") + version += s"-$formatted" + } + if (isSnapshot.value) version += "-SNAPSHOT" + version + } + } + ) + + def findVersionTag(tags: Seq[String]): Option[String] = + tags.find(ReleaseTag.unapplySeq(_).isDefined) + +} From d864c0e8acdf8e048988bf3d9e71680dc3412428 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 21:14:26 +0000 Subject: [PATCH 07/70] Setup a mima and settings plugins --- build.sbt | 19 ++++++++++++++++++- mima/build.sbt | 1 + project/mima.sbt | 1 + project/settings.sbt | 1 + project/src/main/scala/mima | 1 + project/src/main/scala/settings | 1 + settings/build.sbt | 2 ++ 7 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 mima/build.sbt create mode 120000 project/mima.sbt create mode 120000 project/settings.sbt create mode 120000 project/src/main/scala/mima create mode 120000 project/src/main/scala/settings create mode 100644 settings/build.sbt diff --git a/build.sbt b/build.sbt index dcbdd2b8..68248ab0 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,10 @@ ThisBuild / organizationName := "Typelevel" ThisBuild / scalaVersion := "2.12.15" -lazy val root = project.in(file(".")).enablePlugins(NoPublishPlugin) +lazy val root = project + .in(file(".")) + .enablePlugins(NoPublishPlugin) + .aggregate(noPublish, settings, versioning, mima) lazy val noPublish = project .in(file("no-publish")) @@ -15,9 +18,23 @@ lazy val noPublish = project name := "sbt-typelevel-no-publish" ) +lazy val settings = project + .in(file("settings")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-settings" + ) + lazy val versioning = project .in(file("versioning")) .enablePlugins(SbtPlugin) .settings( name := "sbt-typelevel-versioning" ) + +lazy val mima = project + .in(file("mima")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-mima" + ) diff --git a/mima/build.sbt b/mima/build.sbt new file mode 100644 index 00000000..8b922d5a --- /dev/null +++ b/mima/build.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") diff --git a/project/mima.sbt b/project/mima.sbt new file mode 120000 index 00000000..b15570f8 --- /dev/null +++ b/project/mima.sbt @@ -0,0 +1 @@ +../mima/build.sbt \ No newline at end of file diff --git a/project/settings.sbt b/project/settings.sbt new file mode 120000 index 00000000..2f22ac0b --- /dev/null +++ b/project/settings.sbt @@ -0,0 +1 @@ +../settings/build.sbt \ No newline at end of file diff --git a/project/src/main/scala/mima b/project/src/main/scala/mima new file mode 120000 index 00000000..7772395e --- /dev/null +++ b/project/src/main/scala/mima @@ -0,0 +1 @@ +../../../../mima \ No newline at end of file diff --git a/project/src/main/scala/settings b/project/src/main/scala/settings new file mode 120000 index 00000000..4792b768 --- /dev/null +++ b/project/src/main/scala/settings @@ -0,0 +1 @@ +../../../../settings \ No newline at end of file diff --git a/settings/build.sbt b/settings/build.sbt new file mode 100644 index 00000000..d6493224 --- /dev/null +++ b/settings/build.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.2") From b3cd73e3c02625fac1f6fca0a95f93556d753b29 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 21:30:36 +0000 Subject: [PATCH 08/70] Better variable name --- .../src/main/scala/org/typelevel/sbt/VersioningPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala index 393f2637..54b44456 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala @@ -31,7 +31,7 @@ object VersioningPlugin extends AutoPlugin { val taggedVersion = git.gitCurrentTags.value.find(ReleaseTag.unapplySeq(_).isDefined) taggedVersion.getOrElse { var version = tlBaseVersion.value - git.gitHeadCommit.value.foreach { head => version += s"-${head.take(7)}" } + git.gitHeadCommit.value.foreach { sha => version += s"-${sha.take(7)}" } if (git.gitUncommittedChanges.value) { import java.time.Instant // Drop the sub-second precision From f379386eb6f843f5a8e36d6a1965ddd77e08a8c5 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 25 Dec 2021 22:33:55 +0000 Subject: [PATCH 09/70] Start working on the mima plugin --- .../typelevel/sbt/TypelevelMimaPlugin.scala | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala new file mode 100644 index 00000000..88d15277 --- /dev/null +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -0,0 +1,39 @@ +package org.typelevel.sbt + +import sbt._, Keys._ +import com.typesafe.tools.mima.plugin.MimaPlugin +import MimaPlugin.autoImport._ + +import scala.util.Try + +object TypelevelMimaPlugin extends AutoPlugin { + + override def requires = MimaPlugin + + override def trigger = allRequirements + + object autoImport { + lazy val tlVersionIntroduced = + settingKey[Option[String]]("The version in which this module was introduced.") + } + + override def buildSettings: Seq[Setting[_]] = Seq( + mimaPreviousArtifacts := { + if (publishArtifact.value) { + Set.empty + } else { + Set.empty + } + } + ) + + val ReleaseTag = """^v((?:\d+\.){2}\d+)$""".r + + def previousReleases(): Seq[String] = { + import scala.sys.process._ + Try("git tag --list".!!.split("\n").toList.map(_.trim).collect { + case version @ ReleaseTag(_) => version + }).getOrElse(Seq.empty) + } + +} From c6d2fdfa0ab045c37bc434c78676493efc454e9e Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 26 Dec 2021 06:36:19 +0000 Subject: [PATCH 10/70] Some progress on mima --- build.sbt | 1 + .../scala/org/typelevel/sbt/TypelevelMimaPlugin.scala | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 68248ab0..c31046b0 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,7 @@ name := "sbt-typelevel" ThisBuild / tlBaseVersion := "0.4" +ThisBuild / versionScheme := Some("early-semver") ThisBuild / organization := "org.typelevel" ThisBuild / organizationName := "Typelevel" diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala index 88d15277..2be49cd4 100644 --- a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -17,10 +17,16 @@ object TypelevelMimaPlugin extends AutoPlugin { settingKey[Option[String]]("The version in which this module was introduced.") } - override def buildSettings: Seq[Setting[_]] = Seq( + import autoImport._ + + override def projectSettings: Seq[Setting[_]] = Seq( + tlVersionIntroduced := None, mimaPreviousArtifacts := { + require( + versionScheme.value.contains("early-semver"), + "Only early-semver versioning scheme supported.") if (publishArtifact.value) { - Set.empty + Set(projectID.value) } else { Set.empty } From 4e6606beb27cd5398ef30621b1812ce2d60dc715 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Mon, 27 Dec 2021 05:39:07 +0000 Subject: [PATCH 11/70] Add model for version --- build.sbt | 8 ++- .../scala/org/typelevel/sbt/kernel/V.scala | 56 +++++++++++++++++++ project/src/main/scala/kernel | 1 + 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala create mode 120000 project/src/main/scala/kernel diff --git a/build.sbt b/build.sbt index c31046b0..07ee4c8e 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,13 @@ ThisBuild / scalaVersion := "2.12.15" lazy val root = project .in(file(".")) .enablePlugins(NoPublishPlugin) - .aggregate(noPublish, settings, versioning, mima) + .aggregate(kernel, noPublish, settings, versioning, mima) + +lazy val kernel = project + .in(file("kernel")) + .settings( + name := "sbt-typelevel-kernel" + ) lazy val noPublish = project .in(file("no-publish")) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala new file mode 100644 index 00000000..bde824a1 --- /dev/null +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -0,0 +1,56 @@ +package org.typelevel.sbt.kernel + +import scala.util.Try + +final case class V( + major: Int, + minor: Int, + patch: Option[Int], + prerelease: Option[String] +) extends Ordered[V] { + + override def toString: String = + s"v$major.$minor${patch.fold("")(p => s".$p")}${prerelease.fold("")(p => s"-$p")}" + + def isPrerelease: Boolean = prerelease.nonEmpty + + def isSameSeries(that: V): Boolean = + this.major == that.major && this.minor == that.minor + + def mustBeBinCompatWith(that: V): Boolean = + this >= that && !that.isPrerelease && this.major == that.major && (major > 0 || this.minor == that.minor) + + def compare(that: V): Int = { + val x = this.major.compare(that.major) + if (x != 0) return x + val y = this.minor.compare(that.minor) + if (y != 0) return y + (this.patch, that.patch) match { + case (None, None) => 0 + case (None, Some(patch)) => 1 + case (Some(patch), None) => -1 + case (Some(thisPatch), Some(thatPatch)) => + val z = thisPatch.compare(thatPatch) + if (z != 0) return z + (this.prerelease, that.prerelease) match { + case (None, None) | (Some(_), Some(_)) => 0 + case (None, Some(_)) => 1 + case (Some(_), None) => -1 + } + } + } + +} + +object V { + val version = """^v(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:-(.+))?$""".r + + def apply(v: String): Option[V] = v match { + case version(major, minor) => Try(V(major.toInt, minor.toInt, None, None)).toOption + case version(major, minor, patch) => + Try(V(major.toInt, minor.toInt, Some(patch.toInt), None)).toOption + case version(major, minor, patch, prerelease) => + Try(V(major.toInt, minor.toInt, Some(patch.toInt), Some(prerelease))).toOption + case _ => None + } +} diff --git a/project/src/main/scala/kernel b/project/src/main/scala/kernel new file mode 120000 index 00000000..a19aee24 --- /dev/null +++ b/project/src/main/scala/kernel @@ -0,0 +1 @@ +../../../../kernel/ \ No newline at end of file From 7198a8de51e25d07c39974a878bfb582094ebe82 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Mon, 27 Dec 2021 06:11:43 +0000 Subject: [PATCH 12/70] MiMa plugin seems good --- build.sbt | 1 + .../scala/org/typelevel/sbt/kernel/V.scala | 13 ++++----- .../typelevel/sbt/TypelevelMimaPlugin.scala | 28 ++++++++++++++----- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/build.sbt b/build.sbt index 07ee4c8e..4c1073f6 100644 --- a/build.sbt +++ b/build.sbt @@ -45,3 +45,4 @@ lazy val mima = project .settings( name := "sbt-typelevel-mima" ) + .dependsOn(kernel) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala index bde824a1..d448aa4e 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -10,7 +10,7 @@ final case class V( ) extends Ordered[V] { override def toString: String = - s"v$major.$minor${patch.fold("")(p => s".$p")}${prerelease.fold("")(p => s"-$p")}" + s"$major.$minor${patch.fold("")(p => s".$p")}${prerelease.fold("")(p => s"-$p")}" def isPrerelease: Boolean = prerelease.nonEmpty @@ -43,14 +43,13 @@ final case class V( } object V { - val version = """^v(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:-(.+))?$""".r + val version = """^(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:-(.+))?$""".r - def apply(v: String): Option[V] = v match { - case version(major, minor) => Try(V(major.toInt, minor.toInt, None, None)).toOption - case version(major, minor, patch) => - Try(V(major.toInt, minor.toInt, Some(patch.toInt), None)).toOption + def apply(v: String): Option[V] = V.unapply(v) + + def unapply(v: String): Option[V] = v match { case version(major, minor, patch, prerelease) => - Try(V(major.toInt, minor.toInt, Some(patch.toInt), Some(prerelease))).toOption + Try(V(major.toInt, minor.toInt, Option(patch).map(_.toInt), Option(prerelease))).toOption case _ => None } } diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala index 2be49cd4..12fd4893 100644 --- a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -3,6 +3,7 @@ package org.typelevel.sbt import sbt._, Keys._ import com.typesafe.tools.mima.plugin.MimaPlugin import MimaPlugin.autoImport._ +import org.typelevel.sbt.kernel.V import scala.util.Try @@ -26,20 +27,33 @@ object TypelevelMimaPlugin extends AutoPlugin { versionScheme.value.contains("early-semver"), "Only early-semver versioning scheme supported.") if (publishArtifact.value) { - Set(projectID.value) + val current = V(version.value) + .getOrElse(sys.error(s"Version must be semver format: ${version.value}")) + val introduced = tlVersionIntroduced + .value + .map(v => V(v).getOrElse(sys.error(s"Version must be semver format: $v"))) + val previous = previousReleases() + .filterNot(_.isPrerelease) + .filter(v => introduced.forall(v >= _)) + .filter(current.mustBeBinCompatWith(_)) + previous.map(v => projectID.value.withRevision(v.toString)).toSet } else { Set.empty } } ) - val ReleaseTag = """^v((?:\d+\.){2}\d+)$""".r - - def previousReleases(): Seq[String] = { + def previousReleases(): List[V] = { import scala.sys.process._ - Try("git tag --list".!!.split("\n").toList.map(_.trim).collect { - case version @ ReleaseTag(_) => version - }).getOrElse(Seq.empty) + Try { + "git tag --list" + .!! + .split("\n") + .toList + .map(_.trim) + .collect { case v if v.startsWith("v") => v.substring(1) } + .collect { case V(version) => version } + }.getOrElse(List.empty) } } From 657e7d10461ee0639e8fe8b533f27d687ad665d2 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Mon, 27 Dec 2021 07:06:54 +0000 Subject: [PATCH 13/70] Start working on settings plugin --- build.sbt | 1 + .../typelevel/sbt/ScalaJSSettingsPlugin.scala | 12 +++ .../sbt/TypelevelSettingsPlugin.scala | 95 +++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala create mode 100644 settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala diff --git a/build.sbt b/build.sbt index 4c1073f6..64a1e8ee 100644 --- a/build.sbt +++ b/build.sbt @@ -31,6 +31,7 @@ lazy val settings = project .settings( name := "sbt-typelevel-settings" ) + .dependsOn(kernel) lazy val versioning = project .in(file("versioning")) diff --git a/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala new file mode 100644 index 00000000..d63d82ac --- /dev/null +++ b/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala @@ -0,0 +1,12 @@ +package org.typelevel.sbt + +import sbt._, Keys._ +import org.scalajs.sbtplugin.ScalaJSPlugin + +object ScalaJSSettingsPlugin extends AutoPlugin { + override def trigger = allRequirements + override def requires = ScalaJSPlugin + + override def projectSettings = Seq( + ) +} diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala new file mode 100644 index 00000000..24c211db --- /dev/null +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -0,0 +1,95 @@ +package org.typelevel.sbt + +import sbt._, Keys._ +import sbt.plugins.JvmPlugin +import org.typelevel.sbt.kernel.V + +object TypelevelSettingsPlugin extends AutoPlugin { + override def trigger = allRequirements + override def requires = JvmPlugin + + object autoImport { + lazy val tlIsScala3 = settingKey[Boolean]("True if building with Scala 3") + lazy val tlFatalWarningsInCI = settingKey[Boolean]( + "Convert compiler warnings into errors under CI builds (default: true)") + } + + import autoImport._ + + override def globalSettings = Seq( + tlFatalWarningsInCI := true, + Def.derive(scalaVersion := crossScalaVersions.value.last, default = true), + Def.derive(tlIsScala3 := scalaVersion.value.startsWith("3.")) + ) + + override def projectSettings = Seq( + libraryDependencies ++= { + if (tlIsScala3.value) + Nil + else + Seq( + compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"), + compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full) + ) + }, + + // Adapted from Rob Norris' post at https://tpolecat.github.io/2014/04/11/scalac-flags.html + scalacOptions ++= Seq( + "-deprecation", + "-encoding", + "UTF-8", // yes, this is 2 args + "-feature", + "-unchecked"), + scalacOptions ++= { + scalaVersion.value match { + case V(V(2, minor, _, _)) if minor < 13 => + Seq("-Yno-adapted-args", "-Ywarn-unused-import") + case _ => + Seq.empty + } + }, + scalacOptions ++= { + val warningsNsc = Seq("-Xlint", "-Ywarn-dead-code") + + val warnings211 = + Seq("-Ywarn-numeric-widen") // In 2.10 this produces a some strange spurious error + + val warnings212 = Seq("-Xlint:-unused,_") + + val removed213 = Set("-Xlint:-unused,_", "-Xlint") + val warnings213 = Seq( + "-Xlint:deprecation", + "-Wunused:nowarn", + "-Wdead-code", + "-Wextra-implicit", + "-Wnumeric-widen", + "-Wunused:implicits", + "-Wunused:explicits", + "-Wunused:imports", + "-Wunused:locals", + "-Wunused:params", + "-Wunused:patvars", + "-Wunused:privates", + "-Wvalue-discard" + ) + + val warningsDotty = Seq() + + scalaVersion.value match { + case V(V(3, _, _, _)) => + warningsDotty + + case V(V(2, minor, _, _)) if minor >= 13 => + (warnings211 ++ warnings212 ++ warnings213 ++ warningsNsc).filterNot(removed213) + + case V(V(2, minor, _, _)) if minor >= 12 => + warnings211 ++ warnings212 ++ warningsNsc + + case V(V(2, minor, _, _)) if minor >= 11 => + warnings211 ++ warningsNsc + + case _ => Seq.empty + } + } + ) +} From 069bcee10e536745a3100d2442bef72cacf06cf9 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Mon, 27 Dec 2021 07:08:14 +0000 Subject: [PATCH 14/70] ScalaJS settings depend on TL settings --- .../main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala index d63d82ac..c6bb538b 100644 --- a/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala @@ -5,7 +5,7 @@ import org.scalajs.sbtplugin.ScalaJSPlugin object ScalaJSSettingsPlugin extends AutoPlugin { override def trigger = allRequirements - override def requires = ScalaJSPlugin + override def requires = ScalaJSPlugin && TypelevelSettingsPlugin override def projectSettings = Seq( ) From f195ffb3629b75503b55053a3f74707b70c7eb1c Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 03:34:50 +0000 Subject: [PATCH 15/70] Add more settings --- .../scala/org/typelevel/sbt/kernel/V.scala | 5 ++ .../typelevel/sbt/TypelevelMimaPlugin.scala | 3 +- settings/build.sbt | 1 + .../typelevel/sbt/ScalaJSSettingsPlugin.scala | 19 +++++ .../sbt/TypelevelSettingsPlugin.scala | 78 ++++++++++++++++++- 5 files changed, 100 insertions(+), 6 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala index d448aa4e..64e63252 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -52,4 +52,9 @@ object V { Try(V(major.toInt, minor.toInt, Option(patch).map(_.toInt), Option(prerelease))).toOption case _ => None } + + object Tag { + def unapply(v: String): Option[V] = + if (v.startsWith("v")) V.unapply(v.substring(1)) else None + } } diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala index 12fd4893..a6cfab2d 100644 --- a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -51,8 +51,7 @@ object TypelevelMimaPlugin extends AutoPlugin { .split("\n") .toList .map(_.trim) - .collect { case v if v.startsWith("v") => v.substring(1) } - .collect { case V(version) => version } + .collect { case V.Tag(version) => version } }.getOrElse(List.empty) } diff --git a/settings/build.sbt b/settings/build.sbt index d6493224..706e8889 100644 --- a/settings/build.sbt +++ b/settings/build.sbt @@ -1,2 +1,3 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") diff --git a/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala index c6bb538b..449b914b 100644 --- a/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala @@ -2,11 +2,30 @@ package org.typelevel.sbt import sbt._, Keys._ import org.scalajs.sbtplugin.ScalaJSPlugin +import com.typesafe.sbt.SbtGit.git object ScalaJSSettingsPlugin extends AutoPlugin { override def trigger = allRequirements override def requires = ScalaJSPlugin && TypelevelSettingsPlugin + import TypelevelSettingsPlugin.autoImport._ + override def projectSettings = Seq( + scalacOptions ++= { + val flag = if (tlIsScala3.value) "-scalajs-mapSourceURI:" else "-P:scalajs:mapSourceURI:" + + val tagOrHash = + TypelevelSettingsPlugin.getTagOrHash(git.gitCurrentTags.value, git.gitHeadCommit.value) + + val l = (LocalRootProject / baseDirectory).value.toURI.toString + + tagOrHash.flatMap { v => + scmInfo.value.map { info => + val g = + s"${info.browseUrl.toString.replace("github.com", "raw.githubusercontent.com")}/$v/" + s"$flag$l->$g" + } + } + } ) } diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 24c211db..f13e7445 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -2,22 +2,24 @@ package org.typelevel.sbt import sbt._, Keys._ import sbt.plugins.JvmPlugin +import com.typesafe.sbt.GitPlugin +import com.typesafe.sbt.SbtGit.git import org.typelevel.sbt.kernel.V object TypelevelSettingsPlugin extends AutoPlugin { override def trigger = allRequirements - override def requires = JvmPlugin + override def requires = JvmPlugin && GitPlugin object autoImport { lazy val tlIsScala3 = settingKey[Boolean]("True if building with Scala 3") - lazy val tlFatalWarningsInCI = settingKey[Boolean]( - "Convert compiler warnings into errors under CI builds (default: true)") + lazy val tlFatalWarnings = + settingKey[Boolean]("Convert compiler warnings into errors (default: false)") } import autoImport._ override def globalSettings = Seq( - tlFatalWarningsInCI := true, + tlFatalWarnings := false, Def.derive(scalaVersion := crossScalaVersions.value.last, default = true), Def.derive(tlIsScala3 := scalaVersion.value.startsWith("3.")) ) @@ -48,6 +50,12 @@ object TypelevelSettingsPlugin extends AutoPlugin { Seq.empty } }, + scalacOptions ++= { + if (tlFatalWarnings.value) + Seq("-Xfatal-warnings") + else + Seq.empty + }, scalacOptions ++= { val warningsNsc = Seq("-Xlint", "-Ywarn-dead-code") @@ -90,6 +98,68 @@ object TypelevelSettingsPlugin extends AutoPlugin { case _ => Seq.empty } + }, + scalacOptions ++= { + if (tlIsScala3.value && crossScalaVersions.value.forall(_.startsWith("3."))) + Seq("-Ykind-projector:underscores") + else if (tlIsScala3.value) + Seq("-language:implicitConversions", "-Ykind-projector", "-source:3.0-migration") + else + Seq("-language:_") + }, + Test / scalacOptions ++= { + if (tlIsScala3.value) + Seq() + else + Seq("-Yrangepos") + }, + Compile / console / scalacOptions --= Seq( + "-Xlint", + "-Ywarn-unused-import", + "-Wextra-implicit", + "-Wunused:implicits", + "-Wunused:explicits", + "-Wunused:imports", + "-Wunused:locals", + "-Wunused:params", + "-Wunused:patvars", + "-Wunused:privates" + ), + Test / console / scalacOptions := (Compile / console / scalacOptions).value, + Compile / doc / scalacOptions ++= { + if (tlIsScala3.value) + Seq("-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath) + else { + + val tagOrHash = getTagOrHash(git.gitCurrentTags.value, git.gitHeadCommit.value) + + val infoOpt = scmInfo.value + tagOrHash.toSeq flatMap { vh => + infoOpt.toSeq flatMap { info => + val path = s"${info.browseUrl}/blob/$vh€{FILE_PATH}.scala" + Seq( + "-doc-source-url", + path, + "-sourcepath", + (LocalRootProject / baseDirectory).value.getAbsolutePath) + } + } + } + }, + javacOptions ++= Seq( + "-encoding", + "utf8", + "-Xlint:all" + ), + javacOptions ++= { + if (tlFatalWarnings.value) + Seq("-Werror") + else + Seq.empty } ) + + def getTagOrHash(tags: Seq[String], hash: Option[String]): Option[String] = + tags.collect { case v @ V.Tag(_) => v }.headOption.orElse(hash) + } From b87e2d6c4f26f31f5b8698de0b60cf3f612d0d58 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 03:37:39 +0000 Subject: [PATCH 16/70] Bump sbt, setup scalafmt --- .../scala/org/typelevel/sbt/TypelevelMimaPlugin.scala | 9 +++------ project/build.properties | 2 +- project/plugins.sbt | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 project/plugins.sbt diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala index a6cfab2d..d6dc83e1 100644 --- a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -46,12 +46,9 @@ object TypelevelMimaPlugin extends AutoPlugin { def previousReleases(): List[V] = { import scala.sys.process._ Try { - "git tag --list" - .!! - .split("\n") - .toList - .map(_.trim) - .collect { case V.Tag(version) => version } + "git tag --list".!!.split("\n").toList.map(_.trim).collect { + case V.Tag(version) => version + } }.getOrElse(List.empty) } diff --git a/project/build.properties b/project/build.properties index e64c208f..1e70b0c1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.8 +sbt.version=1.6.0 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 00000000..2cc2e826 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") From 135f0c06c0528ebd60ef734f70a249191753812d Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 03:52:34 +0000 Subject: [PATCH 17/70] Setup ScmInfo setting --- .../sbt/TypelevelSettingsPlugin.scala | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index f13e7445..2be480e9 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -6,6 +6,8 @@ import com.typesafe.sbt.GitPlugin import com.typesafe.sbt.SbtGit.git import org.typelevel.sbt.kernel.V +import scala.util.Try + object TypelevelSettingsPlugin extends AutoPlugin { override def trigger = allRequirements override def requires = JvmPlugin && GitPlugin @@ -24,6 +26,10 @@ object TypelevelSettingsPlugin extends AutoPlugin { Def.derive(tlIsScala3 := scalaVersion.value.startsWith("3.")) ) + override def buildSettings = Seq( + scmInfo := getScmInfo() + ) + override def projectSettings = Seq( libraryDependencies ++= { if (tlIsScala3.value) @@ -162,4 +168,24 @@ object TypelevelSettingsPlugin extends AutoPlugin { def getTagOrHash(tags: Seq[String], hash: Option[String]): Option[String] = tags.collect { case v @ V.Tag(_) => v }.headOption.orElse(hash) + def getScmInfo(): Option[ScmInfo] = { + import scala.sys.process._ + + val identifier = """([^\/]+)""" + + val GitHubHttps = s"https://github.com/$identifier/$identifier".r + val SSHConnection = s"git@github.com:$identifier/$identifier.git".r + + Try(List("git", "ls-remote", "--get-url", "origin").!!.trim()) + .collect { + case GitHubHttps(user, repo) => (user, repo) + case SSHConnection(user, repo) => (user, repo) + } + .map { + case (user, repo) => + ScmInfo(url(s"https://github.com/$user/$repo"), s"git@github.com:$user/$repo.git") + } + .toOption + } + } From 0fdd4537bd5c27586d8d690ad1cb83a629cac06d Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 04:09:31 +0000 Subject: [PATCH 18/70] Use V model for versioning plugin --- build.sbt | 1 + .../scala/org/typelevel/sbt/VersioningPlugin.scala | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 64a1e8ee..587c5edb 100644 --- a/build.sbt +++ b/build.sbt @@ -39,6 +39,7 @@ lazy val versioning = project .settings( name := "sbt-typelevel-versioning" ) + .dependsOn(kernel) lazy val mima = project .in(file("mima")) diff --git a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala index 54b44456..f466be80 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala @@ -3,6 +3,7 @@ package org.typelevel.sbt import sbt._, Keys._ import com.typesafe.sbt.GitPlugin import com.typesafe.sbt.SbtGit.git +import org.typelevel.sbt.kernel.V object VersioningPlugin extends AutoPlugin { @@ -18,17 +19,15 @@ object VersioningPlugin extends AutoPlugin { import autoImport._ - val ReleaseTag = """^v((?:\d+\.){2}\d+(?:-.*)?)$""".r - override def buildSettings: Seq[Setting[_]] = Seq( tlHashSnapshots := true, isSnapshot := { - val isVersionTagged = findVersionTag(git.gitCurrentTags.value).isDefined + val isVersionTagged = getTaggedVersion(git.gitCurrentTags.value).isDefined val dirty = git.gitUncommittedChanges.value !isVersionTagged && (tlHashSnapshots.value || dirty) }, version := { - val taggedVersion = git.gitCurrentTags.value.find(ReleaseTag.unapplySeq(_).isDefined) + val taggedVersion = getTaggedVersion(git.gitCurrentTags.value) taggedVersion.getOrElse { var version = tlBaseVersion.value git.gitHeadCommit.value.foreach { sha => version += s"-${sha.take(7)}" } @@ -45,7 +44,7 @@ object VersioningPlugin extends AutoPlugin { } ) - def findVersionTag(tags: Seq[String]): Option[String] = - tags.find(ReleaseTag.unapplySeq(_).isDefined) + def getTaggedVersion(tags: Seq[String]): Option[String] = + tags.collect { case v @ V.Tag(_) => v }.headOption } From cc1acda8f82f791bd369439dd007f825da5021b5 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 04:31:34 +0000 Subject: [PATCH 19/70] Distance-based versioning --- .../org/typelevel/sbt/VersioningPlugin.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala index f466be80..1c15098b 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala @@ -5,6 +5,8 @@ import com.typesafe.sbt.GitPlugin import com.typesafe.sbt.SbtGit.git import org.typelevel.sbt.kernel.V +import scala.util.Try + object VersioningPlugin extends AutoPlugin { override def requires = GitPlugin @@ -27,9 +29,21 @@ object VersioningPlugin extends AutoPlugin { !isVersionTagged && (tlHashSnapshots.value || dirty) }, version := { + import scala.sys.process._ + val taggedVersion = getTaggedVersion(git.gitCurrentTags.value) taggedVersion.getOrElse { var version = tlBaseVersion.value + + // Looks for the distance to the first stable release in this series + val firstInSeries = V + .unapply(tlBaseVersion.value) + .map(_.copy(patch = Some(0), prerelease = None)) + .getOrElse(sys.error(s"tlBaseVersion must be semver format: ${tlBaseVersion.value}")) + Try(s"git describe --tags --match v$firstInSeries".!!.trim) + .collect { case Description(distance) => distance } + .foreach { distance => version += s"-$distance" } + git.gitHeadCommit.value.foreach { sha => version += s"-${sha.take(7)}" } if (git.gitUncommittedChanges.value) { import java.time.Instant @@ -44,6 +58,8 @@ object VersioningPlugin extends AutoPlugin { } ) + val Description = """^.*-(\d+)-[a-zA-Z0-9]+$""".r + def getTaggedVersion(tags: Seq[String]): Option[String] = tags.collect { case v @ V.Tag(_) => v }.headOption From f0eafbed30690361446400d87bc3b2ed563a0bee Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 05:15:27 +0000 Subject: [PATCH 20/70] Setup sonatype plugin --- build.sbt | 7 +++ project/sonatype.sbt | 1 + project/src/main/scala/sonatype | 1 + sonatype/build.sbt | 2 + .../sbt/TypelevelSonatypePlugin.scala | 46 +++++++++++++++++++ 5 files changed, 57 insertions(+) create mode 120000 project/sonatype.sbt create mode 120000 project/src/main/scala/sonatype create mode 100644 sonatype/build.sbt create mode 100644 sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala diff --git a/build.sbt b/build.sbt index 587c5edb..d08d64e5 100644 --- a/build.sbt +++ b/build.sbt @@ -48,3 +48,10 @@ lazy val mima = project name := "sbt-typelevel-mima" ) .dependsOn(kernel) + +lazy val sonatype = project + .in(file("sonatype")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-sonatype" + ) diff --git a/project/sonatype.sbt b/project/sonatype.sbt new file mode 120000 index 00000000..57e7883a --- /dev/null +++ b/project/sonatype.sbt @@ -0,0 +1 @@ +../sonatype/build.sbt \ No newline at end of file diff --git a/project/src/main/scala/sonatype b/project/src/main/scala/sonatype new file mode 120000 index 00000000..e9c3776f --- /dev/null +++ b/project/src/main/scala/sonatype @@ -0,0 +1 @@ +../../../../sonatype/ \ No newline at end of file diff --git a/sonatype/build.sbt b/sonatype/build.sbt new file mode 100644 index 00000000..b0194993 --- /dev/null +++ b/sonatype/build.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10") diff --git a/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala b/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala new file mode 100644 index 00000000..04d439f3 --- /dev/null +++ b/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala @@ -0,0 +1,46 @@ +package org.typelevel.sbt + +import sbt._, Keys._ +import com.typesafe.tools.mima.plugin.MimaPlugin +import xerial.sbt.Sonatype, Sonatype.autoImport._ + +object TypelevelSonatypePlugin extends AutoPlugin { + + override def requires = MimaPlugin && Sonatype + + override def trigger = allRequirements + + object autoImport { + lazy val tlSonatypeUseLegacyHost = + settingKey[Boolean]("Publish to oss.sonatype.org instead of s01") + } + + import autoImport._ + + override def buildSettings = + Seq(tlSonatypeUseLegacyHost := false) ++ + addCommandAlias( + "release", + "; reload; project /; +mimaReportBinaryIssues; +publish; sonatypeBundleReleaseIfRelevant") + + override def projectSettings = Seq( + publishMavenStyle := true, // we want to do this unconditionally, even if publishing a plugin + sonatypeProfileName := organization.value, + publishTo := sonatypePublishToBundle.value, + commands += sonatypeBundleReleaseIfRelevant, + sonatypeCredentialHost := { + if (tlSonatypeUseLegacyHost.value) + "oss.sonatype.org" + else + "s01.oss.sonatype.org" + } + ) + + private def sonatypeBundleReleaseIfRelevant: Command = + Command.command("sonatypeBundleReleaseIfRelevant") { state => + if (!state.getSetting(isSnapshot).getOrElse(false)) + Command.process("sonatypeBundleRelease", state) + else + state + } +} From 2a1b5eb473c5eec7092386a8417e97bb99ca452c Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 05:21:37 +0000 Subject: [PATCH 21/70] Clarify bundle release logic --- .../scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala b/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala index 04d439f3..22fb670c 100644 --- a/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala +++ b/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala @@ -38,9 +38,9 @@ object TypelevelSonatypePlugin extends AutoPlugin { private def sonatypeBundleReleaseIfRelevant: Command = Command.command("sonatypeBundleReleaseIfRelevant") { state => - if (!state.getSetting(isSnapshot).getOrElse(false)) + if (state.getSetting(isSnapshot).getOrElse(false)) + state // a snapshot is good-to-go + else // a non-snapshot releases as a bundle Command.process("sonatypeBundleRelease", state) - else - state } } From 90b37cbe376b6cc29cb1dafc4f8b3a2d87cd612b Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 06:07:04 +0000 Subject: [PATCH 22/70] Setup ci-release plugin --- build.sbt | 8 ++++ ci-release/build.sbt | 1 + .../sbt/TypelevelCiReleasePlugin.scala | 44 +++++++++++++++++++ project/ci-release.sbt | 1 + project/src/main/scala/ci-release | 1 + 5 files changed, 55 insertions(+) create mode 100644 ci-release/build.sbt create mode 100644 ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala create mode 120000 project/ci-release.sbt create mode 120000 project/src/main/scala/ci-release diff --git a/build.sbt b/build.sbt index d08d64e5..17ce0077 100644 --- a/build.sbt +++ b/build.sbt @@ -55,3 +55,11 @@ lazy val sonatype = project .settings( name := "sbt-typelevel-sonatype" ) + +lazy val ciRelease = project + .in(file("ci-release")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-ci-release" + ) + .dependsOn(sonatype) diff --git a/ci-release/build.sbt b/ci-release/build.sbt new file mode 100644 index 00000000..ab75c56b --- /dev/null +++ b/ci-release/build.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2") diff --git a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala new file mode 100644 index 00000000..cbf5e7bd --- /dev/null +++ b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala @@ -0,0 +1,44 @@ +package org.typelevel.sbt + +import sbt._, Keys._ +import sbtghactions.GenerativePlugin +import sbtghactions.GitHubActionsPlugin +import sbtghactions.GenerativePlugin.autoImport._ + +object TypelevelCiReleasePlugin extends AutoPlugin { + + object autoImport { + lazy val tlCiReleaseSnapshots = settingKey[Boolean]( + "Controls whether or not snapshots should be released (default: false)") + lazy val tlCiReleaseBranches = + settingKey[Seq[String]]("The branches in your repository to release from (default: [])") + } + + import autoImport._ + + override def requires = TypelevelSonatypePlugin && GitHubActionsPlugin && + GenerativePlugin + + override def trigger = noTrigger + + override def globalSettings = + Seq(tlCiReleaseSnapshots := false, tlCiReleaseBranches := Seq()) + + override def buildSettings = Seq( + githubWorkflowEnv ++= Map( + "SONATYPE_USERNAME" -> "$${{ secrets.SONATYPE_USERNAME }}", + "SONATYPE_PASSWORD" -> "$${{ secrets.SONATYPE_PASSWORD }}" + ), + githubWorkflowPublishTargetBranches := { + val seed = + if (tlCiReleaseSnapshots.value) + tlCiReleaseBranches.value.map(b => RefPredicate.Equals(Ref.Branch(b))) + else + Seq.empty + + RefPredicate.StartsWith(Ref.Tag("v")) +: seed + }, + githubWorkflowTargetTags += "v*", + githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("release"))) + ) +} diff --git a/project/ci-release.sbt b/project/ci-release.sbt new file mode 120000 index 00000000..3ffbfbd5 --- /dev/null +++ b/project/ci-release.sbt @@ -0,0 +1 @@ +../ci-release/build.sbt \ No newline at end of file diff --git a/project/src/main/scala/ci-release b/project/src/main/scala/ci-release new file mode 120000 index 00000000..dea107a2 --- /dev/null +++ b/project/src/main/scala/ci-release @@ -0,0 +1 @@ +../../../../ci-release/ \ No newline at end of file From 74ed1fc696492c039b9de045495ff580cc3e0975 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 06:15:57 +0000 Subject: [PATCH 23/70] Supppress warnings --- .../scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala index cbf5e7bd..2c2e68a1 100644 --- a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala +++ b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala @@ -26,8 +26,8 @@ object TypelevelCiReleasePlugin extends AutoPlugin { override def buildSettings = Seq( githubWorkflowEnv ++= Map( - "SONATYPE_USERNAME" -> "$${{ secrets.SONATYPE_USERNAME }}", - "SONATYPE_PASSWORD" -> "$${{ secrets.SONATYPE_PASSWORD }}" + "SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}", + "SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}" ), githubWorkflowPublishTargetBranches := { val seed = From 5d8cfedd01e8fd6accd707005b92cec508d8fe21 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 06:42:05 +0000 Subject: [PATCH 24/70] Add failsafe for tag/push double-publish --- .../org/typelevel/sbt/TypelevelCiReleasePlugin.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala index 2c2e68a1..6406b12b 100644 --- a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala +++ b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala @@ -1,6 +1,6 @@ package org.typelevel.sbt -import sbt._, Keys._ +import sbt._ import sbtghactions.GenerativePlugin import sbtghactions.GitHubActionsPlugin import sbtghactions.GenerativePlugin.autoImport._ @@ -39,6 +39,12 @@ object TypelevelCiReleasePlugin extends AutoPlugin { RefPredicate.StartsWith(Ref.Tag("v")) +: seed }, githubWorkflowTargetTags += "v*", - githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("release"))) + githubWorkflowPublish := Seq( + WorkflowStep.Sbt( + List("release"), + cond = Some( // NEVER release a tag on a non-tag workflow run + "(startsWith(github.ref, 'refs/tags/v') && github.ref_type == 'tag') || (!startsWith(github.ref, 'refs/tags/v') && github.ref_type != 'tag')") + ) + ) ) } From ef3fa087acbe176a149210484f40cd48d69452ef Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 07:38:23 +0000 Subject: [PATCH 25/70] Setup ci-signing plugin --- build.sbt | 7 +++ ci-signing/build.sbt | 2 + .../sbt/TypelevelCiSigningPlugin.scala | 44 +++++++++++++++++++ project/ci-signing.sbt | 1 + project/src/main/scala/ci-signing | 1 + 5 files changed, 55 insertions(+) create mode 100644 ci-signing/build.sbt create mode 100644 ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala create mode 120000 project/ci-signing.sbt create mode 120000 project/src/main/scala/ci-signing diff --git a/build.sbt b/build.sbt index 17ce0077..8c213d2a 100644 --- a/build.sbt +++ b/build.sbt @@ -56,6 +56,13 @@ lazy val sonatype = project name := "sbt-typelevel-sonatype" ) +lazy val ciSigning = project + .in(file("ci-signing")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-ci-signing" + ) + lazy val ciRelease = project .in(file("ci-release")) .enablePlugins(SbtPlugin) diff --git a/ci-signing/build.sbt b/ci-signing/build.sbt new file mode 100644 index 00000000..96ab3dff --- /dev/null +++ b/ci-signing/build.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2") +addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.2.1") diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala new file mode 100644 index 00000000..654f3aa3 --- /dev/null +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -0,0 +1,44 @@ +package org.typelevel.sbt + +import io.crashbox.gpg.SbtGpg +import sbt._, Keys._ +import sbtghactions.GenerativePlugin +import sbtghactions.GitHubActionsPlugin +import sbtghactions.GenerativePlugin.autoImport._ + +object TypelevelCiSigningPlugin extends AutoPlugin { + + override def requires = SbtGpg && GitHubActionsPlugin && GenerativePlugin + + override def trigger = noTrigger + + override def buildSettings = Seq( + githubWorkflowEnv ++= Map( + "PGP_SECRET" -> s"$${{ secrets.PGP_SECRET }}", + "PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}" + ), + githubWorkflowPublishPreamble ++= Seq( + WorkflowStep.Run( // if your key is not passphrase-protected + List("echo $PGP_SECRET | base64 -d | gpg --import"), + name = Some("Directly import signing key"), + cond = Some("env.PGP_PASSPHRASE == ''") + ), + WorkflowStep.Run( // if your key is passphrase protected + List( + "echo \"$PGP_SECRET\" | base64 -d > /tmp/signing-key.gpg", + "echo \"$PGP_PASSPHRASE\" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg", + "(echo \"$PGP_PASSPHRASE\"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase 5EBC14B0F6C55083" // TODO + ), + name = Some("Import signing key and strip passphrase"), + cond = Some("env.PGP_PASSPHRASE != ''") + ) + ) + ) + + import SbtGpg.autoImport._ + + override def projectSettings = Seq( + gpgWarnOnFailure := isSnapshot.value + ) + +} diff --git a/project/ci-signing.sbt b/project/ci-signing.sbt new file mode 120000 index 00000000..9cc62472 --- /dev/null +++ b/project/ci-signing.sbt @@ -0,0 +1 @@ +../ci-signing/build.sbt \ No newline at end of file diff --git a/project/src/main/scala/ci-signing b/project/src/main/scala/ci-signing new file mode 120000 index 00000000..9e9458ee --- /dev/null +++ b/project/src/main/scala/ci-signing @@ -0,0 +1 @@ +../../../../ci-signing/ \ No newline at end of file From df391739d28ff4c324bf96c6a64d14266ed0a1c1 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:00:26 +0000 Subject: [PATCH 26/70] Create CI plugin --- build.sbt | 7 +++++ ci/build.sbt | 2 ++ .../org/typelevel/sbt/TypelevelCiPlugin.scala | 30 +++++++++++++++++++ project/ci.sbt | 1 + project/src/main/scala/ci | 1 + 5 files changed, 41 insertions(+) create mode 100644 ci/build.sbt create mode 100644 ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala create mode 120000 project/ci.sbt create mode 120000 project/src/main/scala/ci diff --git a/build.sbt b/build.sbt index 8c213d2a..d2b98d3f 100644 --- a/build.sbt +++ b/build.sbt @@ -70,3 +70,10 @@ lazy val ciRelease = project name := "sbt-typelevel-ci-release" ) .dependsOn(sonatype) + +lazy val ci = project + .in(file("ci")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-ci" + ) diff --git a/ci/build.sbt b/ci/build.sbt new file mode 100644 index 00000000..9ccb5879 --- /dev/null +++ b/ci/build.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala new file mode 100644 index 00000000..27bf8511 --- /dev/null +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -0,0 +1,30 @@ +package org.typelevel.sbt + +import sbt._, Keys._ +import sbtghactions.GenerativePlugin +import sbtghactions.GitHubActionsPlugin +import sbtghactions.GenerativePlugin.autoImport._ +import com.typesafe.tools.mima.plugin.MimaPlugin + +object TypelevelCiPlugin extends AutoPlugin { + + override def requires = GitHubActionsPlugin && GenerativePlugin && MimaPlugin + override def trigger = allRequirements + + object autoImport {} + + override def buildSettings = + addCommandAlias( + "ci", + List( + "project /", + "clean", + "test", + "mimaReportBinaryIssues" + ).mkString("; ", "; ", "") + ) ++ addCommandAlias("releaseLocal", "; reload; project /; +publishLocal") ++ Seq( + githubWorkflowPublishTargetBranches := Seq(), + githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("ci"))) + ) + +} diff --git a/project/ci.sbt b/project/ci.sbt new file mode 120000 index 00000000..c9171244 --- /dev/null +++ b/project/ci.sbt @@ -0,0 +1 @@ +../ci/build.sbt \ No newline at end of file diff --git a/project/src/main/scala/ci b/project/src/main/scala/ci new file mode 120000 index 00000000..12eb411b --- /dev/null +++ b/project/src/main/scala/ci @@ -0,0 +1 @@ +../../../../ci/ \ No newline at end of file From f87c5ca62e9c081921a9f75341937b5a7b2f4378 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:01:38 +0000 Subject: [PATCH 27/70] Version scheme is early-semver --- .../main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 2be480e9..c3615eb1 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -31,6 +31,8 @@ object TypelevelSettingsPlugin extends AutoPlugin { ) override def projectSettings = Seq( + versionScheme := Some("early-semver"), + libraryDependencies ++= { if (tlIsScala3.value) Nil From de610abb6f443967b304dfcb2de87f89de39fa09 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:05:47 +0000 Subject: [PATCH 28/70] Generate workflow --- .github/workflows/ci.yml | 56 ++++++++++++++++++ .github/workflows/clean.yml | 59 +++++++++++++++++++ build.sbt | 1 - .../org/typelevel/sbt/TypelevelCiPlugin.scala | 5 +- 4 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/clean.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..08c90252 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,56 @@ +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Continuous Integration + +on: + pull_request: + branches: ['**'] + push: + branches: ['**'] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + name: Build and Test + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.12.15] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 8 + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Check that workflows are up to date + run: sbt ++${{ matrix.scala }} githubWorkflowCheck + + - run: sbt ++${{ matrix.scala }} ci diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 00000000..547aaa43 --- /dev/null +++ b/.github/workflows/clean.yml @@ -0,0 +1,59 @@ +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Clean + +on: push + +jobs: + delete-artifacts: + name: Delete Artifacts + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Delete artifacts + run: | + # Customize those three lines with your repository and credentials: + REPO=${GITHUB_API_URL}/repos/${{ github.repository }} + + # A shortcut to call GitHub API. + ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; } + + # A temporary file which receives HTTP response headers. + TMPFILE=/tmp/tmp.$$ + + # An associative array, key: artifact name, value: number of artifacts of that name. + declare -A ARTCOUNT + + # Process all artifacts on this repository, loop on returned "pages". + URL=$REPO/actions/artifacts + while [[ -n "$URL" ]]; do + + # Get current page, get response headers in a temporary file. + JSON=$(ghapi --dump-header $TMPFILE "$URL") + + # Get URL of next page. Will be empty if we are at the last page. + URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*.*//') + rm -f $TMPFILE + + # Number of artifacts on this page: + COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') )) + + # Loop on all artifacts on this page. + for ((i=0; $i < $COUNT; i++)); do + + # Get name of artifact and count instances of this name. + name=$(jq <<<$JSON -r ".artifacts[$i].name?") + ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1)) + + id=$(jq <<<$JSON -r ".artifacts[$i].id?") + size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") )) + printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size + ghapi -X DELETE $REPO/actions/artifacts/$id + done + done diff --git a/build.sbt b/build.sbt index d2b98d3f..29ad9714 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,6 @@ name := "sbt-typelevel" ThisBuild / tlBaseVersion := "0.4" -ThisBuild / versionScheme := Some("early-semver") ThisBuild / organization := "org.typelevel" ThisBuild / organizationName := "Typelevel" diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index 27bf8511..9525248e 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -11,8 +11,6 @@ object TypelevelCiPlugin extends AutoPlugin { override def requires = GitHubActionsPlugin && GenerativePlugin && MimaPlugin override def trigger = allRequirements - object autoImport {} - override def buildSettings = addCommandAlias( "ci", @@ -24,7 +22,8 @@ object TypelevelCiPlugin extends AutoPlugin { ).mkString("; ", "; ", "") ) ++ addCommandAlias("releaseLocal", "; reload; project /; +publishLocal") ++ Seq( githubWorkflowPublishTargetBranches := Seq(), - githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("ci"))) + githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("ci"))), + githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")) ) } From 93e4d7b0cc8f7a2b36641207dd3f07f2fc592dc2 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:11:05 +0000 Subject: [PATCH 29/70] Bikeshedding --- ...ettingsPlugin.scala => TypelevelScalaJSSettingsPlugin.scala} | 2 +- .../{VersioningPlugin.scala => TypelevelVersioningPlugin.scala} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename settings/src/main/scala/org/typelevel/sbt/{ScalaJSSettingsPlugin.scala => TypelevelScalaJSSettingsPlugin.scala} (93%) rename versioning/src/main/scala/org/typelevel/sbt/{VersioningPlugin.scala => TypelevelVersioningPlugin.scala} (97%) diff --git a/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala similarity index 93% rename from settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala rename to settings/src/main/scala/org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala index 449b914b..cc66ee25 100644 --- a/settings/src/main/scala/org/typelevel/sbt/ScalaJSSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala @@ -4,7 +4,7 @@ import sbt._, Keys._ import org.scalajs.sbtplugin.ScalaJSPlugin import com.typesafe.sbt.SbtGit.git -object ScalaJSSettingsPlugin extends AutoPlugin { +object TypelevelScalaJSSettingsPlugin extends AutoPlugin { override def trigger = allRequirements override def requires = ScalaJSPlugin && TypelevelSettingsPlugin diff --git a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala similarity index 97% rename from versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala rename to versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala index 1c15098b..10181f97 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/VersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala @@ -7,7 +7,7 @@ import org.typelevel.sbt.kernel.V import scala.util.Try -object VersioningPlugin extends AutoPlugin { +object TypelevelVersioningPlugin extends AutoPlugin { override def requires = GitPlugin override def trigger = allRequirements From 5ad198e5d091e4d573afb88a7f7f958dfb463520 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:18:32 +0000 Subject: [PATCH 30/70] Create kernel plugin --- build.sbt | 1 + .../typelevel/sbt/TypelevelKernelPlugin.scala | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala diff --git a/build.sbt b/build.sbt index 29ad9714..62c7e783 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,7 @@ lazy val root = project lazy val kernel = project .in(file("kernel")) + .enablePlugins(SbtPlugin) .settings( name := "sbt-typelevel-kernel" ) diff --git a/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala b/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala new file mode 100644 index 00000000..1810ed10 --- /dev/null +++ b/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala @@ -0,0 +1,19 @@ +package org.typelevel.sbt + +import sbt._, Keys._ + +object TypelevelKernelPlugin extends AutoPlugin { + + override def requires = sbt.plugins.CorePlugin + override def trigger = allRequirements + + object autoImport { + def replaceCommandAlias(name: String, contents: String): Seq[Setting[State => State]] = + Seq(GlobalScope / onLoad ~= { (f: State => State) => + f andThen { s: State => + BasicCommands.addAlias(BasicCommands.removeAlias(s, name), name, contents) + } + }) + } + +} From a19234989c35e644824749f3181e415061a329f6 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:35:19 +0000 Subject: [PATCH 31/70] Create TypelevelPlugin --- build.sbt | 17 +++++++++++ .../org/typelevel/sbt/TypelevelPlugin.scala | 30 +++++++++++++++++++ project/src/main/scala/core | 1 + 3 files changed, 48 insertions(+) create mode 100644 core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala create mode 120000 project/src/main/scala/core diff --git a/build.sbt b/build.sbt index 62c7e783..508618f6 100644 --- a/build.sbt +++ b/build.sbt @@ -77,3 +77,20 @@ lazy val ci = project .settings( name := "sbt-typelevel-ci" ) + +lazy val core = project + .in(file("core")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel" + ) + .dependsOn( + noPublish, + settings, + versioning, + mima, + sonatype, + ciSigning, + ciRelease, + ci + ) diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala new file mode 100644 index 00000000..6cbd4321 --- /dev/null +++ b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala @@ -0,0 +1,30 @@ +package org.typelevel.sbt + +import sbt._ +import sbtghactions.GitHubActionsPlugin + +object TypelevelPlugin extends AutoPlugin { + + override def requires = + TypelevelKernelPlugin && TypelevelSettingsPlugin && TypelevelVersioningPlugin && TypelevelMimaPlugin && TypelevelCiPlugin && GitHubActionsPlugin + + override def trigger = allRequirements + + object autoImport { + lazy val tlFatalWarningsInCi = settingKey[Boolean]( + "Convert compiler warnings into errors under CI builds (default: true)") + } + + import autoImport._ + import TypelevelSettingsPlugin.autoImport._ + import GitHubActionsPlugin.autoImport._ + + override def globalSettings = Seq( + tlFatalWarningsInCi := true + ) + + override def buildSettings = Seq( + Def.derive(tlFatalWarnings := (tlFatalWarningsInCi.value && githubIsWorkflowBuild.value)) + ) + +} diff --git a/project/src/main/scala/core b/project/src/main/scala/core new file mode 120000 index 00000000..80bce703 --- /dev/null +++ b/project/src/main/scala/core @@ -0,0 +1 @@ +../../../../core/ \ No newline at end of file From 8b18a8660792c0ea29441f6edcfaeb2ac7fb8a6f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:39:46 +0000 Subject: [PATCH 32/70] Relocate isScala3 setting --- .../scala/org/typelevel/sbt/TypelevelKernelPlugin.scala | 7 +++++++ .../org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala | 2 +- .../scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 3 +-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala b/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala index 1810ed10..791479c7 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala @@ -8,6 +8,7 @@ object TypelevelKernelPlugin extends AutoPlugin { override def trigger = allRequirements object autoImport { + lazy val tlIsScala3 = settingKey[Boolean]("True if building with Scala 3") def replaceCommandAlias(name: String, contents: String): Seq[Setting[State => State]] = Seq(GlobalScope / onLoad ~= { (f: State => State) => f andThen { s: State => @@ -16,4 +17,10 @@ object TypelevelKernelPlugin extends AutoPlugin { }) } + import autoImport._ + + override def globalSettings = Seq( + Def.derive(tlIsScala3 := scalaVersion.value.startsWith("3.")) + ) + } diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala index cc66ee25..6abbbf92 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelScalaJSSettingsPlugin.scala @@ -8,7 +8,7 @@ object TypelevelScalaJSSettingsPlugin extends AutoPlugin { override def trigger = allRequirements override def requires = ScalaJSPlugin && TypelevelSettingsPlugin - import TypelevelSettingsPlugin.autoImport._ + import TypelevelKernelPlugin.autoImport._ override def projectSettings = Seq( scalacOptions ++= { diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index c3615eb1..83577167 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -13,17 +13,16 @@ object TypelevelSettingsPlugin extends AutoPlugin { override def requires = JvmPlugin && GitPlugin object autoImport { - lazy val tlIsScala3 = settingKey[Boolean]("True if building with Scala 3") lazy val tlFatalWarnings = settingKey[Boolean]("Convert compiler warnings into errors (default: false)") } import autoImport._ + import TypelevelKernelPlugin.autoImport._ override def globalSettings = Seq( tlFatalWarnings := false, Def.derive(scalaVersion := crossScalaVersions.value.last, default = true), - Def.derive(tlIsScala3 := scalaVersion.value.startsWith("3.")) ) override def buildSettings = Seq( From db0202bdae87571a9c43a0bb129ea615273802cb Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:42:11 +0000 Subject: [PATCH 33/70] Don't import non-existent keys --- .../scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index 654f3aa3..73700db7 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -21,7 +21,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { WorkflowStep.Run( // if your key is not passphrase-protected List("echo $PGP_SECRET | base64 -d | gpg --import"), name = Some("Directly import signing key"), - cond = Some("env.PGP_PASSPHRASE == ''") + cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''") ), WorkflowStep.Run( // if your key is passphrase protected List( @@ -30,7 +30,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { "(echo \"$PGP_PASSPHRASE\"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase 5EBC14B0F6C55083" // TODO ), name = Some("Import signing key and strip passphrase"), - cond = Some("env.PGP_PASSPHRASE != ''") + cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''") ) ) ) From d43feb51c2613e1794773fe42e533e960d5ac853 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:49:40 +0000 Subject: [PATCH 34/70] Setup snapshot publishing? --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ build.sbt | 9 ++++-- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08c90252..9313ed2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,12 @@ on: branches: ['**'] push: branches: ['**'] + tags: [v*] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} jobs: build: @@ -54,3 +57,60 @@ jobs: run: sbt ++${{ matrix.scala }} githubWorkflowCheck - run: sbt ++${{ matrix.scala }} ci + + - name: Compress target directories + run: tar cf targets.tar kernel/target versioning/target ci-release/target target ci-signing/target mima/target no-publish/target sonatype/target ci/target core/target settings/target project/target + + - name: Upload target directories + uses: actions/upload-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }} + path: targets.tar + + publish: + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/series/armanbilge') + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.12.15] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 8 + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Download target directories (2.12.15) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-2.12.15-${{ matrix.java }} + + - name: Inflate target directories (2.12.15) + run: | + tar xf targets.tar + rm targets.tar + + - if: (startsWith(github.ref, 'refs/tags/v') && github.ref_type == 'tag') || (!startsWith(github.ref, 'refs/tags/v') && github.ref_type != 'tag') + run: sbt ++${{ matrix.scala }} release diff --git a/build.sbt b/build.sbt index 508618f6..e963073e 100644 --- a/build.sbt +++ b/build.sbt @@ -1,15 +1,20 @@ name := "sbt-typelevel" ThisBuild / tlBaseVersion := "0.4" -ThisBuild / organization := "org.typelevel" +// ThisBuild / organization := "org.typelevel" +ThisBuild / organization := "com.armanbilge" ThisBuild / organizationName := "Typelevel" ThisBuild / scalaVersion := "2.12.15" +enablePlugins(TypelevelCiReleasePlugin) +ThisBuild / tlCiReleaseSnapshots := true +ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") + lazy val root = project .in(file(".")) .enablePlugins(NoPublishPlugin) - .aggregate(kernel, noPublish, settings, versioning, mima) + .aggregate(kernel, noPublish, settings, versioning, mima, sonatype, ciSigning, ciRelease, ci, core) lazy val kernel = project .in(file("kernel")) From dc28ec1069f34cdbfb9032c73b7860bc11d65072 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 08:52:34 +0000 Subject: [PATCH 35/70] Remove unused import --- ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index 9525248e..d6606ec3 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -1,6 +1,6 @@ package org.typelevel.sbt -import sbt._, Keys._ +import sbt._ import sbtghactions.GenerativePlugin import sbtghactions.GitHubActionsPlugin import sbtghactions.GenerativePlugin.autoImport._ From f2510a89d7558f50ac43f4acd69acd3a4fc898b2 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 09:11:19 +0000 Subject: [PATCH 36/70] Ci release plugin refactoring --- .github/workflows/ci.yml | 19 +++++++++++++++--- build.sbt | 20 ++++++++++++++----- .../sbt/TypelevelCiReleasePlugin.scala | 12 +++++++++++ project/ci-release.sbt | 1 - project/sonatype-ci-release.sbt | 1 + project/src/main/scala/ci-release | 1 - project/src/main/scala/sonatype-ci-release | 1 + {ci-release => sonatype-ci-release}/build.sbt | 0 .../TypelevelSonatypeCiReleasePlugin.scala | 2 +- 9 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 core/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala delete mode 120000 project/ci-release.sbt create mode 120000 project/sonatype-ci-release.sbt delete mode 120000 project/src/main/scala/ci-release create mode 120000 project/src/main/scala/sonatype-ci-release rename {ci-release => sonatype-ci-release}/build.sbt (100%) rename ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala => sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala (96%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9313ed2c..d729bada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,11 @@ on: tags: [v*] env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: build: @@ -59,7 +61,7 @@ jobs: - run: sbt ++${{ matrix.scala }} ci - name: Compress target directories - run: tar cf targets.tar kernel/target versioning/target ci-release/target target ci-signing/target mima/target no-publish/target sonatype/target ci/target core/target settings/target project/target + run: tar cf targets.tar kernel/target versioning/target target ci-signing/target mima/target no-publish/target sonatype/target ci/target sonatype-ci-release/target core/target settings/target project/target - name: Upload target directories uses: actions/upload-artifact@v2 @@ -112,5 +114,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Directly import signing key + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' + run: echo $PGP_SECRET | base64 -d | gpg --import + + - name: Import signing key and strip passphrase + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + run: | + echo "$PGP_SECRET" | base64 -d > /tmp/signing-key.gpg + echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg + (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase 5EBC14B0F6C55083 + - if: (startsWith(github.ref, 'refs/tags/v') && github.ref_type == 'tag') || (!startsWith(github.ref, 'refs/tags/v') && github.ref_type != 'tag') run: sbt ++${{ matrix.scala }} release diff --git a/build.sbt b/build.sbt index e963073e..0885c542 100644 --- a/build.sbt +++ b/build.sbt @@ -14,7 +14,17 @@ ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") lazy val root = project .in(file(".")) .enablePlugins(NoPublishPlugin) - .aggregate(kernel, noPublish, settings, versioning, mima, sonatype, ciSigning, ciRelease, ci, core) + .aggregate( + kernel, + noPublish, + settings, + versioning, + mima, + sonatype, + ciSigning, + sonatypeCiRelease, + ci, + core) lazy val kernel = project .in(file("kernel")) @@ -68,11 +78,11 @@ lazy val ciSigning = project name := "sbt-typelevel-ci-signing" ) -lazy val ciRelease = project - .in(file("ci-release")) +lazy val sonatypeCiRelease = project + .in(file("sonatype-ci-release")) .enablePlugins(SbtPlugin) .settings( - name := "sbt-typelevel-ci-release" + name := "sbt-typelevel-sonatype-ci-release" ) .dependsOn(sonatype) @@ -96,6 +106,6 @@ lazy val core = project mima, sonatype, ciSigning, - ciRelease, + sonatypeCiRelease, ci ) diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala b/core/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala new file mode 100644 index 00000000..de22796b --- /dev/null +++ b/core/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala @@ -0,0 +1,12 @@ +package org.typelevel.sbt + +import sbt._ + +object TypelevelCiReleasePlugin extends AutoPlugin { + + override def requires = + TypelevelSonatypeCiReleasePlugin && TypelevelCiSigningPlugin && TypelevelPlugin + + override def trigger = noTrigger + +} diff --git a/project/ci-release.sbt b/project/ci-release.sbt deleted file mode 120000 index 3ffbfbd5..00000000 --- a/project/ci-release.sbt +++ /dev/null @@ -1 +0,0 @@ -../ci-release/build.sbt \ No newline at end of file diff --git a/project/sonatype-ci-release.sbt b/project/sonatype-ci-release.sbt new file mode 120000 index 00000000..2be952ff --- /dev/null +++ b/project/sonatype-ci-release.sbt @@ -0,0 +1 @@ +../sonatype-ci-release/build.sbt \ No newline at end of file diff --git a/project/src/main/scala/ci-release b/project/src/main/scala/ci-release deleted file mode 120000 index dea107a2..00000000 --- a/project/src/main/scala/ci-release +++ /dev/null @@ -1 +0,0 @@ -../../../../ci-release/ \ No newline at end of file diff --git a/project/src/main/scala/sonatype-ci-release b/project/src/main/scala/sonatype-ci-release new file mode 120000 index 00000000..0a7e826d --- /dev/null +++ b/project/src/main/scala/sonatype-ci-release @@ -0,0 +1 @@ +../../../../sonatype-ci-release/ \ No newline at end of file diff --git a/ci-release/build.sbt b/sonatype-ci-release/build.sbt similarity index 100% rename from ci-release/build.sbt rename to sonatype-ci-release/build.sbt diff --git a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala similarity index 96% rename from ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala rename to sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala index 6406b12b..5724ad5d 100644 --- a/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala +++ b/sonatype-ci-release/src/main/scala/org/typelevel/sbt/TypelevelSonatypeCiReleasePlugin.scala @@ -5,7 +5,7 @@ import sbtghactions.GenerativePlugin import sbtghactions.GitHubActionsPlugin import sbtghactions.GenerativePlugin.autoImport._ -object TypelevelCiReleasePlugin extends AutoPlugin { +object TypelevelSonatypeCiReleasePlugin extends AutoPlugin { object autoImport { lazy val tlCiReleaseSnapshots = settingKey[Boolean]( From 26fd48f587d3370aa93e8939790273766264c828 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 09:44:43 +0000 Subject: [PATCH 37/70] Refactoring again ... --- build.sbt | 13 ++++++++++++- .../typelevel/sbt/TypelevelCiReleasePlugin.scala | 0 .../typelevel/sbt/TypelevelCiSigningPlugin.scala | 2 +- project/src/main/scala/ci-release | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) rename {core => ci-release}/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala (100%) create mode 120000 project/src/main/scala/ci-release diff --git a/build.sbt b/build.sbt index 0885c542..b66b5a6e 100644 --- a/build.sbt +++ b/build.sbt @@ -104,8 +104,19 @@ lazy val core = project settings, versioning, mima, + ci + ) + +lazy val ciRelease = project + .in(file("ci-release")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-typelevel-ci-release" + ) + .dependsOn( + core, sonatype, ciSigning, sonatypeCiRelease, - ci ) + diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala b/ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala similarity index 100% rename from core/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala rename to ci-release/src/main/scala/org/typelevel/sbt/TypelevelCiReleasePlugin.scala diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index 73700db7..a57eff6e 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -10,7 +10,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { override def requires = SbtGpg && GitHubActionsPlugin && GenerativePlugin - override def trigger = noTrigger + override def trigger = allRequirements override def buildSettings = Seq( githubWorkflowEnv ++= Map( diff --git a/project/src/main/scala/ci-release b/project/src/main/scala/ci-release new file mode 120000 index 00000000..dea107a2 --- /dev/null +++ b/project/src/main/scala/ci-release @@ -0,0 +1 @@ +../../../../ci-release/ \ No newline at end of file From f6cc27414c387cc3c456a89a1f9674a75bdcd8f5 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 09:46:48 +0000 Subject: [PATCH 38/70] Regenerate workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d729bada..385713f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: - run: sbt ++${{ matrix.scala }} ci - name: Compress target directories - run: tar cf targets.tar kernel/target versioning/target target ci-signing/target mima/target no-publish/target sonatype/target ci/target sonatype-ci-release/target core/target settings/target project/target + run: tar cf targets.tar kernel/target versioning/target ci-release/target target ci-signing/target mima/target no-publish/target sonatype/target ci/target sonatype-ci-release/target core/target settings/target project/target - name: Upload target directories uses: actions/upload-artifact@v2 From a57db49e8a13996846933777c56649a79565e819 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 09:49:55 +0000 Subject: [PATCH 39/70] Update root aggregates ... --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b66b5a6e..bf1896ba 100644 --- a/build.sbt +++ b/build.sbt @@ -24,7 +24,8 @@ lazy val root = project ciSigning, sonatypeCiRelease, ci, - core) + core, + ciRelease) lazy val kernel = project .in(file("kernel")) From c8e95ef81cc04919d28e9357d4a883d102065af0 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 10:20:50 +0000 Subject: [PATCH 40/70] Add a README --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..087d7d3e --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# sbt-typelevel + +## Quick start +```scala +// For a project releasing to sonatype from CI +addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "") // plugins.sbt +enablePlugins(TypelevelCiReleasePlugin) // build.sbt + +// Or, for a project not releasing from CI +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "") // plugins.sbt +``` + +## Customization + +sbt-typelevel is made up of several independent plugins. If you don't like some of them, you can create your own top-level plugin by mixing and matching. + +- `NoPublishPlugin`: Straightforward no-publish settings. No dependencies. +- `TypelevelKernelPlugin`: Shared basic settings/utilities. No dependencies. +- `TypelevelSettingsPlugin`: Good and/or opinionated defaults for scalac settings, Scala.js settings, etc. Depends on sbt-git, sbt-typelevel-kernel. +- `TypelevelVersioningPlugin`: Establishes semantic versioning. Depends on sbt-git, sbt-typelevel-kernel. +- `TypelevelMimaPlugin`: Determines previous Mima artifacts via git tags. Depends on sbt-mima-plugin, sbt-git, sbt-typelevel-kernel. +- `TypelevelSonatypePlugin`: Provides a `release` command for publishing binary-compatible artifacts to sonatype. Depends on sbt-mima-plugin, sbt-sonatype. +- `TypelevelSonatypeCiReleasePlugin`: Integrates sonatype publishing into your GitHub workflow. Depends on sbt-typelevel-sonatype, sbt-github-actions. +- `TypelevelCiSigningPlugin`: Sign your artifacts in CI, with your choice of a password-protected or non-password protected key. Depends on sbt-gpg, sbt-github-actions. +- `TypelevelCiPlugin`: Run tests and check binary-compatibility in CI. Depends on sbt-mima-plugin, sbt-github-actions. +- `TypelevelPlugin`: The top-level plugin for non-ci-publishing projects. Brings together the no-publish, settings, versioning, mima, and CI plugins. +- `TypelevelCiReleasePlugin`: The top-level plugin for ci-publishing projects. Brings together the `TypelevelPlugin`, CI signing plugin, and sonatype CI release plugin. From 51ec9a36608fd58ab5832e2ac0abb494e1c1a176 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 16:30:13 +0000 Subject: [PATCH 41/70] Shuffle some triggers --- .../main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala | 3 ++- .../main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala b/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala index 791479c7..7d5dadc2 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/TypelevelKernelPlugin.scala @@ -1,10 +1,11 @@ package org.typelevel.sbt import sbt._, Keys._ +import sbt.plugins.JvmPlugin object TypelevelKernelPlugin extends AutoPlugin { - override def requires = sbt.plugins.CorePlugin + override def requires = JvmPlugin override def trigger = allRequirements object autoImport { diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 83577167..4acf0b78 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -10,7 +10,7 @@ import scala.util.Try object TypelevelSettingsPlugin extends AutoPlugin { override def trigger = allRequirements - override def requires = JvmPlugin && GitPlugin + override def requires = TypelevelKernelPlugin && GitPlugin object autoImport { lazy val tlFatalWarnings = From 5df4aff938e951a9f0afbafba82644e7a73b9282 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 12:59:05 -0500 Subject: [PATCH 42/70] Remove unused import --- .../main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 4acf0b78..90c5ec27 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -1,7 +1,6 @@ package org.typelevel.sbt import sbt._, Keys._ -import sbt.plugins.JvmPlugin import com.typesafe.sbt.GitPlugin import com.typesafe.sbt.SbtGit.git import org.typelevel.sbt.kernel.V From 8cc7e2949403bd061717fd94c024e61505793830 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 17:00:48 -0500 Subject: [PATCH 43/70] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 087d7d3e..e13738ff 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel" % "") // plugins.sbt ## Customization -sbt-typelevel is made up of several independent plugins. If you don't like some of them, you can create your own top-level plugin by mixing and matching. +sbt-typelevel is made up of several independent plugins. If you don't like some of them, you can create your own super-plugin by mixing and matching. - `NoPublishPlugin`: Straightforward no-publish settings. No dependencies. - `TypelevelKernelPlugin`: Shared basic settings/utilities. No dependencies. @@ -23,5 +23,5 @@ sbt-typelevel is made up of several independent plugins. If you don't like some - `TypelevelSonatypeCiReleasePlugin`: Integrates sonatype publishing into your GitHub workflow. Depends on sbt-typelevel-sonatype, sbt-github-actions. - `TypelevelCiSigningPlugin`: Sign your artifacts in CI, with your choice of a password-protected or non-password protected key. Depends on sbt-gpg, sbt-github-actions. - `TypelevelCiPlugin`: Run tests and check binary-compatibility in CI. Depends on sbt-mima-plugin, sbt-github-actions. -- `TypelevelPlugin`: The top-level plugin for non-ci-publishing projects. Brings together the no-publish, settings, versioning, mima, and CI plugins. -- `TypelevelCiReleasePlugin`: The top-level plugin for ci-publishing projects. Brings together the `TypelevelPlugin`, CI signing plugin, and sonatype CI release plugin. +- `TypelevelPlugin`: The super-plugin for non-ci-publishing projects. Brings together the no-publish, settings, versioning, mima, and CI plugins. +- `TypelevelCiReleasePlugin`: The super-plugin for ci-publishing projects. Brings together the `TypelevelPlugin`, CI signing plugin, and sonatype CI release plugin. From 52cc0db4eb4e659e20819e3a5a9f552bb3baebcd Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 22:11:13 +0000 Subject: [PATCH 44/70] Set version scheme in versioning plugin --- .../scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala index 10181f97..9855e379 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala @@ -16,12 +16,13 @@ object TypelevelVersioningPlugin extends AutoPlugin { lazy val tlBaseVersion = settingKey[String]("The base version for the series your project is in. e.g., 0.2, 3.5") lazy val tlHashSnapshots = - settingKey[Boolean]("If true, a hash version implies this is a snapshot.") + settingKey[Boolean]("If true, a hash version implies this is a snapshot (default: true).") } import autoImport._ override def buildSettings: Seq[Setting[_]] = Seq( + versionScheme := Some("early-semver"), tlHashSnapshots := true, isSnapshot := { val isVersionTagged = getTaggedVersion(git.gitCurrentTags.value).isDefined From 7424b81b3c73c78e95755ce1d31ad69fd687505c Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 22:42:37 +0000 Subject: [PATCH 45/70] Create GitHelper in kernel --- .../org/typelevel/sbt/kernel/GitHelper.scala | 17 +++++++++++++++++ .../org/typelevel/sbt/TypelevelMimaPlugin.scala | 14 ++------------ 2 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala new file mode 100644 index 00000000..c0d611f3 --- /dev/null +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala @@ -0,0 +1,17 @@ +package org.typelevel.sbt.kernel + +import scala.util.Try + +import scala.sys.process._ + +object GitHelper { + + def previousReleases(): List[V] = { + Try { + "git tag --list".!!.split("\n").toList.map(_.trim).collect { + case V.Tag(version) => version + } + }.getOrElse(List.empty) + } + +} diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala index d6dc83e1..1a65073d 100644 --- a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -3,10 +3,9 @@ package org.typelevel.sbt import sbt._, Keys._ import com.typesafe.tools.mima.plugin.MimaPlugin import MimaPlugin.autoImport._ +import org.typelevel.sbt.kernel.GitHelper import org.typelevel.sbt.kernel.V -import scala.util.Try - object TypelevelMimaPlugin extends AutoPlugin { override def requires = MimaPlugin @@ -32,7 +31,7 @@ object TypelevelMimaPlugin extends AutoPlugin { val introduced = tlVersionIntroduced .value .map(v => V(v).getOrElse(sys.error(s"Version must be semver format: $v"))) - val previous = previousReleases() + val previous = GitHelper.previousReleases() .filterNot(_.isPrerelease) .filter(v => introduced.forall(v >= _)) .filter(current.mustBeBinCompatWith(_)) @@ -43,13 +42,4 @@ object TypelevelMimaPlugin extends AutoPlugin { } ) - def previousReleases(): List[V] = { - import scala.sys.process._ - Try { - "git tag --list".!!.split("\n").toList.map(_.trim).collect { - case V.Tag(version) => version - } - }.getOrElse(List.empty) - } - } From 43dc06b91a54d374ca50a8211aa06138890ab717 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 23:08:59 +0000 Subject: [PATCH 46/70] Smarter snapshot versioning, I think ... --- .../org/typelevel/sbt/kernel/GitHelper.scala | 2 +- .../sbt/TypelevelVersioningPlugin.scala | 29 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala index c0d611f3..e25d14ea 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala @@ -11,7 +11,7 @@ object GitHelper { "git tag --list".!!.split("\n").toList.map(_.trim).collect { case V.Tag(version) => version } - }.getOrElse(List.empty) + }.getOrElse(List.empty).sorted.reverse } } diff --git a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala index 9855e379..4fe3eaaa 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala @@ -6,6 +6,7 @@ import com.typesafe.sbt.SbtGit.git import org.typelevel.sbt.kernel.V import scala.util.Try +import org.typelevel.sbt.kernel.GitHelper object TypelevelVersioningPlugin extends AutoPlugin { @@ -34,16 +35,26 @@ object TypelevelVersioningPlugin extends AutoPlugin { val taggedVersion = getTaggedVersion(git.gitCurrentTags.value) taggedVersion.getOrElse { - var version = tlBaseVersion.value - - // Looks for the distance to the first stable release in this series - val firstInSeries = V - .unapply(tlBaseVersion.value) - .map(_.copy(patch = Some(0), prerelease = None)) + val baseV = V(tlBaseVersion.value) .getOrElse(sys.error(s"tlBaseVersion must be semver format: ${tlBaseVersion.value}")) - Try(s"git describe --tags --match v$firstInSeries".!!.trim) - .collect { case Description(distance) => distance } - .foreach { distance => version += s"-$distance" } + + val latestInSeries = GitHelper.previousReleases().headOption.flatMap { previous => + if (previous > baseV) + sys.error(s"Your tlBaseVersion $baseV is behind the latest tag $previous") + else if (baseV.isSameSeries(previous)) + Some(previous) + else + None + } + + var version = latestInSeries.fold(tlBaseVersion.value)(_.toString) + + // Looks for the distance to latest release in this series + latestInSeries.foreach { latestInSeries => + Try(s"git describe --tags --match v$latestInSeries".!!.trim) + .collect { case Description(distance) => distance } + .foreach { distance => version += s"-$distance" } + } git.gitHeadCommit.value.foreach { sha => version += s"-${sha.take(7)}" } if (git.gitUncommittedChanges.value) { From 235b3632ab77fbf86e27ed0bed19a67abde71689 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 23:23:38 +0000 Subject: [PATCH 47/70] Only use tags in same history --- .../main/scala/org/typelevel/sbt/kernel/GitHelper.scala | 9 +++++++-- .../org/typelevel/sbt/TypelevelVersioningPlugin.scala | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala index e25d14ea..b0731ee4 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/GitHelper.scala @@ -6,9 +6,14 @@ import scala.sys.process._ object GitHelper { - def previousReleases(): List[V] = { + /** + * @param fromHead + * if `true`, only tags reachable from HEAD's history. If `false`, all tags in the repo. + */ + def previousReleases(fromHead: Boolean = false): List[V] = { Try { - "git tag --list".!!.split("\n").toList.map(_.trim).collect { + val merged = if (fromHead) " --merged" else "" + s"git tag --list$merged".!!.split("\n").toList.map(_.trim).collect { case V.Tag(version) => version } }.getOrElse(List.empty).sorted.reverse diff --git a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala index 4fe3eaaa..c1711b2b 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala @@ -38,7 +38,7 @@ object TypelevelVersioningPlugin extends AutoPlugin { val baseV = V(tlBaseVersion.value) .getOrElse(sys.error(s"tlBaseVersion must be semver format: ${tlBaseVersion.value}")) - val latestInSeries = GitHelper.previousReleases().headOption.flatMap { previous => + val latestInSeries = GitHelper.previousReleases(true).headOption.flatMap { previous => if (previous > baseV) sys.error(s"Your tlBaseVersion $baseV is behind the latest tag $previous") else if (baseV.isSameSeries(previous)) From 11de42ffa0c49b5db740f585cc3ab44cf0a629ad Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 23:26:04 +0000 Subject: [PATCH 48/70] Ignore pre-releases for versioning --- .../sbt/TypelevelVersioningPlugin.scala | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala index c1711b2b..09541d9e 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala @@ -38,14 +38,18 @@ object TypelevelVersioningPlugin extends AutoPlugin { val baseV = V(tlBaseVersion.value) .getOrElse(sys.error(s"tlBaseVersion must be semver format: ${tlBaseVersion.value}")) - val latestInSeries = GitHelper.previousReleases(true).headOption.flatMap { previous => - if (previous > baseV) - sys.error(s"Your tlBaseVersion $baseV is behind the latest tag $previous") - else if (baseV.isSameSeries(previous)) - Some(previous) - else - None - } + val latestInSeries = GitHelper + .previousReleases(true) + .filterNot(_.isPrerelease) // TODO Ordering of pre-releases is arbitrary + .headOption + .flatMap { previous => + if (previous > baseV) + sys.error(s"Your tlBaseVersion $baseV is behind the latest tag $previous") + else if (baseV.isSameSeries(previous)) + Some(previous) + else + None + } var version = latestInSeries.fold(tlBaseVersion.value)(_.toString) From 21c93e699821110084cfbab708abb82ff5c95a1d Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 28 Dec 2021 23:30:12 +0000 Subject: [PATCH 49/70] Fix version comparator --- kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala index 64e63252..d3ae5d54 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -33,9 +33,12 @@ final case class V( val z = thisPatch.compare(thatPatch) if (z != 0) return z (this.prerelease, that.prerelease) match { - case (None, None) | (Some(_), Some(_)) => 0 + case (None, None) => 0 case (None, Some(_)) => 1 case (Some(_), None) => -1 + case (Some(_), Some(_)) => + // TODO not great, but not everyone uses Ms and RCs + x.compare(y) } } } From f83a218d9346e86f23030faaeffb025fe9ed1e25 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 00:23:31 +0000 Subject: [PATCH 50/70] Another random setting --- .../main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 90c5ec27..41bba6b4 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -30,6 +30,7 @@ object TypelevelSettingsPlugin extends AutoPlugin { override def projectSettings = Seq( versionScheme := Some("early-semver"), + pomIncludeRepository := { _ => false }, libraryDependencies ++= { if (tlIsScala3.value) From 696eebe90f82d034e3d24721a8807bb766fb0047 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 00:31:09 +0000 Subject: [PATCH 51/70] Setup for stable publishing --- build.sbt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index bf1896ba..13148bd3 100644 --- a/build.sbt +++ b/build.sbt @@ -11,6 +11,13 @@ enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") +ThisBuild / tlHashSnapshots := false +ThisBuild / developers := List( + Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")) +) +ThisBuild / homepage := Some(url("https://github.com/typelevel/sbt-typelevel")) +ThisBuild / licenses += "Apache-2.0" -> url("http://www.apache.org/licenses/") + lazy val root = project .in(file(".")) .enablePlugins(NoPublishPlugin) @@ -118,6 +125,5 @@ lazy val ciRelease = project core, sonatype, ciSigning, - sonatypeCiRelease, + sonatypeCiRelease ) - From 6c42f5b9ad39c984520e395787179634961bc7f9 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 00:44:15 +0000 Subject: [PATCH 52/70] Hardened scm-info settings --- .../sbt/TypelevelSettingsPlugin.scala | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala index 41bba6b4..4421a369 100644 --- a/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala +++ b/settings/src/main/scala/org/typelevel/sbt/TypelevelSettingsPlugin.scala @@ -21,7 +21,7 @@ object TypelevelSettingsPlugin extends AutoPlugin { override def globalSettings = Seq( tlFatalWarnings := false, - Def.derive(scalaVersion := crossScalaVersions.value.last, default = true), + Def.derive(scalaVersion := crossScalaVersions.value.last, default = true) ) override def buildSettings = Seq( @@ -31,7 +31,6 @@ object TypelevelSettingsPlugin extends AutoPlugin { override def projectSettings = Seq( versionScheme := Some("early-semver"), pomIncludeRepository := { _ => false }, - libraryDependencies ++= { if (tlIsScala3.value) Nil @@ -172,21 +171,26 @@ object TypelevelSettingsPlugin extends AutoPlugin { def getScmInfo(): Option[ScmInfo] = { import scala.sys.process._ - val identifier = """([^\/]+)""" - - val GitHubHttps = s"https://github.com/$identifier/$identifier".r - val SSHConnection = s"git@github.com:$identifier/$identifier.git".r + def gitHubScmInfo(user: String, repo: String) = + ScmInfo( + url(s"https://github.com/$user/$repo"), + s"scm:git:https://github.com/$user/$repo.git", + s"scm:git:git@github.com:$user/$repo.git" + ) - Try(List("git", "ls-remote", "--get-url", "origin").!!.trim()) - .collect { - case GitHubHttps(user, repo) => (user, repo) - case SSHConnection(user, repo) => (user, repo) - } - .map { - case (user, repo) => - ScmInfo(url(s"https://github.com/$user/$repo"), s"git@github.com:$user/$repo.git") + val identifier = """([^\/]+?)""" + val GitHubHttps = s"https://github.com/$identifier/$identifier(?:\\.git)?".r + val GitHubGit = s"git://github.com:$identifier/$identifier(?:\\.git)?".r + val GitHubSsh = s"git@github.com:$identifier/$identifier(?:\\.git)?".r + Try { + val remote = List("git", "ls-remote", "--get-url", "origin").!!.trim() + remote match { + case GitHubHttps(user, repo) => Some(gitHubScmInfo(user, repo)) + case GitHubGit(user, repo) => Some(gitHubScmInfo(user, repo)) + case GitHubSsh(user, repo) => Some(gitHubScmInfo(user, repo)) + case _ => None } - .toOption + }.toOption.flatten } } From 203771cd45113d2e52151dba179cb0154027d9af Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 01:02:42 +0000 Subject: [PATCH 53/70] Back to true snapshots --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 13148bd3..58b626a4 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") -ThisBuild / tlHashSnapshots := false +ThisBuild / tlHashSnapshots := true ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")) ) From b3e236ad3b37fda3e6dd9180126f084cba7ad661 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 01:07:39 +0000 Subject: [PATCH 54/70] And back again to stable snapshots for now --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 58b626a4..13148bd3 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") -ThisBuild / tlHashSnapshots := true +ThisBuild / tlHashSnapshots := false ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")) ) From 01e80eaba6c4acd5b95f26249775dfb1bf169eea Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 01:56:28 +0000 Subject: [PATCH 55/70] Finish up passphrase-stripping impl --- .../scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index a57eff6e..f0a620d4 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -23,11 +23,11 @@ object TypelevelCiSigningPlugin extends AutoPlugin { name = Some("Directly import signing key"), cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''") ), - WorkflowStep.Run( // if your key is passphrase protected + WorkflowStep.Run( // if your key is passphrase-protected List( "echo \"$PGP_SECRET\" | base64 -d > /tmp/signing-key.gpg", "echo \"$PGP_PASSPHRASE\" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg", - "(echo \"$PGP_PASSPHRASE\"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase 5EBC14B0F6C55083" // TODO + "(echo \"$PGP_PASSPHRASE\"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)" ), name = Some("Import signing key and strip passphrase"), cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''") From bedf652953e490db5c76cd0227b91e194668ce96 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 01:57:45 +0000 Subject: [PATCH 56/70] Regenerate workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 385713f7..72e46842 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,7 @@ jobs: run: | echo "$PGP_SECRET" | base64 -d > /tmp/signing-key.gpg echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg - (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase 5EBC14B0F6C55083 + (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) - if: (startsWith(github.ref, 'refs/tags/v') && github.ref_type == 'tag') || (!startsWith(github.ref, 'refs/tags/v') && github.ref_type != 'tag') run: sbt ++${{ matrix.scala }} release From 775c4c8f00ce7721e90577184b2a3d019210cee3 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 02:39:08 +0000 Subject: [PATCH 57/70] Bikeshedding --- .github/workflows/ci.yml | 2 +- .../main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72e46842..9750cf28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,7 @@ jobs: tar xf targets.tar rm targets.tar - - name: Directly import signing key + - name: Import signing key if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' run: echo $PGP_SECRET | base64 -d | gpg --import diff --git a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala index f0a620d4..dd0d36fa 100644 --- a/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala +++ b/ci-signing/src/main/scala/org/typelevel/sbt/TypelevelCiSigningPlugin.scala @@ -20,7 +20,7 @@ object TypelevelCiSigningPlugin extends AutoPlugin { githubWorkflowPublishPreamble ++= Seq( WorkflowStep.Run( // if your key is not passphrase-protected List("echo $PGP_SECRET | base64 -d | gpg --import"), - name = Some("Directly import signing key"), + name = Some("Import signing key"), cond = Some("env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''") ), WorkflowStep.Run( // if your key is passphrase-protected From 1f370228fbb3a788b59f21e5f608a1cee07bb80f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 03:26:42 +0000 Subject: [PATCH 58/70] Fix mima artifacts --- build.sbt | 2 +- .../scala/org/typelevel/sbt/TypelevelMimaPlugin.scala | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 13148bd3..97a127ea 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "sbt-typelevel" -ThisBuild / tlBaseVersion := "0.4" +ThisBuild / tlBaseVersion := "0.3" // ThisBuild / organization := "org.typelevel" ThisBuild / organization := "com.armanbilge" ThisBuild / organizationName := "Typelevel" diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala index 1a65073d..774b944b 100644 --- a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -31,11 +31,15 @@ object TypelevelMimaPlugin extends AutoPlugin { val introduced = tlVersionIntroduced .value .map(v => V(v).getOrElse(sys.error(s"Version must be semver format: $v"))) - val previous = GitHelper.previousReleases() + val previous = GitHelper + .previousReleases() .filterNot(_.isPrerelease) .filter(v => introduced.forall(v >= _)) .filter(current.mustBeBinCompatWith(_)) - previous.map(v => projectID.value.withRevision(v.toString)).toSet + previous + .map(v => + projectID.value.withRevision(v.toString).withExplicitArtifacts(Vector.empty)) + .toSet } else { Set.empty } From 49d5d5489982b37455a3b36371a3f68c67cfd329 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 03:29:16 +0000 Subject: [PATCH 59/70] Bump back base version, woops --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 97a127ea..13148bd3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "sbt-typelevel" -ThisBuild / tlBaseVersion := "0.3" +ThisBuild / tlBaseVersion := "0.4" // ThisBuild / organization := "org.typelevel" ThisBuild / organization := "com.armanbilge" ThisBuild / organizationName := "Typelevel" From 6c3d633291f894b635fb45b433401610eadf3275 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 05:16:32 +0000 Subject: [PATCH 60/70] Adjust version comparator for new scheme --- kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala index d3ae5d54..698e5e2e 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -34,10 +34,10 @@ final case class V( if (z != 0) return z (this.prerelease, that.prerelease) match { case (None, None) => 0 - case (None, Some(_)) => 1 - case (Some(_), None) => -1 - case (Some(_), Some(_)) => - // TODO not great, but not everyone uses Ms and RCs + case (Some(_), None) => 1 + case (None, Some(_)) => -1 + case (Some(x), Some(y)) => + // TODO not great, but not everyone uses Ms and RCs x.compare(y) } } From 95ee54dbdfab6f476542197dde18b7b125f3db35 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 05:17:36 +0000 Subject: [PATCH 61/70] Clearer variable names --- kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala index 698e5e2e..a51b760f 100644 --- a/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala +++ b/kernel/src/main/scala/org/typelevel/sbt/kernel/V.scala @@ -36,9 +36,9 @@ final case class V( case (None, None) => 0 case (Some(_), None) => 1 case (None, Some(_)) => -1 - case (Some(x), Some(y)) => + case (Some(thisPrerelease), Some(thatPrerelease)) => // TODO not great, but not everyone uses Ms and RCs - x.compare(y) + thisPrerelease.compare(thatPrerelease) } } } From ddf26e78666fdce3953581dd99e7a49ea79d4111 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 16:54:41 +0000 Subject: [PATCH 62/70] Tweak mima interpretation of current --- mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala index 774b944b..f0476fdb 100644 --- a/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala +++ b/mima/src/main/scala/org/typelevel/sbt/TypelevelMimaPlugin.scala @@ -27,6 +27,8 @@ object TypelevelMimaPlugin extends AutoPlugin { "Only early-semver versioning scheme supported.") if (publishArtifact.value) { val current = V(version.value) + // Consider it as a real release, for purposes of compat-checking + .map(_.copy(prerelease = None)) .getOrElse(sys.error(s"Version must be semver format: ${version.value}")) val introduced = tlVersionIntroduced .value From f277ca92734b427e0db106d43fbdec8a6948eddb Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 29 Dec 2021 17:08:33 -0500 Subject: [PATCH 63/70] Update CODE_OF_CONDUCT.md Co-authored-by: Ross A. Baker --- CODE_OF_CONDUCT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6003256e..dd0467f9 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -8,7 +8,7 @@ Everyone is expected to follow the [Scala Code of Conduct] when discussing the p Any questions, concerns, or moderation requests please contact a member of the project. -- Ross A. Baker: [gitter](https://gitter.im/rossabaker) | [twitter](https://twitter.com/rossabaker) | [email](mailto:ross@rossabaker.com) +- Ross A. Baker: [twitter](https://twitter.com/rossabaker) | [email](mailto:ross@rossabaker.com) - Arman Bilge: [twitter](https://twitter.com/armanbilge) | [email](mailto:arman@armanbilge.com) [Scala Code of Conduct]: https://typelevel.org/code-of-conduct.html From 53f42e45cbe12e74af87dc00c53ea57a217d221b Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 30 Dec 2021 04:49:16 +0000 Subject: [PATCH 64/70] Thin the default ci matrix --- .../scala/org/typelevel/sbt/TypelevelPlugin.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala index 6cbd4321..d43b8b12 100644 --- a/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala +++ b/core/src/main/scala/org/typelevel/sbt/TypelevelPlugin.scala @@ -1,6 +1,7 @@ package org.typelevel.sbt import sbt._ +import sbtghactions.GenerativePlugin import sbtghactions.GitHubActionsPlugin object TypelevelPlugin extends AutoPlugin { @@ -17,6 +18,7 @@ object TypelevelPlugin extends AutoPlugin { import autoImport._ import TypelevelSettingsPlugin.autoImport._ + import GenerativePlugin.autoImport._ import GitHubActionsPlugin.autoImport._ override def globalSettings = Seq( @@ -24,7 +26,14 @@ object TypelevelPlugin extends AutoPlugin { ) override def buildSettings = Seq( - Def.derive(tlFatalWarnings := (tlFatalWarningsInCi.value && githubIsWorkflowBuild.value)) + Def.derive(tlFatalWarnings := (tlFatalWarningsInCi.value && githubIsWorkflowBuild.value)), + githubWorkflowBuildMatrixExclusions ++= { + for { + // default scala is last in the list, default java first + scala <- (ThisBuild / githubWorkflowScalaVersions).value.init + java <- (ThisBuild / githubWorkflowJavaVersions).value.tail + } yield MatrixExclude(Map("scala" -> scala, "java" -> java.render)) + } ) } From 00218f92ed233151007c3cf25287dbe0ca7052db Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 30 Dec 2021 04:53:55 +0000 Subject: [PATCH 65/70] Update the developer list --- build.sbt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 13148bd3..2e52d6c2 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,14 @@ ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") ThisBuild / tlHashSnapshots := false ThisBuild / developers := List( - Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")) + Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")), + Developer("rossabaker", "Ross A. Baker", "@rossabaker", url("https://github.com/rossabaker")), + Developer( + "ChristopherDavenport", + "Christopher Davenport", + "@ChristopherDavenport", + url("https://github.com/ChristopherDavenport")), + Developer("djspiewak", "Daniel Spiewak", "@djspiewak", url("https://github.com/djspiewak")) ) ThisBuild / homepage := Some(url("https://github.com/typelevel/sbt-typelevel")) ThisBuild / licenses += "Apache-2.0" -> url("http://www.apache.org/licenses/") From 02972dd0de28f42415ed7afbdd7bd3d117a86a90 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 30 Dec 2021 05:44:22 +0000 Subject: [PATCH 66/70] Try to clarify snapshot setting --- build.sbt | 2 +- .../org/typelevel/sbt/TypelevelVersioningPlugin.scala | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 2e52d6c2..88a7776b 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") -ThisBuild / tlHashSnapshots := false +ThisBuild / tlUntaggedAreSnapshots := false ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")), Developer("rossabaker", "Ross A. Baker", "@rossabaker", url("https://github.com/rossabaker")), diff --git a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala index 09541d9e..3858b332 100644 --- a/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala +++ b/versioning/src/main/scala/org/typelevel/sbt/TypelevelVersioningPlugin.scala @@ -16,19 +16,20 @@ object TypelevelVersioningPlugin extends AutoPlugin { object autoImport { lazy val tlBaseVersion = settingKey[String]("The base version for the series your project is in. e.g., 0.2, 3.5") - lazy val tlHashSnapshots = - settingKey[Boolean]("If true, a hash version implies this is a snapshot (default: true).") + lazy val tlUntaggedAreSnapshots = + settingKey[Boolean]( + "If true, an untagged commit is given a snapshot version, e.g. 0.4-00218f9-SNAPSHOT. If false, it is given a release version, e.g. 0.4-00218f9. (default: true)") } import autoImport._ override def buildSettings: Seq[Setting[_]] = Seq( versionScheme := Some("early-semver"), - tlHashSnapshots := true, + tlUntaggedAreSnapshots := true, isSnapshot := { val isVersionTagged = getTaggedVersion(git.gitCurrentTags.value).isDefined val dirty = git.gitUncommittedChanges.value - !isVersionTagged && (tlHashSnapshots.value || dirty) + !isVersionTagged && (tlUntaggedAreSnapshots.value || dirty) }, version := { import scala.sys.process._ From 2c2149a3df50d30933a75f225b7f28018cd59fbf Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 30 Dec 2021 05:51:43 +0000 Subject: [PATCH 67/70] Try out my publishing rights --- build.sbt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 88a7776b..77cd3cad 100644 --- a/build.sbt +++ b/build.sbt @@ -1,8 +1,7 @@ name := "sbt-typelevel" ThisBuild / tlBaseVersion := "0.4" -// ThisBuild / organization := "org.typelevel" -ThisBuild / organization := "com.armanbilge" +ThisBuild / organization := "org.typelevel" ThisBuild / organizationName := "Typelevel" ThisBuild / scalaVersion := "2.12.15" @@ -11,7 +10,6 @@ enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") -ThisBuild / tlUntaggedAreSnapshots := false ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")), Developer("rossabaker", "Ross A. Baker", "@rossabaker", url("https://github.com/rossabaker")), From df43b107476a4b3dc6216125a75e2cf9dafe2400 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 30 Dec 2021 05:59:56 +0000 Subject: [PATCH 68/70] Try legacy host? --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 77cd3cad..b4a62ea1 100644 --- a/build.sbt +++ b/build.sbt @@ -9,6 +9,7 @@ ThisBuild / scalaVersion := "2.12.15" enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") +ThisBuild / tlSonatypeUseLegacyHost := true ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")), From 44d1f986ce0c5772bdd49254468acae9fc221fa2 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 30 Dec 2021 15:04:07 +0000 Subject: [PATCH 69/70] Don't use s01 by default --- build.sbt | 1 - .../scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index b4a62ea1..77cd3cad 100644 --- a/build.sbt +++ b/build.sbt @@ -9,7 +9,6 @@ ThisBuild / scalaVersion := "2.12.15" enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") -ThisBuild / tlSonatypeUseLegacyHost := true ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")), diff --git a/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala b/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala index 22fb670c..604368e4 100644 --- a/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala +++ b/sonatype/src/main/scala/org/typelevel/sbt/TypelevelSonatypePlugin.scala @@ -12,13 +12,13 @@ object TypelevelSonatypePlugin extends AutoPlugin { object autoImport { lazy val tlSonatypeUseLegacyHost = - settingKey[Boolean]("Publish to oss.sonatype.org instead of s01") + settingKey[Boolean]("Publish to oss.sonatype.org instead of s01 (default: true)") } import autoImport._ override def buildSettings = - Seq(tlSonatypeUseLegacyHost := false) ++ + Seq(tlSonatypeUseLegacyHost := true) ++ addCommandAlias( "release", "; reload; project /; +mimaReportBinaryIssues; +publish; sonatypeBundleReleaseIfRelevant") From a0c87a0413a67de9aaff9603b32a21a80f2bb1ad Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 30 Dec 2021 17:14:36 +0000 Subject: [PATCH 70/70] Update the main branch --- .github/workflows/ci.yml | 2 +- build.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9750cf28..b19819f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: publish: name: Publish Artifacts needs: [build] - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/series/armanbilge') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') strategy: matrix: os: [ubuntu-latest] diff --git a/build.sbt b/build.sbt index 77cd3cad..16769a5e 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ ThisBuild / scalaVersion := "2.12.15" enablePlugins(TypelevelCiReleasePlugin) ThisBuild / tlCiReleaseSnapshots := true -ThisBuild / tlCiReleaseBranches := Seq("series/armanbilge") +ThisBuild / tlCiReleaseBranches := Seq("main") ThisBuild / developers := List( Developer("armanbilge", "Arman Bilge", "@armanbilge", url("https://github.com/armanbilge")),