Giter VIP home page Giter VIP logo

Comments (8)

duncanmak avatar duncanmak commented on August 26, 2024

I started working on this, my patches are here - https://github.com/duncanmak/mill/tree/generate-zipmap

from mill.

drhumlen avatar drhumlen commented on August 26, 2024

@duncanmak Looks pretty good!

But how about instead of actually generating source files (which is kinda messy?), just print out the lines needed to go into the file and paste them in by-hand?

...Because I'm thinking this is a job you don't normally to very often; maybe it's a one-time-job. Just generate the code necessary, paste it in there, and call it a day.

But of course keep the code for generating the code around; with unit tests! (for risk-free refactoring in the future)

e.g. something like this:

assert(generateZipMap(2) == """def zipMap[A, B, Z](a: A, b: B, z: Z) = .......""")

Opinions? @lihaoyi ?

from mill.

lihaoyi avatar lihaoyi commented on August 26, 2024

from mill.

duncanmak avatar duncanmak commented on August 26, 2024

Okay - I did a bit more work tonight and now I have code-gen for mill.define.Applicative, mill.define.Target and the test ApplicativeTests.

I tested it by running the generate.sc scripts that generate FooGenerated.scala files, and compiling it using sbt core/test. It's all compiling and the tests pass.

The next step is to patch build.sbt and build.sc to run these generate.sc files prior to actually compiling the sources.

from mill.

lihaoyi avatar lihaoyi commented on August 26, 2024

@duncanmak any updates on this one?

from mill.

duncanmak avatar duncanmak commented on August 26, 2024

Hey @lihaoyi, I added the code generation into build.sc just now and now it runs as part of the mill build. The commit is here - https://github.com/duncanmak/mill/commit/1b27a0b2e56ceccaaffa4b3c49d4b8aa14aab6b6

The SBT part felt really above my head, so I'd need more direction for how best to integrate the code generation into build.sbt.

from mill.

duncanmak avatar duncanmak commented on August 26, 2024

I submitted #81 which is my first completed attempt of implementing this issue.

from mill.

duncanmak avatar duncanmak commented on August 26, 2024

@lihaoyi merged #81 so I'm closing this.

from mill.

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.