Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dune-build-info only works when public_name is specified, even if only mode is JS #4444

Closed
phated opened this issue Apr 5, 2021 · 16 comments · Fixed by #5049
Closed

dune-build-info only works when public_name is specified, even if only mode is JS #4444

phated opened this issue Apr 5, 2021 · 16 comments · Fixed by #5049
Milestone

Comments

@phated
Copy link

phated commented Apr 5, 2021

Expected Behavior

I was expecting to be able to include dune-build-info (specifically the project version) in an executable target that only supports the js mode.

For example:

(executable
 (name Example)
 (modes js)
 (modules Example)
 (libraries dune-build-info))

Actual Behavior

Build_info.V1.version () is always None because the executable doesn't specify a public_name, but adding a public_name if I'm only specifying (modes js) results in this error:

Error: No installable mode found for this executable.
When public_name is set, one of the following modes is required:
- exe
- native
- byte

Reproduction

  1. Clone https://github.com/phated/dune-build-info-jsoo
  2. Run esy inside the repo
  3. Run esy test

Adding an exe mode and public_name to that executable allows the JS to include the project version.

Specifications

  • Version of dune (output of dune --version): 2.8.5
  • Version of ocaml (output of ocamlc --version): 4.11.0
  • Operating system (distribution and version): MacOS 10.15 (Catalina)
@ghost
Copy link

ghost commented Apr 6, 2021

Have you tried with an explicit install stanza?

(install
  (section lib)
  (files foo.js))

Dune doesn't know where .js files should be installed, so you need to tell it.

BTW, the build info will always be None from inside the _build directory. This is to preserve good incrementality. It's only when the files are copied out of the build directory that the build info are set. There are two ways for files to be copied out (and rewritten):

  • installation
  • promotion

You can ask Dune to automatically promote your .js files with:

(executable
 ...
 (promote (until-clean)))

@rgrinberg
Copy link
Member

I second what Jeremie said. Though you probably want:

(install
  (section bin)
  (files foo.js))

If your js file is meant to be executed.

@phated
Copy link
Author

phated commented Apr 6, 2021

Thanks! I wonder if I'm still doing something wrong because when I add this to my dune file:

(install
 (section bin)
 (files Example.bc.js))

And then run dune install --prefix _install, I still get None for the version in the resulting file.

I added a commit at phated/dune-build-info-jsoo@ae3fdd7

@ghost
Copy link

ghost commented Apr 7, 2021

Can you grep the .js file for DUNE_PLACEHOLDER? I'd like to see if the placeholder whether the placeholder is preserved or whether it is scrambled for some reason.

@rgrinberg
Copy link
Member

I'd like to see if the placeholder whether the placeholder is preserved or whether it is scrambled for some reason.

I checked and couldn't find the place holder. Here's the JS:

// Generated by js_of_ocaml 3.9.1
(function(a){"use strict";var
ak=" : flags Open_text and Open_binary are not compatible",Y="Sys_error",aj="Invalid_argument",X=0xf0,ai=0x800,ah="jsError",s=1024,ag="End_of_file",j=0x80,af="Failure",V="Undefined_recursive_module",W=" : flags Open_rdonly and Open_wronly are not compatible",U="([^/]*)",T=512,ae="Stack_overflow",e="",D="^",R=" : file already exists",S=0xe0,q=0x3f,Q=0xdfff,ad="Not_found",P="Assert_failure",n="/",C=128,aa="Sys_blocked_io",ab="fd ",ac=0xdc00,O="Out_of_memory",$="Match_failure",g=248,Z="Division_by_zero",_="static/";function
x(c,a){if(c.fun)return x(c.fun,a);if(typeof
c!=="function")return c;var
b=c.length|0;if(b===0)return c.apply(null,a);var
e=a.length|0,d=b-e|0;if(d==0)return c.apply(null,a);else
if(d<0)return x(c.apply(null,a.slice(0,b)),a.slice(b));else
return function(){var
e=arguments.length==0?1:arguments.length,d=new
Array(a.length+e);for(var
b=0;b<a.length;b++)d[b]=a[b];for(var
b=0;b<arguments.length;b++)d[a.length+b]=arguments[b];return x(c,d)}}var
aY=0;function
ar(){return aY++}function
a0(b,a){throw[0,b,a]}function
a1(b,a){if(b==0)return e;if(a.repeat)return a.repeat(b);var
d=e,c=0;for(;;){if(b&1)d+=a;b>>=1;if(b==0)return d;a+=a;c++;if(c==9)a.slice(0,1)}}function
I(c,b,a){var
d=String.fromCharCode;if(b==0&&a<=4096&&a==c.length)return d.apply(null,c);var
f=e;for(;0<a;b+=s,a-=s)f+=d.apply(null,c.slice(b,b+Math.min(a,s)));return f}function
ap(a){if(a.t==2)a.c+=a1(a.l-a.c.length,"\0");else
a.c=I(a.c,0,a.c.length);a.t=0}function
aB(a){if(a.length<24){for(var
b=0;b<a.length;b++)if(a.charCodeAt(b)>127)return false;return true}else
return!/[^\x00-\x7f]/.test(a)}function
J(f){for(var
l=e,c=e,h,g,i,a,b=0,k=f.length;b<k;b++){g=f.charCodeAt(b);if(g<j){for(var
d=b+1;d<k&&(g=f.charCodeAt(d))<j;d++);if(d-b>T){c.substr(0,1);l+=c;c=e;l+=f.slice(b,d)}else
c+=f.slice(b,d);if(d==k)break;b=d}a=1;if(++b<k&&((i=f.charCodeAt(b))&-64)==C){h=i+(g<<6);if(g<S){a=h-0x3080;if(a<j)a=1}else{a=2;if(++b<k&&((i=f.charCodeAt(b))&-64)==C){h=i+(h<<6);if(g<X){a=h-0xe2080;if(a<ai||a>=0xd7ff&&a<0xe000)a=2}else{a=3;if(++b<k&&((i=f.charCodeAt(b))&-64)==C&&g<0xf5){a=i-0x3c82080+(h<<6);if(a<0x10000||a>0x10ffff)a=3}}}}}if(a<4){b-=a;c+="\ufffd"}else
if(a>0xffff)c+=String.fromCharCode(0xd7c0+(a>>10),ac+(a&0x3FF));else
c+=String.fromCharCode(a);if(c.length>s){c.substr(0,1);l+=c;c=e}}return l+c}function
o(c,a,b){this.t=c;this.c=a;this.l=b}o.prototype.toString=function(){switch(this.t){case
9:return this.c;default:ap(this);case
0:if(aB(this.c)){this.t=9;return this.c}this.t=8;case
8:return this.c}};o.prototype.toUtf16=function(){var
a=this.toString();if(this.t==9)return a;return J(a)};o.prototype.slice=function(){var
a=this.t==4?this.c.slice():this.c;return new
o(this.t,a,this.l)};function
an(a){return new
o(0,a,a.length)}function
d(a){return an(a)}function
H(b,a){a0(b,d(a))}var
c=[0];function
aN(a){H(c.Failure,a)}function
aR(a){return a.toUtf16()}if(a.process&&a.process.cwd)var
v=a.process.cwd().replace(/\\/g,n);else
var
v="/static";if(v.slice(-1)!==n)v+=n;function
aS(a){a=aR(a);if(a.charCodeAt(0)!=47)a=v+a;var
d=a.split(n),b=[];for(var
c=0;c<d.length;c++)switch(d[c]){case"..":if(b.length>1)b.pop();break;case".":break;case"":if(b.length==0)b.push(e);break;default:b.push(d[c]);break}b.orig=a;return b}function
at(a){return a
instanceof
o}function
aQ(a){return at(a)}function
aJ(a){return new
o(4,a,a.length)}function
u(a){return a}function
a6(f){for(var
g=e,b=g,a,i,c=0,h=f.length;c<h;c++){a=f.charCodeAt(c);if(a<j){for(var
d=c+1;d<h&&(a=f.charCodeAt(d))<j;d++);if(d-c>T){b.substr(0,1);g+=b;b=e;g+=f.slice(c,d)}else
b+=f.slice(c,d);if(d==h)break;c=d}if(a<ai){b+=String.fromCharCode(0xc0|a>>6);b+=String.fromCharCode(j|a&q)}else
if(a<0xd800||a>=Q)b+=String.fromCharCode(S|a>>12,j|a>>6&q,j|a&q);else
if(a>=0xdbff||c+1==h||(i=f.charCodeAt(c+1))<ac||i>Q)b+="\xef\xbf\xbd";else{c++;a=(a<<10)+i-0x35fdc00;b+=String.fromCharCode(X|a>>18,j|a>>12&q,j|a>>6&q,j|a&q)}if(b.length>s){b.substr(0,1);g+=b;b=e}}return g+b}function
aK(a){var
b=9;if(!aB(a))b=8,a=a6(a);return new
o(b,a,a.length)}function
aA(a){return aK(a)}function
b(a){H(c.Sys_error,a)}function
y(a){if((a.t&6)!=0)ap(a);return a.c}function
aZ(a){a=y(a);b(a+": No such file or directory")}function
as(a){H(c.Invalid_argument,a)}function
am(){as("index out of bounds")}function
ao(a,b){switch(a.t&6){default:if(b>=a.c.length)return 0;case
0:return a.c.charCodeAt(b);case
4:return a.c[b]}}function
aI(b,a){if(a>>>0>=b.l)am();return ao(b,a)}function
p(a){if(a<0)as("Bytes.create");return new
o(a?2:9,e,a)}function
F(a){return a.l}function
E(c){if(a.Uint8Array)var
d=new(a.Uint8Array)(c.l);else
var
d=new
Array(c.l);var
f=c.c,e=f.length,b=0;for(;b<e;b++)d[b]=f.charCodeAt(b);for(e=c.l;b<e;b++)d[b]=0;c.c=d;c.t=4;return d}function
t(d,e,b,f,c){if(c==0)return 0;if(f==0&&(c>=b.l||b.t==2&&c>=b.c.length)){b.c=d.t==4?I(d.c,e,c):e==0&&d.c.length==c?d.c:d.c.substr(e,c);b.t=b.c.length==b.l?0:2}else
if(b.t==2&&f==b.c.length){b.c+=d.t==4?I(d.c,e,c):e==0&&d.c.length==c?d.c:d.c.substr(e,c);b.t=b.c.length==b.l?0:2}else{if(b.t!=4)E(b);var
g=d.c,h=b.c;if(d.t==4)if(f<=e)for(var
a=0;a<c;a++)h[f+a]=g[e+a];else
for(var
a=c-1;a>=0;a--)h[f+a]=g[e+a];else{var
i=Math.min(c,g.length-e);for(var
a=0;a<i;a++)h[f+a]=g.charCodeAt(e+a);for(;a<c;a++)h[f+a]=0}}return 0}function
aH(a,b,c,d,e){t(u(a),b,c,d,e);return 0}function
al(){}function
f(a){this.data=a}f.prototype=new
al();f.prototype.truncate=function(a){var
b=this.data;this.data=p(a|0);t(b,0,this.data,0,a)};f.prototype.length=function(){return F(this.data)};f.prototype.write=function(b,d,g,a){var
c=this.length();if(b+a>=c){var
e=p(b+a),f=this.data;this.data=e;t(f,0,this.data,0,c)}aH(d,g,this.data,b,a);return 0};f.prototype.read=function(c,a,d,b){var
e=this.length();t(this.data,c,a,d,b);return 0};f.prototype.read_one=function(a){return aI(this.data,a)};f.prototype.close=function(){};f.prototype.constructor=f;function
h(b,a){this.content={};this.root=b;this.lookupFun=a}h.prototype.nm=function(a){return this.root+a};h.prototype.lookup=function(a){if(!this.content[a]&&this.lookupFun){var
b=this.lookupFun(d(this.root),d(a));if(b!==0)this.content[a]=new
f(u(b[1]))}};h.prototype.exists=function(a){if(a==e)return 1;var
c=a+n,d=new
RegExp(D+c);for(var
b
in
this.content)if(b.match(d))return 1;this.lookup(a);return this.content[a]?1:0};h.prototype.readdir=function(c){var
g=c==e?e:c+n,h=new
RegExp(D+g+U),d={},b=[];for(var
f
in
this.content){var
a=f.match(h);if(a&&!d[a[1]]){d[a[1]]=true;b.push(a[1])}}return b};h.prototype.is_dir=function(a){var
d=a==e?e:a+n,f=new
RegExp(D+d+U),g=[];for(var
c
in
this.content){var
b=c.match(f);if(b)return 1}return 0};h.prototype.unlink=function(a){var
b=this.content[a]?true:false;delete
this.content[a];return b};h.prototype.open=function(a,c){if(c.rdonly&&c.wronly)b(this.nm(a)+W);if(c.text&&c.binary)b(this.nm(a)+ak);this.lookup(a);if(this.content[a]){if(this.is_dir(a))b(this.nm(a)+" : is a directory");if(c.create&&c.excl)b(this.nm(a)+R);var
d=this.content[a];if(c.truncate)d.truncate();return d}else
if(c.create){this.content[a]=new
f(p(0));return this.content[a]}else
aZ(this.nm(a))};h.prototype.register=function(c,a){if(this.content[c])b(this.nm(c)+R);if(at(a))this.content[c]=new
f(a);if(aQ(a))this.content[c]=new
f(u(a));else
if(a
instanceof
Array)this.content[c]=new
f(aJ(a));else
if(typeof
a==="string")this.content[c]=new
f(an(a));else
if(a.toString){var
d=u(aA(a.toString()));this.content[c]=new
f(d)}else
b(this.nm(c)+" : registering file with invalid content type")};h.prototype.constructor=h;function
aw(a){return F(a)}function
a3(b,a){return ao(b,a)}function
aG(d){var
c=aw(d),b=new
Array(c),a=0;for(;a<c;a++)b[a]=a3(d,a);return b}function
aF(a){if(a.t!=4)E(a);return a.c}function
aM(a,c,b){b&=0xff;if(a.t!=4){if(c==a.c.length){a.c+=String.fromCharCode(b);if(c+1==a.l)a.t=0;return 0}E(a)}a.c[c]=b;return 0}function
aL(b,a,c){if(a>>>0>=b.l)am();return aM(b,a,c)}function
l(a){this.fs=require("fs");this.fd=a}l.prototype=new
al();l.prototype.truncate=function(a){try{this.fs.ftruncateSync(this.fd,a|0)}catch(a){b(a.toString())}};l.prototype.length=function(){try{return this.fs.fstatSync(this.fd).size}catch(a){b(a.toString())}};l.prototype.write=function(h,d,e,g){var
c=aG(d);if(!(c
instanceof
a.Uint8Array))c=new(a.Uint8Array)(c);var
f=a.Buffer.from(c);try{this.fs.writeSync(this.fd,f,e,g,h)}catch(a){b(a.toString())}return 0};l.prototype.read=function(i,f,e,h){var
c=aF(f);if(!(c
instanceof
a.Uint8Array))c=new(a.Uint8Array)(c);var
g=a.Buffer.from(c);try{this.fs.readSync(this.fd,g,e,h,i)}catch(a){b(a.toString())}for(var
d=0;d<h;d++)aL(f,e+d,g[e+d]);return 0};l.prototype.read_one=function(e){var
d=new(a.Uint8Array)(1),c=a.Buffer.from(d);try{this.fs.readSync(this.fd,c,0,1,e)}catch(a){b(a.toString())}return c[0]};l.prototype.close=function(){try{this.fs.closeSync(this.fd)}catch(a){b(a.toString())}};l.prototype.constructor=l;function
k(a){this.fs=require("fs");this.root=a}k.prototype.nm=function(a){return this.root+a};k.prototype.exists=function(a){try{return this.fs.existsSync(this.nm(a))?1:0}catch(a){b(a.toString())}};k.prototype.readdir=function(a){try{return this.fs.readdirSync(this.nm(a))}catch(a){b(a.toString())}};k.prototype.is_dir=function(a){try{return this.fs.statSync(this.nm(a)).isDirectory()?1:0}catch(a){b(a.toString())}};k.prototype.unlink=function(a){try{var
c=this.fs.existsSync(this.nm(a))?1:0;this.fs.unlinkSync(this.nm(a))}catch(a){b(a.toString())}return c};k.prototype.open=function(g,d){var
a=require("constants"),c=0;for(var
f
in
d)switch(f){case"rdonly":c|=a.O_RDONLY;break;case"wronly":c|=a.O_WRONLY;break;case"append":c|=a.O_WRONLY|a.O_APPEND;break;case"create":c|=a.O_CREAT;break;case"truncate":c|=a.O_TRUNC;break;case"excl":c|=a.O_EXCL;break;case"binary":c|=a.O_BINARY;break;case"text":c|=a.O_TEXT;break;case"nonblock":c|=a.O_NONBLOCK;break}try{var
e=this.fs.openSync(this.nm(g),c);return new
l(e)}catch(a){b(a.toString())}};k.prototype.rename=function(c,a){try{this.fs.renameSync(this.nm(c),this.nm(a))}catch(a){b(a.toString())}};k.prototype.constructor=k;var
r=v.match(/[^\/]*\//)[0];function
a8(){return typeof
a.process!=="undefined"&&typeof
a.process.versions!=="undefined"&&typeof
a.process.versions.node!=="undefined"&&a.process.platform!=="browser"}var
w=[];if(a8())w.push({path:r,device:new
k(r)});else
w.push({path:r,device:new
h(r)});w.push({path:r+_,device:new
h(r+_)});function
aC(b){var
f=aS(b),b=f.join(n),e=b+n,c;for(var
d=0;d<w.length;d++){var
a=w[d];if(e.search(a.path)==0&&(!c||c.path.length<a.path.length))c={path:a.path,device:a.device,rest:b.substring(a.path.length,b.length)}}return c}function
aq(b,a){var
b=typeof
b=="string"?d(b):b,a=typeof
a=="string"?d(a):a,c=aC(b);if(!c.device.register)aN("cannot register file");c.device.register(c.rest,a);return 0}function
aO(){var
c=a.caml_fs_tmp;if(c)for(var
b=0;b<c.length;b++)aq(c[b].name,c[b].content);a.caml_create_file=aq;a.caml_fs_tmp=[];return 0}function
aP(){return 0}var
m=new
Array();function
G(f){var
a=m[f];if(!a.opened)b("Cannot flush a closed channel");if(!a.buffer||a.buffer==e)return 0;if(a.fd&&c.fds[a.fd]&&c.fds[a.fd].output){var
d=c.fds[a.fd].output;switch(d.length){case
2:d(f,a.buffer);break;default:d(a.buffer)}}a.buffer=e;return 0}function
az(e,f){var
a=m[e],c=d(f),b=aw(c);a.file.write(a.offset,c,0,b);a.offset+=b;return 0}function
a9(b){var
b=J(b),c=a;if(c.process&&c.process.stdout&&c.process.stdout.write)c.process.stderr.write(b);else{if(b.charCodeAt(b.length-1)==10)b=b.substr(0,b.length-1);var
d=c.console;d&&d.error&&d.error(b)}}function
a_(b){var
b=J(b),c=a;if(c.process&&c.process.stdout&&c.process.stdout.write)c.process.stdout.write(b);else{if(b.charCodeAt(b.length-1)==10)b=b.substr(0,b.length-1);var
d=c.console;d&&d.log&&d.log(b)}}function
z(d,f,e,a){if(c.fds===undefined)c.fds=new
Array();a=a?a:{};var
b={};b.file=e;b.offset=a.append?e.length():0;b.flags=a;b.output=f;c.fds[d]=b;if(!c.fd_last_idx||d>c.fd_last_idx)c.fd_last_idx=d;return d}function
a$(e,d,i){var
a={};while(d){switch(d[1]){case
0:a.rdonly=1;break;case
1:a.wronly=1;break;case
2:a.append=1;break;case
3:a.create=1;break;case
4:a.truncate=1;break;case
5:a.excl=1;break;case
6:a.binary=1;break;case
7:a.text=1;break;case
8:a.nonblock=1;break}d=d[2]}if(a.rdonly&&a.wronly)b(y(e)+W);if(a.text&&a.binary)b(y(e)+ak);var
f=aC(e),g=f.device.open(f.rest,a),h=c.fd_last_idx?c.fd_last_idx:0;return z(h+1,az,g,a)}z(0,az,new
f(p(0)));z(1,a_,new
f(p(0)));z(2,a9,new
f(p(0)));function
aT(e){var
d=c.fds[e];if(d.flags.wronly)b(ab+e+" is writeonly");var
a={file:d.file,offset:d.offset,fd:e,opened:true,out:false,refill:null};m[a.fd]=a;return a.fd}function
au(f){var
d=c.fds[f];if(d.flags.rdonly)b(ab+f+" is readonly");var
a={file:d.file,offset:d.offset,fd:f,opened:true,out:true,buffer:e};m[a.fd]=a;return a.fd}function
aU(){var
b=0;for(var
a=0;a<m.length;a++)if(m[a]&&m[a].opened&&m[a].out)b=[0,m[a].fd,b];return b}function
a2(a){return a}function
aV(h,e,i,g){var
c=m[h];if(!c.opened)b("Cannot output to a closed channel");var
a;if(i==0&&F(e)==g)a=e;else{a=p(g);t(e,i,a,0,g)}var
j=a2(a),d=y(j),f=d.lastIndexOf("\n");if(f<0)c.buffer+=d;else{c.buffer+=d.substr(0,f+1);G(h);c.buffer+=d.substr(f+1)}return 0}function
av(b,a,d,c){return aV(b,u(a),d,c)}function
aW(b,a){var
c=d(String.fromCharCode(a));av(b,c,0,1);return 0}function
i(d,e,b){if(b&&a.toplevelReloc)d=a.toplevelReloc(b);c[d+1]=e;if(b)c[b]=e}function
a4(){return[0,d("js_of_ocaml")]}function
a5(a){return 0}function
ay(a){return a}var
aX={};function
ax(a){return aX[a]}function
a7(b){if(b
instanceof
Array)return b;if(a.RangeError&&b
instanceof
a.RangeError&&b.message&&b.message.match(/maximum call stack/i))return ay(c.Stack_overflow);if(a.InternalError&&b
instanceof
a.InternalError&&b.message&&b.message.match(/too much recursion/i))return ay(c.Stack_overflow);if(b
instanceof
a.Error&&ax(ah))return[0,ax(ah),b];return[0,c.Failure,aA(String(b))]}function
N(a,b){return a.length==1?a(b):x(a,[b])}aO();var
L=[g,d(Y),-2];i(11,[g,d(V),-12],V);i(10,[g,d(P),-11],P);i(9,[g,d(aa),-10],aa);i(8,[g,d(ae),-9],ae);i(7,[g,d($),-8],$);i(6,[g,d(ad),-7],ad);i(5,[g,d(Z),-6],Z);i(4,[g,d(ag),-5],ag);i(3,[g,d(aj),-4],aj);i(2,[g,d(af),-3],af);i(1,L,Y);i(0,[g,d(O),-1],O);var
aE=d("unknown");function
K(a,c,b){return a[1]===c?(a[1]=b,1):0}ar(0);aT(0);var
A=au(1);au(2);var
B=[0,function(b){function
a(b){var
a=b;for(;;){if(a){var
c=a[2],d=a[1];try{G(d)}catch(a){a=a7(a);if(a[1]!==L)throw a;var
e=a}var
a=c;continue}return 0}}return a(aU(0))}];if(a5(0))for(;;){var
M=B[1],aD=[0,1];if(1-K(B,M,function(a,b){return function(c){if(K(a,1,0))aP(0);return N(b,0)}}(aD,M)))continue;break}ar(0);typeof
a4(0)==="number";av(A,aE,0,7);aW(A,10);G(A);N(B[1],0);return}(function(){return this}()));

@ghost
Copy link

ghost commented Apr 7, 2021

That's the issue then. Something must be scrambling the placeholder somehow.

@phated
Copy link
Author

phated commented Apr 14, 2021

That's the issue then. Something must be scrambling the placeholder somehow.

How should I determine if dune is doing it or something else?

@ghost
Copy link

ghost commented Apr 19, 2021

I can't think of anything in Dune that would cause that. I expect this is done by some "js minimiser" stage.

We have two options here:

  • try to understand what's going on, and see if we can find a way to make the placeholder method work with javascript targets. For instance, maybe there is a way in javascript to say "don't touch this string constant". I can help you here as I don't know much about javascript
  • accept that this method is fragile and doesn't work with javascript, and adapt Dune accordingly. For instance:
    • when the js mode is selected, don't use the placeholder method at the cost of more frequent rebuilds
    • add a general option to not use the placeholder method at all

@ghost
Copy link

ghost commented Apr 19, 2021

Might be worth pining esy developers about this BTW.

@phated
Copy link
Author

phated commented Apr 19, 2021

@jeremiedimino While digging into the artifacts, it seems that the build_info_data.ml-gen has this inside it:

let p0 = eval (Sys.opaque_identity "%%DUNE_PLACEHOLDER:64:vcs-describe:1:.%%%%%%%%%%%%%%%%%%%%%%%%%%")

Instead of the let p0 = "0.2.0" when there's also an exe target.

@rgrinberg
Copy link
Member

Perhaps @hhugo knows why jsoo removed the marker?

@ghost
Copy link

ghost commented Apr 20, 2021

@phated that's expected. The rational is explained here.

However, if you write an explicit version field in the dune-project file then the version will be hardcoded.

@phated
Copy link
Author

phated commented Apr 20, 2021

However, if you write an explicit version field in the dune-project file then the version will be hardcoded.

Yeah, that's what I am doing in the reproduction, so why is it still being set as opaque?

@ghost
Copy link

ghost commented Apr 21, 2021

To prevent the compiler from being too clever if eval gets inlined, since this could cause the string constant to be processed at compilation time. Maybe that's what happening with jsoo here?

@hhugo
Copy link
Collaborator

hhugo commented Oct 25, 2021

I'm pretty sure dune-build-info is broken with js_of_ocaml separate compilation. link_time_code_gen should be used in the jsoo codepath.

@hhugo hhugo mentioned this issue Nov 4, 2021
9 tasks
@hhugo
Copy link
Collaborator

hhugo commented Nov 4, 2021

fixed in #5049

@rgrinberg rgrinberg added this to the 3.0 milestone Nov 4, 2021
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Feb 11, 2022
…e-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info and dune-action-plugin (3.0.0)

CHANGES:

- Remove `uchar` and `seq` dummy ocamlfind libraries from dune's builtin
  library database (ocaml/dune#5260, @kit-ty-kate)

- Add a `DUNE_DIFF_COMMAND` environment variable to match `--diff-command`
  command-line parameter (@raphael-proust, fix ocaml/dune#5369, ocaml/dune#5375)

- Add support for odoc-link rules (ocaml/dune#5045, @lubegasimon)

- Dune will no longer generate documentation for hidden modules (ocaml/dune#5045,
  @lubegasimon)

- Parse the `native_pack_linker` field of `ocamlc -config` (ocaml/dune#5281, @TheLortex)

- Fix plugins with dot in the name (ocaml/dune#5182, @bobot, review @rgrinberg)

- Don't generate the dune-site build part when not needed (ocaml/dune#4861, @bobot,
  review @kit-ty-kate)

- Fix installation of implementations of virtual libraries (ocaml/dune#5150, fix ocaml/dune#3636,
  @rgrinberg)

- Run tests in all modes defined. Previously, jsoo was excluded. (@hhugo,
  ocaml/dune#5049, fix ocaml/dune#4951)

- Allow to configure the alias to run the jsoo tests (@hhugo, ocaml/dune#5049, ocaml/dune#4999)

- Set jsoo compilation flags in the `env` stanza (@hhugo, ocaml/dune#5049, ocaml/dune#1613)

- Allow to configure jsoo separate compilation in the `env` stanza. Previously,
  it was hard coded to always be enabled in the `dev` profile. (@hhugo, ocaml/dune#5049,
  fix ocaml/dune#970)

- Fix build-info version in jsoo executables (@hhugo, ocaml/dune#5049, fix ocaml/dune#4444)

- Pass `-no-check-prims` when building bytecode for jsoo (@hhugo, ocaml/dune#5049, ocaml/dune#4027)

- Fix jsoo builds when dynamically linked foreign archives are disabled
  (@hhugo, ocaml/dune#5049)

- Disallow empty packages starting from 3.0.  Empty packages may be
  re-enabled by adding the `(allow_empty)` to the package stanza in
  the dune-project file. (ocaml/dune#4867, fix ocaml/dune#2882, @kit-ty-kate, @rgrinberg)

- Add `link_flags` field to the `executable` field of `inline_tests` (ocaml/dune#5088,
  fix ocaml/dune#1530, @jvillard)

- In watch mode, use fsevents instead of fswatch on OSX (ocaml/dune#4937, ocaml/dune#4990, fixes
  ocaml/dune#4896 @rgrinberg)

- Remove `inotifywait` watch mode backend on Linux. We now use the inotify API
  exclusively (ocaml/dune#4941, @rgrinberg)

- Report cycles between virtual libraries and their implementation (ocaml/dune#5050,
  fixes ocaml/dune#2896, @rgrinberg)

- Warn when lang versions have an ignored suffix. `(lang dune 2.3.4)` or `(lang
  dune 2.3suffix)` were silently parsed as `2.3` and we know suggest to remove
  the prefix. (ocaml/dune#5040, @emillon)

- Allow users to specify dynamic dependencies in rules. For example `(deps
  %{read:foo.gen})` (ocaml/dune#4662, fixes ocaml/dune#4089, @jeremiedimino)

- Sandbox infer rules for menhir. Fixes possible "inconsistent assumptions"
  errors (ocaml/dune#5015, @rgrinberg)

- Experimental support for ctypes stubs (ocaml/dune#3905, fixes ocaml/dune#135, @mbacarella)

- Fix interpretation of `binaries` defined in the `env stanza`. Binaries
  defined in `x/dune` wouldn't be visible in `x/*/**/dune. (ocaml/dune#4975, fixes ocaml/dune#4976,
  @Leonidas-from-XIV, @rgrinberg)

- Do not list private libraries in package listings (ocaml/dune#4945, fixes ocaml/dune#4799,
  @rgrinberg)

- Allow spaces in cram test paths (ocaml/dune#4980, fixes ocaml/dune#4162, @rgrinberg)

- Improve error handling of misbehaving cram scripts. (ocaml/dune#4981, fix ocaml/dune#4230,
  @rgrinberg)

- Fix `foreign_stubs` inside a `tests` stanza. Previously, dune would crash
  when this field was present (ocaml/dune#4942, fix ocaml/dune#4946, @rgrinberg)

- Add the `enabled_if` field to `inline_tests` within the `library` stanza.
  This allows us to disable executing the inline tests while still allowing for
  compilation (ocaml/dune#4939, @rgrinberg)

- Generate a `dune-project` when initializing projects with `dune init proj ...`
  (ocaml/dune#4881, closes ocaml/dune#4367, @shonfeder)

- Allow spaces in the directory argument of the `subdir` stanza (ocaml/dune#4943, fixes
  ocaml/dune#4907, @rgrinberg)

- Add a `%{toolchain}` expansion variable (ocaml/dune#4899, fixes ocaml/dune#3949, @rgrinberg)

- Include dependencies of executables when creating toplevels (either `dune
  top` or `dune utop`) (ocaml/dune#4882, fixes ocaml/dune#4872, @Gopiancode)

- Fixes `opam` META file requires entry for private libs (ocaml/dune#4841, fixes ocaml/dune#4839, @toots)

- Fixes `dune exec` not adding .exe on Windows (ocaml/dune#4371, fixes ocaml/dune#3322, @MisterDA)

- Allow multiple cinaps stanzas in the same directory (ocaml/dune#4460, @rgrinberg)

- Fix `$ dune subst` in empty git repositories (ocaml/dune#4441, fixes ocaml/dune#3619, @rgrinberg)

- Improve interpretation of ansi escape sequence when spawning processes (ocaml/dune#4408,
  fixes ocaml/dune#2665, @rgrinberg)

- Allow `(package pkg)` in dependencies even if `pkg` is an installed package
  (ocaml/dune#4170, @bobot)

- Allow `%{version:pkg}` to work for external packages (ocaml/dune#4104, @kit-ty-kate)

- Add `(glob_files_rec <dir>/<glob>)` for globbing files recursively (ocaml/dune#4176,
  @jeremiedimino)

- Automatically generate empty `.mli` files for executables and tests (ocaml/dune#3768,
  fixes ocaml/dune#3745, @craigfe)

- Add `ocaml` command subgroup for OCaml related commands such as `utop`, `top`,
  and `merlin` (ocaml/dune#3936, @rgrinberg).

- Detect unknown variables more eagerly (ocaml/dune#4184, @jeremiedimino)

- Improve location of variables and macros in error messages (ocaml/dune#4205,
  @jeremiedimino)

- Auto-detect `dune-project` files as `dune` files in Emacs (ocaml/dune#4222, @shonfeder)

- Dune no longer automatically create or edit `dune-project` files
  (ocaml/dune#4239, fixes ocaml/dune#4108, @jeremiedimino)

- Warn if `dune-project` is not found (fatal in release mode) (ocaml/dune#5343, @emillon)

- Cleanup temporary files after running `$ dune exec`. (ocaml/dune#4260, fixes ocaml/dune#4243,
  @rgrinberg)

- Add a new subcommand `dune ocaml dump-dot-merlin` that prints a mix of all the
  merlin configuration of a directory (defaulting to the current directory) in
  the Merlin configuration syntax. (ocaml/dune#4250, @voodoos)

- Enable cram tests by default (ocaml/dune#4262, @rgrinberg)

- Drop support for opam 1.x (ocaml/dune#4280, @jeremiedimino)

- Stop calling `ocamlfind` to determine the library search path or
  library installation directory. This makes the behavior of Dune
  simpler and more reproducible (ocaml/dune#4281, @jeremiedimino)

- Remove the `external-lib-deps` command. This command was only
  approximative and the cost of maintainance was getting too high. We
  removed it to make room for new more important features (ocaml/dune#4298,
  @jeremiedimino)

- It is now possible to define action dependencies through a chain
  of aliases. (ocaml/dune#4303, @aalekseyev)

- If an .ml file is not used by an executable, Dune no longer report
  parsing error in this file (ocaml/dune#4330, @jeremiedimino)

- Add support for sandboxing using hard links (ocaml/dune#4360, Andrey Mokhov)

- Fix dune crash when `subdir` is an absolute path (ocaml/dune#4366, @anmonteiro)

- Changed the implementation of actions attached to aliases, as in
  `(rule (alias runtest) (action (run ./test)))`. A visible result for
  users is that such actions are now memoized for longer. For
  instance:
  ```
  $ echo '(rule (alias runtest) (action (echo "X=%{env:X=0}\n")))` > dune
  $ X=1 dune runtest
  X=1
  $ X=2 dune runtest
  X=2
  $ X=1 dune runtest
  ```
  Previously, Dune would have re-executed the action again at the last
  line. Now it remembers the result of the first execution.

- Fix a bug where dune would always re-run all actions that produce symlinks,
  even if their dependencies did not change. (ocaml/dune#4405, @aalekseyev)

- Fix a bug that was causing Dune to re-hash generated files more
  often than necessary (ocaml/dune#4419, @jeremiedimino)

- Fields allowed in the config file are now also allowed in the
  workspace file (ocaml/dune#4426, @jeremiedimino)

- Add options to control how Dune should handle stdout and stderr of
  actions when then succeed. It is now possible to ask Dune to ignore
  the stdout of actions when they succeed or to request that the
  stderr of actions must be empty. This allows to reduce the noise of
  large builds (ocaml/dune#4422, ocaml/dune#4515, @jeremiedimino)

- The `@all` alias no longer depends directly on copies of files from the source
  directory (ocaml/dune#4461, @nojb)

- Allow dune-file as an alternative file name for dune files (needs to be
  enabled in the dune-project file) (ocaml/dune#4428, @nojb)

- Drop support for upgrading jbuilder projects (ocaml/dune#4473, @jeremiedimino)

- Extend the environment variable `BUILD_PATH_PREFIX_MAP` to rewrite
  the root of the build dir (or sandbox) to `/workspace_root` (ocaml/dune#4466,
  @jeremiedimino)

- Simplify the implementation of build cache. We stop using the cache daemon to
  access the cache and instead write to and read from it directly. The new cache
  implementation is based on Jenga's cache library, which was thoroughly tested
  on large-scale builds. Using Jenga's cache library will also make it easier
  for us to port Jenga's cloud cache to Dune. (ocaml/dune#4443, ocaml/dune#4465, Andrey Mokhov)

- More informative error message when Dune can't read a target that's supposed
  to be produced by the action. Old message is still produced on ENOENT, but other
  errors deserve a more detailed report. (ocaml/dune#4501, @aalekseyev)

- Fixed a bug where a sandboxed action would fail if it declares no dependencies in
  its initial working directory or any directory it `chdir`s into. (ocaml/dune#4509, @aalekseyev)

- Fix a crash when clearing temporary directories (ocaml/dune#4489, ocaml/dune#4529, Andrey Mokhov)

- Dune now memoizes all errors when running in the file-watching mode. This
  speeds up incremental rebuilds but may be inconvenient in rare cases, e.g. if
  a build action fails due to a spurious error, such as running out of memory.
  Right now, the only way to force such actions to be rebuilt is to restart
  Dune, which clears all memoized errors. In future, we would like to provide a
  way to rerun all actions failed due to errors without restarting the build,
  e.g. via a Dune RPC call. (ocaml/dune#4522, Andrey Mokhov)

- Remove `dune compute`. It was broken and unused (ocaml/dune#4540,
  @jeremiedimino)

- No longer generate an approximate merlin files when computing the
  ocaml flags fails, for instance because they include the contents of
  a file that failed to build. This was a niche feature and it was
  getting in the way of making Dune's core better. (ocaml/dune#4607, @jeremiedimino)

- Make Dune display the progress indicator in all output modes except quiet
  (ocaml/dune#4618, @aalekseyev)

- Report accurate process timing information in trace mode (enabled with
  `--trace-file`) (ocaml/dune#4517, @rgrinberg)

- Do not log `live_words` and `free_words` in trace file. This allows using
  `Gc.quick_stat` which does not scan the heap. (ocaml/dune#4643, @emillon)

- Don't let command run by Dune observe the environment variable
  `INSIDE_EMACS` in order to improve reproducibility (ocaml/dune#4680,
  @jeremiedimino)

- Fix `root_module` when used in public libraries (ocaml/dune#4685, fixes ocaml/dune#4684,
  @rgrinberg, @craigfe)

- Fix `root_module` when used with preprocessing (ocaml/dune#4683, fixes ocaml/dune#4682,
  @rgrinberg, @craigfe)

- Display Coq profile flags in `dune printenv` (ocaml/dune#4767, @ejgallego)

- Introduce mdx stanza 0.2, requiring mdx >= 1.9.0, with a new generic `deps`
  field and the possibility to statically link `libraries` in the test
  executable. (ocaml/dune#3956, ocaml/dune#5391, fixes ocaml/dune#3955)

- Improve lookup of optional or disabled binaries. Previously, we'd treat every
  executable with missing libraries as optional. Now, we treat make sure to
  look at the library's optional or enabled_if status (ocaml/dune#4786).

- Always use 7 char hash prefix in build info version (ocaml/dune#4857, @jberdine, fixes
  ocaml/dune#4855)

- Allow to explicitly disable/enable the use of `dune subst` by adding a
  new `(subst <disable|enable>)` stanza to the `dune-project` file.
  (ocaml/dune#4864, @kit-ty-kate)

- Simplify the way `dune` discovers the root of the workspace. It now
  stops at the first `dune-workspace` file it encounters, and fails if
  it finds neither a `dune-workspace` nor a `dune-project` file
  (ocaml/dune#4921, fixes ocaml/dune#4459, @jeremiedimino)

- Dune no longer reads installed META files for libraries distributed with the
  compiler, instead using its own internal database. (ocaml/dune#4946, @nojb)

- Add support for `(empty_module_interface_if_absent)` in executable and library
  stanzas. (ocaml/dune#4955, @nojb)

- Add support for `%{bin-available:...}` (ocaml/dune#4995, @jeremiedimino)

- Make sure running `git` or `hg` in a sandboxed action, such as a
  cram test cannot escape the sandbox and pick up some random git or
  mercurial repository on the file system (ocaml/dune#4996, @jeremiedimino)

- Allow `%{read:...}` in more places such as `(enabled_if ...)`
  (ocaml/dune#4994, @jeremiedimino)

- Run each action in its own process group so that we don't leave
  stray processes behind when killing actions (ocaml/dune#4998, @jeremiedimino)

- Add an option `expand_aliases_in_sandbox` (ocaml/dune#5003, @jeremiedimino)

- Allow to cancel the initial scan via Control+C (ocaml/dune#4460, fixes ocaml/dune#4364
  @jeremiedimino)

- Add experimental support for directory targets (ocaml/dune#3316, ocaml/dune#5025, Andrey Mokhov),
  enabled via `(using directory-targets 0.1)` in `dune-project`.

- Delete old `promote-into`, `promote-until-clean` and `promote-until-clean-into`
  syntax (ocaml/dune#5091, Andrey Mokhov).

- Add link_flags in the env stanza (ocaml/dune#5215)

- Bootstrap: ignore errors when trying to remove generated files. (ocaml/dune#5407,
  @damiendoligez)
smorimoto pushed a commit to rgrinberg/opam-repository that referenced this issue Feb 13, 2022
…e-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info and dune-action-plugin (3.0.0)

CHANGES:

- Remove `uchar` and `seq` dummy ocamlfind libraries from dune's builtin
  library database (ocaml/dune#5260, @kit-ty-kate)

- Add a `DUNE_DIFF_COMMAND` environment variable to match `--diff-command`
  command-line parameter (@raphael-proust, fix ocaml/dune#5369, ocaml/dune#5375)

- Add support for odoc-link rules (ocaml/dune#5045, @lubegasimon)

- Dune will no longer generate documentation for hidden modules (ocaml/dune#5045,
  @lubegasimon)

- Parse the `native_pack_linker` field of `ocamlc -config` (ocaml/dune#5281, @TheLortex)

- Fix plugins with dot in the name (ocaml/dune#5182, @bobot, review @rgrinberg)

- Don't generate the dune-site build part when not needed (ocaml/dune#4861, @bobot,
  review @kit-ty-kate)

- Fix installation of implementations of virtual libraries (ocaml/dune#5150, fix ocaml/dune#3636,
  @rgrinberg)

- Run tests in all modes defined. Previously, jsoo was excluded. (@hhugo,
  ocaml/dune#5049, fix ocaml/dune#4951)

- Allow to configure the alias to run the jsoo tests (@hhugo, ocaml/dune#5049, ocaml/dune#4999)

- Set jsoo compilation flags in the `env` stanza (@hhugo, ocaml/dune#5049, ocaml/dune#1613)

- Allow to configure jsoo separate compilation in the `env` stanza. Previously,
  it was hard coded to always be enabled in the `dev` profile. (@hhugo, ocaml/dune#5049,
  fix ocaml/dune#970)

- Fix build-info version in jsoo executables (@hhugo, ocaml/dune#5049, fix ocaml/dune#4444)

- Pass `-no-check-prims` when building bytecode for jsoo (@hhugo, ocaml/dune#5049, ocaml/dune#4027)

- Fix jsoo builds when dynamically linked foreign archives are disabled
  (@hhugo, ocaml/dune#5049)

- Disallow empty packages starting from 3.0.  Empty packages may be
  re-enabled by adding the `(allow_empty)` to the package stanza in
  the dune-project file. (ocaml/dune#4867, fix ocaml/dune#2882, @kit-ty-kate, @rgrinberg)

- Add `link_flags` field to the `executable` field of `inline_tests` (ocaml/dune#5088,
  fix ocaml/dune#1530, @jvillard)

- In watch mode, use fsevents instead of fswatch on OSX (ocaml/dune#4937, ocaml/dune#4990, fixes
  ocaml/dune#4896 @rgrinberg)

- Remove `inotifywait` watch mode backend on Linux. We now use the inotify API
  exclusively (ocaml/dune#4941, @rgrinberg)

- Report cycles between virtual libraries and their implementation (ocaml/dune#5050,
  fixes ocaml/dune#2896, @rgrinberg)

- Warn when lang versions have an ignored suffix. `(lang dune 2.3.4)` or `(lang
  dune 2.3suffix)` were silently parsed as `2.3` and we know suggest to remove
  the prefix. (ocaml/dune#5040, @emillon)

- Allow users to specify dynamic dependencies in rules. For example `(deps
  %{read:foo.gen})` (ocaml/dune#4662, fixes ocaml/dune#4089, @jeremiedimino)

- Sandbox infer rules for menhir. Fixes possible "inconsistent assumptions"
  errors (ocaml/dune#5015, @rgrinberg)

- Experimental support for ctypes stubs (ocaml/dune#3905, fixes ocaml/dune#135, @mbacarella)

- Fix interpretation of `binaries` defined in the `env stanza`. Binaries
  defined in `x/dune` wouldn't be visible in `x/*/**/dune. (ocaml/dune#4975, fixes ocaml/dune#4976,
  @Leonidas-from-XIV, @rgrinberg)

- Do not list private libraries in package listings (ocaml/dune#4945, fixes ocaml/dune#4799,
  @rgrinberg)

- Allow spaces in cram test paths (ocaml/dune#4980, fixes ocaml/dune#4162, @rgrinberg)

- Improve error handling of misbehaving cram scripts. (ocaml/dune#4981, fix ocaml/dune#4230,
  @rgrinberg)

- Fix `foreign_stubs` inside a `tests` stanza. Previously, dune would crash
  when this field was present (ocaml/dune#4942, fix ocaml/dune#4946, @rgrinberg)

- Add the `enabled_if` field to `inline_tests` within the `library` stanza.
  This allows us to disable executing the inline tests while still allowing for
  compilation (ocaml/dune#4939, @rgrinberg)

- Generate a `dune-project` when initializing projects with `dune init proj ...`
  (ocaml/dune#4881, closes ocaml/dune#4367, @shonfeder)

- Allow spaces in the directory argument of the `subdir` stanza (ocaml/dune#4943, fixes
  ocaml/dune#4907, @rgrinberg)

- Add a `%{toolchain}` expansion variable (ocaml/dune#4899, fixes ocaml/dune#3949, @rgrinberg)

- Include dependencies of executables when creating toplevels (either `dune
  top` or `dune utop`) (ocaml/dune#4882, fixes ocaml/dune#4872, @Gopiancode)

- Fixes `opam` META file requires entry for private libs (ocaml/dune#4841, fixes ocaml/dune#4839, @toots)

- Fixes `dune exec` not adding .exe on Windows (ocaml/dune#4371, fixes ocaml/dune#3322, @MisterDA)

- Allow multiple cinaps stanzas in the same directory (ocaml/dune#4460, @rgrinberg)

- Fix `$ dune subst` in empty git repositories (ocaml/dune#4441, fixes ocaml/dune#3619, @rgrinberg)

- Improve interpretation of ansi escape sequence when spawning processes (ocaml/dune#4408,
  fixes ocaml/dune#2665, @rgrinberg)

- Allow `(package pkg)` in dependencies even if `pkg` is an installed package
  (ocaml/dune#4170, @bobot)

- Allow `%{version:pkg}` to work for external packages (ocaml/dune#4104, @kit-ty-kate)

- Add `(glob_files_rec <dir>/<glob>)` for globbing files recursively (ocaml/dune#4176,
  @jeremiedimino)

- Automatically generate empty `.mli` files for executables and tests (ocaml/dune#3768,
  fixes ocaml/dune#3745, @craigfe)

- Add `ocaml` command subgroup for OCaml related commands such as `utop`, `top`,
  and `merlin` (ocaml/dune#3936, @rgrinberg).

- Detect unknown variables more eagerly (ocaml/dune#4184, @jeremiedimino)

- Improve location of variables and macros in error messages (ocaml/dune#4205,
  @jeremiedimino)

- Auto-detect `dune-project` files as `dune` files in Emacs (ocaml/dune#4222, @shonfeder)

- Dune no longer automatically create or edit `dune-project` files
  (ocaml/dune#4239, fixes ocaml/dune#4108, @jeremiedimino)

- Warn if `dune-project` is not found (fatal in release mode) (ocaml/dune#5343, @emillon)

- Cleanup temporary files after running `$ dune exec`. (ocaml/dune#4260, fixes ocaml/dune#4243,
  @rgrinberg)

- Add a new subcommand `dune ocaml dump-dot-merlin` that prints a mix of all the
  merlin configuration of a directory (defaulting to the current directory) in
  the Merlin configuration syntax. (ocaml/dune#4250, @voodoos)

- Enable cram tests by default (ocaml/dune#4262, @rgrinberg)

- Drop support for opam 1.x (ocaml/dune#4280, @jeremiedimino)

- Stop calling `ocamlfind` to determine the library search path or
  library installation directory. This makes the behavior of Dune
  simpler and more reproducible (ocaml/dune#4281, @jeremiedimino)

- Remove the `external-lib-deps` command. This command was only
  approximative and the cost of maintainance was getting too high. We
  removed it to make room for new more important features (ocaml/dune#4298,
  @jeremiedimino)

- It is now possible to define action dependencies through a chain
  of aliases. (ocaml/dune#4303, @aalekseyev)

- If an .ml file is not used by an executable, Dune no longer report
  parsing error in this file (ocaml/dune#4330, @jeremiedimino)

- Add support for sandboxing using hard links (ocaml/dune#4360, Andrey Mokhov)

- Fix dune crash when `subdir` is an absolute path (ocaml/dune#4366, @anmonteiro)

- Changed the implementation of actions attached to aliases, as in
  `(rule (alias runtest) (action (run ./test)))`. A visible result for
  users is that such actions are now memoized for longer. For
  instance:
  ```
  $ echo '(rule (alias runtest) (action (echo "X=%{env:X=0}\n")))` > dune
  $ X=1 dune runtest
  X=1
  $ X=2 dune runtest
  X=2
  $ X=1 dune runtest
  ```
  Previously, Dune would have re-executed the action again at the last
  line. Now it remembers the result of the first execution.

- Fix a bug where dune would always re-run all actions that produce symlinks,
  even if their dependencies did not change. (ocaml/dune#4405, @aalekseyev)

- Fix a bug that was causing Dune to re-hash generated files more
  often than necessary (ocaml/dune#4419, @jeremiedimino)

- Fields allowed in the config file are now also allowed in the
  workspace file (ocaml/dune#4426, @jeremiedimino)

- Add options to control how Dune should handle stdout and stderr of
  actions when then succeed. It is now possible to ask Dune to ignore
  the stdout of actions when they succeed or to request that the
  stderr of actions must be empty. This allows to reduce the noise of
  large builds (ocaml/dune#4422, ocaml/dune#4515, @jeremiedimino)

- The `@all` alias no longer depends directly on copies of files from the source
  directory (ocaml/dune#4461, @nojb)

- Allow dune-file as an alternative file name for dune files (needs to be
  enabled in the dune-project file) (ocaml/dune#4428, @nojb)

- Drop support for upgrading jbuilder projects (ocaml/dune#4473, @jeremiedimino)

- Extend the environment variable `BUILD_PATH_PREFIX_MAP` to rewrite
  the root of the build dir (or sandbox) to `/workspace_root` (ocaml/dune#4466,
  @jeremiedimino)

- Simplify the implementation of build cache. We stop using the cache daemon to
  access the cache and instead write to and read from it directly. The new cache
  implementation is based on Jenga's cache library, which was thoroughly tested
  on large-scale builds. Using Jenga's cache library will also make it easier
  for us to port Jenga's cloud cache to Dune. (ocaml/dune#4443, ocaml/dune#4465, Andrey Mokhov)

- More informative error message when Dune can't read a target that's supposed
  to be produced by the action. Old message is still produced on ENOENT, but other
  errors deserve a more detailed report. (ocaml/dune#4501, @aalekseyev)

- Fixed a bug where a sandboxed action would fail if it declares no dependencies in
  its initial working directory or any directory it `chdir`s into. (ocaml/dune#4509, @aalekseyev)

- Fix a crash when clearing temporary directories (ocaml/dune#4489, ocaml/dune#4529, Andrey Mokhov)

- Dune now memoizes all errors when running in the file-watching mode. This
  speeds up incremental rebuilds but may be inconvenient in rare cases, e.g. if
  a build action fails due to a spurious error, such as running out of memory.
  Right now, the only way to force such actions to be rebuilt is to restart
  Dune, which clears all memoized errors. In future, we would like to provide a
  way to rerun all actions failed due to errors without restarting the build,
  e.g. via a Dune RPC call. (ocaml/dune#4522, Andrey Mokhov)

- Remove `dune compute`. It was broken and unused (ocaml/dune#4540,
  @jeremiedimino)

- No longer generate an approximate merlin files when computing the
  ocaml flags fails, for instance because they include the contents of
  a file that failed to build. This was a niche feature and it was
  getting in the way of making Dune's core better. (ocaml/dune#4607, @jeremiedimino)

- Make Dune display the progress indicator in all output modes except quiet
  (ocaml/dune#4618, @aalekseyev)

- Report accurate process timing information in trace mode (enabled with
  `--trace-file`) (ocaml/dune#4517, @rgrinberg)

- Do not log `live_words` and `free_words` in trace file. This allows using
  `Gc.quick_stat` which does not scan the heap. (ocaml/dune#4643, @emillon)

- Don't let command run by Dune observe the environment variable
  `INSIDE_EMACS` in order to improve reproducibility (ocaml/dune#4680,
  @jeremiedimino)

- Fix `root_module` when used in public libraries (ocaml/dune#4685, fixes ocaml/dune#4684,
  @rgrinberg, @craigfe)

- Fix `root_module` when used with preprocessing (ocaml/dune#4683, fixes ocaml/dune#4682,
  @rgrinberg, @craigfe)

- Display Coq profile flags in `dune printenv` (ocaml/dune#4767, @ejgallego)

- Introduce mdx stanza 0.2, requiring mdx >= 1.9.0, with a new generic `deps`
  field and the possibility to statically link `libraries` in the test
  executable. (ocaml/dune#3956, ocaml/dune#5391, fixes ocaml/dune#3955)

- Improve lookup of optional or disabled binaries. Previously, we'd treat every
  executable with missing libraries as optional. Now, we treat make sure to
  look at the library's optional or enabled_if status (ocaml/dune#4786).

- Always use 7 char hash prefix in build info version (ocaml/dune#4857, @jberdine, fixes
  ocaml/dune#4855)

- Allow to explicitly disable/enable the use of `dune subst` by adding a
  new `(subst <disable|enable>)` stanza to the `dune-project` file.
  (ocaml/dune#4864, @kit-ty-kate)

- Simplify the way `dune` discovers the root of the workspace. It now
  stops at the first `dune-workspace` file it encounters, and fails if
  it finds neither a `dune-workspace` nor a `dune-project` file
  (ocaml/dune#4921, fixes ocaml/dune#4459, @jeremiedimino)

- Dune no longer reads installed META files for libraries distributed with the
  compiler, instead using its own internal database. (ocaml/dune#4946, @nojb)

- Add support for `(empty_module_interface_if_absent)` in executable and library
  stanzas. (ocaml/dune#4955, @nojb)

- Add support for `%{bin-available:...}` (ocaml/dune#4995, @jeremiedimino)

- Make sure running `git` or `hg` in a sandboxed action, such as a
  cram test cannot escape the sandbox and pick up some random git or
  mercurial repository on the file system (ocaml/dune#4996, @jeremiedimino)

- Allow `%{read:...}` in more places such as `(enabled_if ...)`
  (ocaml/dune#4994, @jeremiedimino)

- Run each action in its own process group so that we don't leave
  stray processes behind when killing actions (ocaml/dune#4998, @jeremiedimino)

- Add an option `expand_aliases_in_sandbox` (ocaml/dune#5003, @jeremiedimino)

- Allow to cancel the initial scan via Control+C (ocaml/dune#4460, fixes ocaml/dune#4364
  @jeremiedimino)

- Add experimental support for directory targets (ocaml/dune#3316, ocaml/dune#5025, Andrey Mokhov),
  enabled via `(using directory-targets 0.1)` in `dune-project`.

- Delete old `promote-into`, `promote-until-clean` and `promote-until-clean-into`
  syntax (ocaml/dune#5091, Andrey Mokhov).

- Add link_flags in the env stanza (ocaml/dune#5215)

- Bootstrap: ignore errors when trying to remove generated files. (ocaml/dune#5407,
  @damiendoligez)
kit-ty-kate pushed a commit to rgrinberg/opam-repository that referenced this issue Feb 15, 2022
…e-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info and dune-action-plugin (3.0.0)

CHANGES:

- Remove `uchar` and `seq` dummy ocamlfind libraries from dune's builtin
  library database (ocaml/dune#5260, @kit-ty-kate)

- Add a `DUNE_DIFF_COMMAND` environment variable to match `--diff-command`
  command-line parameter (@raphael-proust, fix ocaml/dune#5369, ocaml/dune#5375)

- Add support for odoc-link rules (ocaml/dune#5045, @lubegasimon)

- Dune will no longer generate documentation for hidden modules (ocaml/dune#5045,
  @lubegasimon)

- Parse the `native_pack_linker` field of `ocamlc -config` (ocaml/dune#5281, @TheLortex)

- Fix plugins with dot in the name (ocaml/dune#5182, @bobot, review @rgrinberg)

- Don't generate the dune-site build part when not needed (ocaml/dune#4861, @bobot,
  review @kit-ty-kate)

- Fix installation of implementations of virtual libraries (ocaml/dune#5150, fix ocaml/dune#3636,
  @rgrinberg)

- Run tests in all modes defined. Previously, jsoo was excluded. (@hhugo,
  ocaml/dune#5049, fix ocaml/dune#4951)

- Allow to configure the alias to run the jsoo tests (@hhugo, ocaml/dune#5049, ocaml/dune#4999)

- Set jsoo compilation flags in the `env` stanza (@hhugo, ocaml/dune#5049, ocaml/dune#1613)

- Allow to configure jsoo separate compilation in the `env` stanza. Previously,
  it was hard coded to always be enabled in the `dev` profile. (@hhugo, ocaml/dune#5049,
  fix ocaml/dune#970)

- Fix build-info version in jsoo executables (@hhugo, ocaml/dune#5049, fix ocaml/dune#4444)

- Pass `-no-check-prims` when building bytecode for jsoo (@hhugo, ocaml/dune#5049, ocaml/dune#4027)

- Fix jsoo builds when dynamically linked foreign archives are disabled
  (@hhugo, ocaml/dune#5049)

- Disallow empty packages starting from 3.0.  Empty packages may be
  re-enabled by adding the `(allow_empty)` to the package stanza in
  the dune-project file. (ocaml/dune#4867, fix ocaml/dune#2882, @kit-ty-kate, @rgrinberg)

- Add `link_flags` field to the `executable` field of `inline_tests` (ocaml/dune#5088,
  fix ocaml/dune#1530, @jvillard)

- In watch mode, use fsevents instead of fswatch on OSX (ocaml/dune#4937, ocaml/dune#4990, fixes
  ocaml/dune#4896 @rgrinberg)

- Remove `inotifywait` watch mode backend on Linux. We now use the inotify API
  exclusively (ocaml/dune#4941, @rgrinberg)

- Report cycles between virtual libraries and their implementation (ocaml/dune#5050,
  fixes ocaml/dune#2896, @rgrinberg)

- Warn when lang versions have an ignored suffix. `(lang dune 2.3.4)` or `(lang
  dune 2.3suffix)` were silently parsed as `2.3` and we know suggest to remove
  the prefix. (ocaml/dune#5040, @emillon)

- Allow users to specify dynamic dependencies in rules. For example `(deps
  %{read:foo.gen})` (ocaml/dune#4662, fixes ocaml/dune#4089, @jeremiedimino)

- Sandbox infer rules for menhir. Fixes possible "inconsistent assumptions"
  errors (ocaml/dune#5015, @rgrinberg)

- Experimental support for ctypes stubs (ocaml/dune#3905, fixes ocaml/dune#135, @mbacarella)

- Fix interpretation of `binaries` defined in the `env stanza`. Binaries
  defined in `x/dune` wouldn't be visible in `x/*/**/dune. (ocaml/dune#4975, fixes ocaml/dune#4976,
  @Leonidas-from-XIV, @rgrinberg)

- Do not list private libraries in package listings (ocaml/dune#4945, fixes ocaml/dune#4799,
  @rgrinberg)

- Allow spaces in cram test paths (ocaml/dune#4980, fixes ocaml/dune#4162, @rgrinberg)

- Improve error handling of misbehaving cram scripts. (ocaml/dune#4981, fix ocaml/dune#4230,
  @rgrinberg)

- Fix `foreign_stubs` inside a `tests` stanza. Previously, dune would crash
  when this field was present (ocaml/dune#4942, fix ocaml/dune#4946, @rgrinberg)

- Add the `enabled_if` field to `inline_tests` within the `library` stanza.
  This allows us to disable executing the inline tests while still allowing for
  compilation (ocaml/dune#4939, @rgrinberg)

- Generate a `dune-project` when initializing projects with `dune init proj ...`
  (ocaml/dune#4881, closes ocaml/dune#4367, @shonfeder)

- Allow spaces in the directory argument of the `subdir` stanza (ocaml/dune#4943, fixes
  ocaml/dune#4907, @rgrinberg)

- Add a `%{toolchain}` expansion variable (ocaml/dune#4899, fixes ocaml/dune#3949, @rgrinberg)

- Include dependencies of executables when creating toplevels (either `dune
  top` or `dune utop`) (ocaml/dune#4882, fixes ocaml/dune#4872, @Gopiancode)

- Fixes `opam` META file requires entry for private libs (ocaml/dune#4841, fixes ocaml/dune#4839, @toots)

- Fixes `dune exec` not adding .exe on Windows (ocaml/dune#4371, fixes ocaml/dune#3322, @MisterDA)

- Allow multiple cinaps stanzas in the same directory (ocaml/dune#4460, @rgrinberg)

- Fix `$ dune subst` in empty git repositories (ocaml/dune#4441, fixes ocaml/dune#3619, @rgrinberg)

- Improve interpretation of ansi escape sequence when spawning processes (ocaml/dune#4408,
  fixes ocaml/dune#2665, @rgrinberg)

- Allow `(package pkg)` in dependencies even if `pkg` is an installed package
  (ocaml/dune#4170, @bobot)

- Allow `%{version:pkg}` to work for external packages (ocaml/dune#4104, @kit-ty-kate)

- Add `(glob_files_rec <dir>/<glob>)` for globbing files recursively (ocaml/dune#4176,
  @jeremiedimino)

- Automatically generate empty `.mli` files for executables and tests (ocaml/dune#3768,
  fixes ocaml/dune#3745, @craigfe)

- Add `ocaml` command subgroup for OCaml related commands such as `utop`, `top`,
  and `merlin` (ocaml/dune#3936, @rgrinberg).

- Detect unknown variables more eagerly (ocaml/dune#4184, @jeremiedimino)

- Improve location of variables and macros in error messages (ocaml/dune#4205,
  @jeremiedimino)

- Auto-detect `dune-project` files as `dune` files in Emacs (ocaml/dune#4222, @shonfeder)

- Dune no longer automatically create or edit `dune-project` files
  (ocaml/dune#4239, fixes ocaml/dune#4108, @jeremiedimino)

- Warn if `dune-project` is not found (fatal in release mode) (ocaml/dune#5343, @emillon)

- Cleanup temporary files after running `$ dune exec`. (ocaml/dune#4260, fixes ocaml/dune#4243,
  @rgrinberg)

- Add a new subcommand `dune ocaml dump-dot-merlin` that prints a mix of all the
  merlin configuration of a directory (defaulting to the current directory) in
  the Merlin configuration syntax. (ocaml/dune#4250, @voodoos)

- Enable cram tests by default (ocaml/dune#4262, @rgrinberg)

- Drop support for opam 1.x (ocaml/dune#4280, @jeremiedimino)

- Stop calling `ocamlfind` to determine the library search path or
  library installation directory. This makes the behavior of Dune
  simpler and more reproducible (ocaml/dune#4281, @jeremiedimino)

- Remove the `external-lib-deps` command. This command was only
  approximative and the cost of maintainance was getting too high. We
  removed it to make room for new more important features (ocaml/dune#4298,
  @jeremiedimino)

- It is now possible to define action dependencies through a chain
  of aliases. (ocaml/dune#4303, @aalekseyev)

- If an .ml file is not used by an executable, Dune no longer report
  parsing error in this file (ocaml/dune#4330, @jeremiedimino)

- Add support for sandboxing using hard links (ocaml/dune#4360, Andrey Mokhov)

- Fix dune crash when `subdir` is an absolute path (ocaml/dune#4366, @anmonteiro)

- Changed the implementation of actions attached to aliases, as in
  `(rule (alias runtest) (action (run ./test)))`. A visible result for
  users is that such actions are now memoized for longer. For
  instance:
  ```
  $ echo '(rule (alias runtest) (action (echo "X=%{env:X=0}\n")))` > dune
  $ X=1 dune runtest
  X=1
  $ X=2 dune runtest
  X=2
  $ X=1 dune runtest
  ```
  Previously, Dune would have re-executed the action again at the last
  line. Now it remembers the result of the first execution.

- Fix a bug where dune would always re-run all actions that produce symlinks,
  even if their dependencies did not change. (ocaml/dune#4405, @aalekseyev)

- Fix a bug that was causing Dune to re-hash generated files more
  often than necessary (ocaml/dune#4419, @jeremiedimino)

- Fields allowed in the config file are now also allowed in the
  workspace file (ocaml/dune#4426, @jeremiedimino)

- Add options to control how Dune should handle stdout and stderr of
  actions when then succeed. It is now possible to ask Dune to ignore
  the stdout of actions when they succeed or to request that the
  stderr of actions must be empty. This allows to reduce the noise of
  large builds (ocaml/dune#4422, ocaml/dune#4515, @jeremiedimino)

- The `@all` alias no longer depends directly on copies of files from the source
  directory (ocaml/dune#4461, @nojb)

- Allow dune-file as an alternative file name for dune files (needs to be
  enabled in the dune-project file) (ocaml/dune#4428, @nojb)

- Drop support for upgrading jbuilder projects (ocaml/dune#4473, @jeremiedimino)

- Extend the environment variable `BUILD_PATH_PREFIX_MAP` to rewrite
  the root of the build dir (or sandbox) to `/workspace_root` (ocaml/dune#4466,
  @jeremiedimino)

- Simplify the implementation of build cache. We stop using the cache daemon to
  access the cache and instead write to and read from it directly. The new cache
  implementation is based on Jenga's cache library, which was thoroughly tested
  on large-scale builds. Using Jenga's cache library will also make it easier
  for us to port Jenga's cloud cache to Dune. (ocaml/dune#4443, ocaml/dune#4465, Andrey Mokhov)

- More informative error message when Dune can't read a target that's supposed
  to be produced by the action. Old message is still produced on ENOENT, but other
  errors deserve a more detailed report. (ocaml/dune#4501, @aalekseyev)

- Fixed a bug where a sandboxed action would fail if it declares no dependencies in
  its initial working directory or any directory it `chdir`s into. (ocaml/dune#4509, @aalekseyev)

- Fix a crash when clearing temporary directories (ocaml/dune#4489, ocaml/dune#4529, Andrey Mokhov)

- Dune now memoizes all errors when running in the file-watching mode. This
  speeds up incremental rebuilds but may be inconvenient in rare cases, e.g. if
  a build action fails due to a spurious error, such as running out of memory.
  Right now, the only way to force such actions to be rebuilt is to restart
  Dune, which clears all memoized errors. In future, we would like to provide a
  way to rerun all actions failed due to errors without restarting the build,
  e.g. via a Dune RPC call. (ocaml/dune#4522, Andrey Mokhov)

- Remove `dune compute`. It was broken and unused (ocaml/dune#4540,
  @jeremiedimino)

- No longer generate an approximate merlin files when computing the
  ocaml flags fails, for instance because they include the contents of
  a file that failed to build. This was a niche feature and it was
  getting in the way of making Dune's core better. (ocaml/dune#4607, @jeremiedimino)

- Make Dune display the progress indicator in all output modes except quiet
  (ocaml/dune#4618, @aalekseyev)

- Report accurate process timing information in trace mode (enabled with
  `--trace-file`) (ocaml/dune#4517, @rgrinberg)

- Do not log `live_words` and `free_words` in trace file. This allows using
  `Gc.quick_stat` which does not scan the heap. (ocaml/dune#4643, @emillon)

- Don't let command run by Dune observe the environment variable
  `INSIDE_EMACS` in order to improve reproducibility (ocaml/dune#4680,
  @jeremiedimino)

- Fix `root_module` when used in public libraries (ocaml/dune#4685, fixes ocaml/dune#4684,
  @rgrinberg, @craigfe)

- Fix `root_module` when used with preprocessing (ocaml/dune#4683, fixes ocaml/dune#4682,
  @rgrinberg, @craigfe)

- Display Coq profile flags in `dune printenv` (ocaml/dune#4767, @ejgallego)

- Introduce mdx stanza 0.2, requiring mdx >= 1.9.0, with a new generic `deps`
  field and the possibility to statically link `libraries` in the test
  executable. (ocaml/dune#3956, ocaml/dune#5391, fixes ocaml/dune#3955)

- Improve lookup of optional or disabled binaries. Previously, we'd treat every
  executable with missing libraries as optional. Now, we treat make sure to
  look at the library's optional or enabled_if status (ocaml/dune#4786).

- Always use 7 char hash prefix in build info version (ocaml/dune#4857, @jberdine, fixes
  ocaml/dune#4855)

- Allow to explicitly disable/enable the use of `dune subst` by adding a
  new `(subst <disable|enable>)` stanza to the `dune-project` file.
  (ocaml/dune#4864, @kit-ty-kate)

- Simplify the way `dune` discovers the root of the workspace. It now
  stops at the first `dune-workspace` file it encounters, and fails if
  it finds neither a `dune-workspace` nor a `dune-project` file
  (ocaml/dune#4921, fixes ocaml/dune#4459, @jeremiedimino)

- Dune no longer reads installed META files for libraries distributed with the
  compiler, instead using its own internal database. (ocaml/dune#4946, @nojb)

- Add support for `(empty_module_interface_if_absent)` in executable and library
  stanzas. (ocaml/dune#4955, @nojb)

- Add support for `%{bin-available:...}` (ocaml/dune#4995, @jeremiedimino)

- Make sure running `git` or `hg` in a sandboxed action, such as a
  cram test cannot escape the sandbox and pick up some random git or
  mercurial repository on the file system (ocaml/dune#4996, @jeremiedimino)

- Allow `%{read:...}` in more places such as `(enabled_if ...)`
  (ocaml/dune#4994, @jeremiedimino)

- Run each action in its own process group so that we don't leave
  stray processes behind when killing actions (ocaml/dune#4998, @jeremiedimino)

- Add an option `expand_aliases_in_sandbox` (ocaml/dune#5003, @jeremiedimino)

- Allow to cancel the initial scan via Control+C (ocaml/dune#4460, fixes ocaml/dune#4364
  @jeremiedimino)

- Add experimental support for directory targets (ocaml/dune#3316, ocaml/dune#5025, Andrey Mokhov),
  enabled via `(using directory-targets 0.1)` in `dune-project`.

- Delete old `promote-into`, `promote-until-clean` and `promote-until-clean-into`
  syntax (ocaml/dune#5091, Andrey Mokhov).

- Add link_flags in the env stanza (ocaml/dune#5215)

- Bootstrap: ignore errors when trying to remove generated files. (ocaml/dune#5407,
  @damiendoligez)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment