erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 267 forks source link

Add rebar3 support to YAWS build processes #262

Open oubiwann opened 8 years ago

oubiwann commented 8 years ago

Status: Proposal

Branch Location: https://github.com/erlsci/yaws/tree/rebar3-support

Branch Build Status: https://travis-ci.org/erlsci/yaws

Background: This has come up in two separate tickets, with a little conversation around them both that may be useful for context. In particular:

Tasks:

Tasks that were proposed but decided not to do (at least, not in this branch):

The following are no longer present, due to changes in the YAWS codebase since the creation of this ticket:

vinoski commented 8 years ago

@oubiwann: regarding your note in #254 about make (and assuming I understood it correctly): keep in mind that Yaws also provides a full automake-based build system, used by many/most of its long-time users. All the original rebar support was kept completely separate from the automake support, and rebar3 support needs to be kept separate as well. For that reason I don't like the idea of mixing make and rebar3.

oubiwann commented 8 years ago

@vinoski Got it, and good to know. That was for a separate project that had YAWS as a dep; it's not something I had (yet) considered for YAWS itself when adding rebar3 support ... and now the thought won't arise :-) Thanks!

oubiwann commented 8 years ago

Making good progress on this. Not too much to do for the most part -- rebar3 compile is working now, though there is more to checkout and update.

One note on testing so far:

I'll keep at it, but I'd saw the branch is ready for others to start testing rebar3 compile. I want to dig into the YAWS_DEV_MODE a bit more before actively seeking volunteers to seriously test ...

vinoski commented 8 years ago

Great, thanks for doing this.

Regarding Travis, we had a new commit in the past 12 hours and that build failed only on R16B03, but it passed just fine when I ran it with R16B03 in my own clone. We'll have to keep an eye on it.

capflam commented 8 years ago

This is a timing issue. By restarting the builds that failed, and not all builds, it works. A solution would be to rewrite tests that depend on a timer but this will be boring.

oubiwann commented 8 years ago

I've confirmed that rebar3-based projects which declare this branch as a dep will successfully build YAWS using only rebar3.

After I get a chance to make some other updates, I'll send out an email on the mail list asking for interested individuals to give the branch a go and report any issues.

vinoski commented 8 years ago

@oubiwann: looking good! I suspect getting the tests to work will take some effort, since we never got them working fully with rebar.

oubiwann commented 8 years ago

I've reconsidered adding rebar3 to the YAWS_DEV_MODE mix. Maybe in the future, but for now it distracts from the core purpose of this ticket.

oubiwann commented 7 years ago

Trying to get back to this. Just did a git rebase against latest master. Will update dev tasks in ticket description (above).

expelledboy commented 6 years ago

Does yaws have build support for rebar3 yet?

vinoski commented 6 years ago

Official support, no. But I know a number of users use rebar3 successfully with Yaws without official support, though I don't know the details of how they do it, and unfortunately none has offered to pitch in and help on this issue.

leoliu commented 6 years ago

For using Yaws from rebar3 as an embedded server it is mostly working except one thing yaws_sendfile. yaws_sendfile always starts yaws_sendfile_drv even if configured to use erlang's sendfile and so it will crash immediately because the port drv not compiling in rebar3. Making yaws_sendfile starts yaws_sendfile_drv on demand, or drop yaws_sendfile_drv and depend solely on Erlang's sendfile will help a lot.

expelledboy commented 6 years ago

So I managed to get it working I think, using the following rebar.config file.

{deps,
 [
  {yaws,
   {git, "https://github.com/klacke/yaws.git",
    {tag, "yaws-2.0.5"}}}
 ]}.

{plugins, [{pc, "1.6.0"}]}.

{overrides,
 [
  {override, yaws,
   [
    {plugins, [pc]},
    {provider_hooks,
     [{post, [
              {compile, {pc, compile}},
              {clean, {pc, clean}}
             ]
      }]
    }
   ]}
 ]}.

Hope others find this useful!

vinoski commented 6 years ago

Thanks @leoliu and @expelledboy, I'm sure others will find this information useful.

expelledboy commented 6 years ago

Perhaps you could add this to your top level README? With everyone moving to rebar3 this is probably the most pertinent question to a developer coming across yaws for the first time.

oubiwann commented 6 years ago

There's a branch linked at top of this ticket -- that branch works with rebar3. The guts are complete.

The reasons this work stalled out were all items in the tasks list not marked with a "check" in the ticket description ... the time needed to create new rebar3 templates for yaws was one of the biggest inhibitors.

I'll rebase the branch off of the latest master and push, so that it's up to date and ready to work on by other contributors.

Update: Rebased.

vinoski commented 6 years ago

Thanks @oubiwann!

vinoski commented 5 years ago

I've revived the original rebar3-support branch and pushed it here. It probably needs a little work, but hopefully we can bring it to master soon.

jesperes commented 3 years ago

What is the status of this now? I have some minor improvements to rebar.config.script and yaws.app.src.script (avoid regenerating files unless they have changed).

vinoski commented 3 years ago

I keep the rebar3-support branch up to date. There's still a lot of work to do on it before it can merge, though. Until then, feel free to submit a PR against rebar3-support.

robertoaloi commented 3 years ago

It would be really nice to get rebar3 support in master, since long-running branches are often painful to maintain. ~Anything special which is left to do? Anything we can help with?~ Just saw the issue task list 🤦

oubiwann commented 3 years ago

Hehe -- was just writing a response, and also just saw your edits ... so, nothing to add!

oubiwann commented 3 years ago

Well, maybe I can add something: I think the two most important things to do are probably updating the tests, and perhaps a moderately distant second, update the templates.

@vinoski can provide the definitive assessment 😄

vinoski commented 3 years ago

@oubiwann is correct — the tests are the biggest blocker, and the templates need work. The tests take advantage of running in an automake build environment, and so far I haven't figured out a way to either replicate that with rebar3 or rewrite it to take a different approach. And of course there could be other problems waiting once we get past that.