Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Move analyzers to a separate repository #1735

Closed
thomaslevesque opened this issue Dec 5, 2019 · 16 comments
Closed

Move analyzers to a separate repository #1735

thomaslevesque opened this issue Dec 5, 2019 · 16 comments

Comments

@thomaslevesque
Copy link
Member

When we first released the FakeItEasy analyzers, we decided to version them together with the library. For every release of the library, the analyzers were also released, even if they had not changed.

This approach has several issues:

  • It conveys the wrong message, as we make many releases of the analyzers that differ only by their version number
  • The analyzers don't really follow SemVer. We only bump the major version if there's a breaking change in the library.
  • Since the analyzers are in the same solution as the library, it increases build times

We should consider moving the analyzers to a separate repository, and version them independently of the library.

@thomaslevesque
Copy link
Member Author

thomaslevesque commented Dec 6, 2019

To do:

  • Move shared build and release tools (PrepareRelease and Deploy) to a new repository
    • Create a new repos for shared tools
    • Copy shared tools to new repo
    • Include shared tools in FakeItEasy using submodules and remove original tools
  • Create new repo for analyzers ("FakeItEasy.Analyzers"?)
  • Copy source and tests of analyzers to new repo
    • Keep git history? Possible, but is it worth it?
  • Configure AppVeyor to build and release analyzers
  • Remove source and tests of analyzers from main library repo
  • Decide what to do about the docs: put analyzer docs in the new repo, or keep them in the main repo? There's only one page regarding the analyzers, and it might be difficult to publish it to the same ReadTheDocs site if it's in a different repo. On the other hand, the "stable" docs are only updated when we release a new version of the library, so... Maybe use subprojects?

@thomaslevesque
Copy link
Member Author

Regarding the tools, it's going to be a bit of a mess. The scripts have hard-coded relative paths to the artifacts, and hard-coded values (e.g. repo name in PrepareRelease).
I think the right approach is to parameterize the C# scripts, and just have specific cmd scripts in the consuming repo.

@blairconrad
Copy link
Member

blairconrad commented Dec 6, 2019

I think the right approach is to parameterize the C# scripts, and just have specific cmd scripts in the consuming repo.

Yeah. I'd assumed as much as well.

@thomaslevesque
Copy link
Member Author

  • Keep git history? Possible, but is it worth it?

@blairconrad unless you think it's important, I'd rather not preserve the history. It's possible, but it's going to be a pain.

@blairconrad
Copy link
Member

I'm not sure it's super important, but mind if I try something?

@thomaslevesque
Copy link
Member Author

I'm not sure it's super important, but mind if I try something?

Sure, go ahead.
I was going to use git filter-branch, but it's a pain to specify which paths you want to remove...

@thomaslevesque
Copy link
Member Author

thomaslevesque commented Dec 8, 2019

If you manage to do it, feel free to overwrite/force push what I did in the FakeItEasy.Analyzers repo

@blairconrad
Copy link
Member

I'm trying filter-repo.

@blairconrad
Copy link
Member

blairconrad commented Dec 8, 2019

Done. I added a second commit that modifies files so the appveyor build builds.
Of course there's a lot of cleanup yet to do around docs and supporting files (license, readme, contributing, etc.)

@blairconrad
Copy link
Member

blairconrad commented Dec 8, 2019

if (Test-Path FakeItEasy) {
    Remove-Item -Force -Recurse ./FakeItEasy/
}

#git clone --branch master --origin origin --progress -v git@github.com:FakeItEasy/FakeItEasy.git
git clone --branch master --origin origin --progress -v ../FakeItEasy

Set-Location FakeItEasy
git remote rm origin

py ../git-filter-repo.txt `
    --force `
    --path-glob src/*Analyzer* `
    --path src/CommonAssemblyInfo.cs `
    --path src/Directory.Build.props `
    --path src/FakeItEasy.Dictionary.xml `
    --path src/FakeItEasy.png `
    --path src/FakeItEasy.ruleset `
    --path src/FakeItEasy.snk `
    --path src/FakeItEasy/Compatibility/NotNullWhenAttribute.cs `
    --path src/stylecop.json `
    --path-glob tests/*Analyzer* `
    --path tests/Directory.Build.props `
    --path tests/FakeItEasy.Dictionary.Tests.xml `
    --path tests/FakeItEasy.Tests.ruleset `
    --path tests/FakeItEasy.Tests.TestHelpers/Properties `
    --path tests/FakeItEasy.Tests.TestHelpers/FakeItEasy.Tests.TestHelpers.csproj `
    --path tests/FakeItEasy.Tests.TestHelpers/TestCases.cs `
    --path tests/FakeItEasy.Tests.TestHelpers/UsingCultureAttribute.cs `
    --path docs/analyzer.md `
    --path docs/css `
    --path tools `
    --path .editorconfig `
    --path .gitattributes `
    --path .gitignore `
    --path .mailmap `
    --path appveyor.yml `
    --path build.cmd `
    --path CONTRIBUTING.md `
    --path Directory.Build.props `
    --path how_to_build.md `
    --path License.txt `
    --path mkdocs.yml `
    --path profiles `
    --path README.md `
    --use-mailmap

Copy-Item ../FakeItEasy.sln .
Copy-Item ../FakeItEasy.Analyzer.CSharp.Tests.csproj tests/FakeItEasy.Analyzer.CSharp.Tests
Copy-Item ../FakeItEasy.Analyzer.VisualBasic.Tests.csproj tests/FakeItEasy.Analyzer.VisualBasic.Tests
Copy-Item ../Program.cs tools/FakeItEasy.Build
Copy-Item ../FakeItEasy.Tests.TestHelpers.csproj tests/FakeItEasy.Tests.TestHelpers

git add -A
git commit -m "Make minimal changes so build.cmd passes in FakeItEasy.Analyzers repo"

./build.cmd

If you want it. Requires git-filter-repo to have been downloaded.

@thomaslevesque
Copy link
Member Author

Nice! Yes, I've seen a few files we'll need to remove or update, but otherwise, it looks good. Thanks @blairconrad

@blairconrad
Copy link
Member

blairconrad commented Dec 8, 2019

If you're content with the content I pushed, we can check off

 Copy source and tests of analyzers to new repo
     Keep git history? Possible, but is it worth it?

And worry about cleaning up the supporting files and simplifying the build and what not as issues in the new repo, no?
Of course some of the documentation aspects may still impact this repo.

@thomaslevesque
Copy link
Member Author

And worry about cleaning up the supporting files and simplifying the build and what not as issues in the new repo, no?

👍

Of course some of the documentation aspects may still impact this repo.

I think we just need to remove analyzer.md from this repo, configure the other one as a subproject on ReadTheDocs, and update the link to the analyzer page to point to the subproject

@thomaslevesque
Copy link
Member Author

I think we can close this. Now that all necessary tasks are done, polishing the new repo can be done independently.

@afakebot
Copy link

This change has been released as part of FakeItEasy 6.0.0-beta.1.

@thomaslevesque
Copy link
Member Author

Thanks for your git-filter-repo, @newren! Look for your name in the release notes! 🥇

This was referenced Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants