GithubHelp home page GithubHelp logo

Prevent regeneration about facil HOT 5 CLOSED

cmeeren avatar cmeeren commented on June 24, 2024
Prevent regeneration

from facil.

Comments (5)

cmeeren avatar cmeeren commented on June 24, 2024 1

Sure, I'll leave it open for the time being. 👍

from facil.

isaacabraham avatar isaacabraham commented on June 24, 2024 1

Can you ping me privately - Twitter or some DM solution (email?) - if you're interested, it might be good to jump on a quick call to talk about things.

from facil.

cmeeren avatar cmeeren commented on June 24, 2024

Sounds like a simple thing to implement! But given your issue, it also kinda sounds like I would be implementing a foot-gun, or at least something that does not push you into the "pit of success". So I'd like to understand your issue a bit more first.

If I am understanding you correctly, the "Build" project sets up the database, and the "Main" project contains the Facil-generated stuff, and "Build" references "Main". This seems like a bad idea, as it gives the issue you describe. This is a cyclic dependency: Facil depends on the DB which depends on the code generated by Facil. Since you're an F# dev, I'm sure I don't have to tell you that cyclic dependencies are evil. Moreover, it's an unnecessary cyclic dependency: If it were actually necessary, it would of course be impossible to ever build the project.

I of course have very limited information to go on regarding your code, but given what little I can infer, I would strongly recommend you to refactor to remove the cyclic dependency. There seems to be no reason why the Facil-generated code that uses a DB should be a dependency of the code that sets up the DB. If you disagree, I am guessing Facil is generating code from multiple DBs, and can be split into multiple projects.

For the record, I always have a dedicated project for Facil-generated code (which I usually just call "DbGen"). This gives the following benefits:

  • No weird dependencies; the only reason to reference the project is to use the Facil-generated code.
  • Improved compilation times, since the Facil-generated code (which may be sizable) does not need to be re-compiled whenever something else changes.
  • I can have a project file like this, which automatically picks up new SQL scripts, changes to SQL scripts and Facil config, etc.
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <None Include="SQL\**\*.sql" />
    <None Include="facil.yaml" />
    <Compile Include="*.fs" />
  </ItemGroup>

  <ItemGroup>
    <UpToDateCheckInput Include="SQL\**\*.sql" />
    <UpToDateCheckInput Include="facil.yaml" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Facil" Version="2.5.7" />
    <PackageReference Update="FSharp.Core" Version="6.0.6" />
  </ItemGroup>

</Project>

Should probably officially document this somewhere...

In any case: I have probably spent longer just writing this than I would have spent implementing the flag you request, but I really want to make sure that it's not a bad idea, and right now I think it may be, since it may push developers out of the "pit of success".

from facil.

isaacabraham avatar isaacabraham commented on June 24, 2024

Hi @cmeeren and thanks for the detailed reply :-) And yes, we know that this is not an ideal place to be in. The reason for it is that the build project is also used not just for standard CI build but for some automation and ad-hoc operational business tasks that use types and functions from the "main" project. I'm hoping that we can move away from this approach in the short/medium term.

Splitting the Facil related code into its own project sounds like a really good idea and might work around the issue we're seeing here anyway, so we'll give that a try - thanks.

Would you mind leaving this issue open for discussion (or closing it and moving to a dedicated Discussion in the repo?).

from facil.

cmeeren avatar cmeeren commented on June 24, 2024

I'm closing this issue since I think it is best solved by the tips I have provided, but feel free to continue discussion. I will re-open if I am convinced that something needs to be changed in Facil.

from facil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.