diff --git a/Makefile b/Makefile index 0c51b029c81..80eaf537279 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ include version.mk -REBAR?=$(shell echo `pwd`/bin/rebar) +REBAR3?=$(shell echo `pwd`/bin/rebar3) ERLFMT?=$(shell echo `pwd`/bin/erlfmt) # Handle the following scenarios: @@ -120,7 +120,7 @@ help: .PHONY: couch # target: couch - Build CouchDB core, use ERL_COMPILER_OPTIONS to provide custom compiler's options couch: config.erl - @COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) compile $(COMPILE_OPTS) + @[ -e bin/couchjs ] || COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR3) compile $(COMPILE_OPTS) @cp apps/couch/priv/couchjs bin/ @@ -140,8 +140,8 @@ fauxton: share/www .PHONY: escriptize # target: escriptize - Build CLI tools escriptize: couch - @$(REBAR) -r escriptize apps=weatherreport - @cp apps/weatherreport/weatherreport bin/weatherreport + @[ -e bin/weatherreport ] ||$(REBAR3) escriptize -a weatherreport + @cp _build/default/bin/weatherreport bin/weatherreport ################################################################################ @@ -488,7 +488,7 @@ config.erl: apps/docs/build: ifeq ($(with_docs), 1) - @cd apps/docs; $(MAKE) + @cd _build/default/lib/docs; $(MAKE) endif diff --git a/apps/couch/rebar.config.script b/apps/couch/rebar.config.script index a5b23906f71..03d6ae32155 100644 --- a/apps/couch/rebar.config.script +++ b/apps/couch/rebar.config.script @@ -12,8 +12,8 @@ Rebar3MixPath = case erlang:function_exported(rebar3, main, 1) of - true -> "apps/couch/"; % rebar3 - false -> "" % mix + true -> "apps/couch/"; % rebar3 + false -> "" % mix end. CopyIfDifferent = fun(Path, Contents) -> @@ -237,8 +237,54 @@ end. PlatformDefines = [ {platform_define, "win32", 'WINDOWS'} ]. + +DepDescs = [ +%% Independent Apps +{config, {url, "https://github.com/jiahuili430/couchdb-config.git"}, {branch, "82-rebar3"}}, +{b64url, "b64url", {tag, "1.0.3"}}, +{ets_lru, "ets-lru", {tag, "1.1.0"}}, +{khash, {url, "https://github.com/jiahuili430/couchdb-khash"}, {branch, "82-rebar3"}}, +{snappy, {url, "https://github.com/jiahuili430/couchdb-snappy"}, {branch, "82-rebar3"}}, + +%% Non-Erlang deps +{docs, {url, "https://github.com/apache/couchdb-documentation"}, {branch, "main"}}, + +%% Third party deps +{folsom, {url, "https://github.com/jiahuili430/couchdb-folsom"}, {branch, "82-rebar3"}}, +{hyper, {url, "https://github.com/jiahuili430/couchdb-hyper"}, {branch, "82-rebar3"}}, +{ibrowse, "ibrowse", {tag, "CouchDB-4.4.2-5"}}, +{jiffy, "jiffy", {tag, "1.1.1"}}, +{mochiweb, "mochiweb", {tag, "v3.0.0"}}, +{recon, "recon", {tag, "2.5.2"}} +]. + +WithProper = lists:keyfind(with_proper, 1, CouchConfig) == {with_proper, true}. + +OptionalDeps = case WithProper of + true -> + [{proper, {url, "https://github.com/proper-testing/proper"}, {tag, "v1.4"}}]; + false -> + [] +end. + +BaseUrl = "https://github.com/apache/". + +MakeDep = fun + ({AppName, {url, Url}, Version}) -> + {AppName, {git, Url, Version}}; + ({AppName, {url, Url}, Version, Options}) -> + {AppName, {git, Url, Version}, Options}; + ({AppName, RepoName, Version}) -> + Url = BaseUrl ++ "couchdb-" ++ RepoName ++ ".git", + {AppName, {git, Url, Version}}; + ({AppName, RepoName, Version, Options}) -> + Url = BaseUrl ++ "couchdb-" ++ RepoName ++ ".git", + {AppName, {git, Url, Version}, Options} +end. + AddConfig = [ - {plugins, [{pc, "~> 1.0"}]}, + {deps, lists:map(MakeDep, DepDescs ++ OptionalDeps)}, + {plugins, [{pc, "~> 1.0"}]}, {artifacts, [ "priv/couch_ejson_compare.so", "priv/couchjs", diff --git a/rebar.config.script b/rebar.config.script index 4eea71a7531..87b3ba3c247 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -104,53 +104,8 @@ end. os:putenv("COUCHDB_APPS_CONFIG_DIR", filename:join([COUCHDB_ROOT, "rel/apps"])). -DepDescs = [ -%% Independent Apps -{config, {url, "https://github.com/jiahuili430/couchdb-config.git"}, {branch, "82-rebar3"}}, -{b64url, "b64url", {tag, "1.0.3"}}, -{ets_lru, "ets-lru", {tag, "1.1.0"}}, -{khash, {url, "https://github.com/jiahuili430/couchdb-khash"}, {branch, "82-rebar3"}}, -{snappy, {url, "https://github.com/jiahuili430/couchdb-snappy"}, {branch, "82-rebar3"}}, - -%% Non-Erlang deps -{docs, {url, "https://github.com/apache/couchdb-documentation"}, {branch, "main"}}, - -%% Third party deps -{folsom, {url, "https://github.com/jiahuili430/couchdb-folsom"}, {branch, "82-rebar3"}}, -{hyper, {url, "https://github.com/jiahuili430/couchdb-hyper"}, {branch, "82-rebar3"}}, -{ibrowse, "ibrowse", {tag, "CouchDB-4.4.2-5"}}, -{jiffy, "jiffy", {tag, "1.1.1"}}, -{mochiweb, "mochiweb", {tag, "v3.0.0"}}, -{recon, "recon", {tag, "2.5.2"}} -]. - -WithProper = lists:keyfind(with_proper, 1, CouchConfig) == {with_proper, true}. - -OptionalDeps = case WithProper of - true -> - [{proper, {url, "https://github.com/proper-testing/proper"}, {tag, "v1.4"}}]; - false -> - [] -end. - -BaseUrl = "https://github.com/apache/". - -MakeDep = fun - ({AppName, {url, Url}, Version}) -> - {AppName, {git, Url, Version}}; - ({AppName, {url, Url}, Version, Options}) -> - {AppName, {git, Url, Version}, Options}; - ({AppName, RepoName, Version}) -> - Url = BaseUrl ++ "couchdb-" ++ RepoName ++ ".git", - {AppName, {git, Url, Version}}; - ({AppName, RepoName, Version, Options}) -> - Url = BaseUrl ++ "couchdb-" ++ RepoName ++ ".git", - {AppName, {git, Url, Version}, Options} -end. - AddConfig = [ {require_otp_vsn, "23|24|25"}, - {deps, lists:map(MakeDep, DepDescs ++ OptionalDeps)}, {erl_opts, [{i, "../"}, {d, 'COUCHDB_ERLANG_VERSION', VerString}]}, {eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}, {dialyzer, [