Ticket Created
over 3 years ago

CIQQA-1191

excludeAnnotations work inconsistently in barrels vs barrel projects

Given this BarrelTest.mc

module BarrelTest {
  (:one)
  const Konstant = 2;
  (:two)
  const Konstant = 1;
}

and this monkey.jungle

project.manifest = manifest.xml
base.excludeAnnotations = one

If I try to build the barrel project, I get

ERROR: BarrelTest.mc:5: Duplicate declaration of symbol 'Konstant' in module 'BarrelTest'.
ERROR: Barrel build failed

But if I include this as a barrel project from my main project via:

base.barrelPath = /path/to/BarrelTest/monkey.jungle

and build my main project, it works, and Konstant has the value 1, as expected.

So when used as a barrel project, the compiler pulls the excludeAnnotations from the barrel's jungle file, and uses them (and I've verified that it *only* uses the excludeAnnotations from the barrel's jungle file; it *doesn't* apply the ones from my main project's jungle file - which makes sense). But when you try to build a .barrel, the compiler ignores the excludeAnnotations in the barrel's .jungle file, and fails to compile.

On the other hand if I change my BarrelTest.mc to

module BarrelTest {
  (:release)
  const Konstant = 2;
  (:debug)
  const Konstant = 1;
}

Then the barrel build succeeds. So it *does* respect excludeAnnotations, it's just failing to pull them in from the .jungle file. Also, if I then *use* the built barrel from my main project by pointing the barrelPath at the .barrel file, I do indeed get the correct values for debug/release builds (no real surprise, the barrel just contains the original source).

My example isn't too realistic... but it means you can't do things like

(:not_round)
const isRound = false;
(:round)
const isRound = true;

with something like this in the barrel's jungle file

base.excludeAnnotations = round
round.excludeAnnotations = not_round

It also seems wrong that the excludeAnnotations work when the barrel project is imported, but not when it's built.