{"action":"opened","issue":{"url":"https://api.github.com/repos/rebar/rebar3/issues/675","labels_url":"https://api.github.com/repos/rebar/rebar3/issues/675/labels{/name}","comments_url":"https://api.github.com/repos/rebar/rebar3/issues/675/comments","events_url":"https://api.github.com/repos/rebar/rebar3/issues/675/events","html_url":"https://github.com/rebar/rebar3/issues/675","id":98350742,"number":675,"title":"Add build configuration management","user":{"login":"jeanparpaillon","id":832572,"avatar_url":"https://avatars.githubusercontent.com/u/832572?v=3","gravatar_id":"","url":"https://api.github.com/users/jeanparpaillon","html_url":"https://github.com/jeanparpaillon","followers_url":"https://api.github.com/users/jeanparpaillon/followers","following_url":"https://api.github.com/users/jeanparpaillon/following{/other_user}","gists_url":"https://api.github.com/users/jeanparpaillon/gists{/gist_id}","starred_url":"https://api.github.com/users/jeanparpaillon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeanparpaillon/subscriptions","organizations_url":"https://api.github.com/users/jeanparpaillon/orgs","repos_url":"https://api.github.com/users/jeanparpaillon/repos","events_url":"https://api.github.com/users/jeanparpaillon/events{/privacy}","received_events_url":"https://api.github.com/users/jeanparpaillon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-31T09:17:57Z","updated_at":"2015-07-31T09:17:57Z","closed_at":null,"body":"Hi,\r\nThis is a proposal to add build configuration system to rebar3.\r\n\r\n# Rationale\r\n\r\nApplications made of many, some optional, components have a need for enabling/disabling them at build time. Additionally, C ports often (always ?) requires complex configuration to be able to compile on many platforms. These applications include, for instance: otp, erocci (http://github.com/erocci/erocci), ejabberd or (outside erlang world) the linux kernel, busybox, etc.\r\n\r\nThere is no tools for handling that problem in the erlang world. erocci, ejabberd or the otp platform use autoconf, which is not really integrated with rebar3 (not at all :) ). For instance, with erocci, if I use autoconf for generating a rebar.config file, rebar3 will download the dependancies after configure is run, then it is difficult to configure a dependancy.\r\n\r\nSo, I am working on a build configuration system which would solve this problem.\r\n\r\nSo far, I have started an independant application, econfig (http://github.com/erocci/econfig) which can read a list of configuration models from <app>.econfig files and (eventually) configuration values from one .econfig file, manage dependancies between configuration items (they can depend on another app' configuration) and get the missing values from various means: user input, default values, etc.\r\n\r\nThe standalone version, as a prototype, is fine and now I would like to integrate with rebar3.\r\n\r\n# Problem\r\n\r\nTo solve the above mentioned problem, the configuration phase would occur once all plugins and dependancies have been fetched: each of them could contain one or several <app>.econfig files.\r\n\r\nI am providing an API to get configuration values from a rebar.config.script file, similar to application environment OTP API. It means, of course, the .script file can not be executed before econfig has been run and values set.\r\n\r\n# Solution\r\n\r\n1/ Do not run .script files before all deps have been fetched\r\n2/ Once all source code have been fetched, lookup *.econfig files and run econfig if any.\r\n3/ Reload all rebar.config files, executing .script wherever relevant.\r\n\r\n# Limitation\r\n\r\n.script can not change deps and plugins list\r\nWe have recently introduced 'excluded_apps' rebar.config keyword which allow to download a dep, but not build it.\r\n\r\n# Possible problem in existing projects\r\n\r\n...would anyone use .script to manage deps and plugins.\r\n\r\n# Question, finally :)\r\n\r\nDoes it make sense for you ?\r\nI have digged into the code to find out how to reload all rebar.config once deps have been checked out, but I am not sure to find the right way. Can anyone point me out how to implement my solution and propose a patch for that ?"}}