aya-lang / aya

Pocket sized programs
MIT License
54 stars 3 forks source link

Add Maven build system #106

Closed BlazingTwist closed 4 days ago

BlazingTwist commented 2 weeks ago

Counter-draft to #105 for comparison.

Changes

I have changed the return value to 0 for executions that terminate on a successful result. This way the test-runner can distinguish failed tests from passing ones. (To ignore the whitespace changes, you can append &w=1 to this url)


About Dependencies

This change sources the dependencies from the maven-central repository where possible. I was unable to find the source of 'java-math-numerical' so that was moved into a 'local repository'.


About IDEs

IntelliJ

IntelliJ users should:

Now you can run phases from the right sidebar: image

Note that each phase will run its upper neighbor as a dependency. So package will run test which runs compile... Except for clean which stands in isolation and deletes the target directory.

Eclipse

Eclipse users should:

Now you can run some phases. I don't know why Eclipse does not offer the full set. image

CLI

You can also run (multiple) phases from the cli. E.g. to do a full rebuild: mvn clean package Afterwards, the fat jar is in target/Aya-<version>.jar


TODO

nick-paul commented 2 weeks ago

This is great, thanks for taking the time to put this together. I tested it on the CLI and in eclipse (but mostly CLI since I'm trying to automate builds which is what started me down the gradle rabbit hole originally).

I spent some time playing around with maven, making some modifications, learning the build lifecycle, testing adding new build scripts, etc. and I feel comfortable enough with it to prefer this solution over #105 so I think we should go with this one.

As far as the remaining TODOs go

BlazingTwist commented 1 week ago

I've gone a bit unorthodox and made 'packaging the release.zip' a part of the 'verify' phase. This way packaging the executable jar and final zip are separated.

I've also noticed that test.aya does not run std/test_math.aya and std/test_queue.aya. Does it make sense to use :{sys.readdir} to automatically pick up on tests?

Also: you probably want to adjust the <groupId> to match your branding. As well as the <version> (I'm not super sure which version aya is right now)

BlazingTwist commented 1 week ago

About 01da674

I've had an issue where the error log would be printed interleaved with the normal logs, making troubleshooting difficult. With this change the error log is shown as the failure cause, like this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.1.0:run (run-aya-tests) on project aya: An Ant BuildException has occured: The following error occurred while executing this line: [ERROR] D:\Code_Forks\aya\build-scripts\run-aya-tests-build.xml:43: The following error occurred while executing this line: [ERROR] D:\Code_Forks\aya\build-scripts\run-aya-tests-build.xml:77: AssertError: [ERROR] Expected: "< 0 .84147098 >" [ERROR] Received: "< 0 ,84147098 >" ... (stacktrace)

nick-paul commented 4 days ago

Also: you probably want to adjust the to match your branding. As well as the (I'm not super sure which version aya is right now)

Since 0.4 has already bee released, right now we are essentially on 0.5-dev though the versioning has been pretty hand-wavy up until now. We can probably make things a little more consistent moving forward with help from #110

I'm going to go ahead and merge this as is. We can clean up some of the active PRs and then switch to 0.5