Awesome. I will try that out when I get a chance. On 1/22/14 5:33 PM, "Darrell Loverin" <darrell.love...@gmail.com> wrote:
>Found an example in the falcon compiler of using soft dependencies. In >org.apache.flex.compiler.config.Configuration, >the below code says -locale must be set before -library-path. > > > @Config(allowMultiple = true, isPath = true) > > @Mapping({"compiler", "library-path"}) > > @Arguments(Arguments.PATH_ELEMENT) > > @InfiniteArguments > > @SoftPrerequisites("locale") > > public void setCompilerLibraryPath(ConfigurationValue cv, String[] >pathlist) throws CannotOpen > > { > > final ImmutableList<String> resolvedPaths = expandTokens( > > Arrays.asList(pathlist), > > locales, > > cv, !reportMissingCompilerLibraries); > > libraryPath.addAll(resolvedPaths); > > } > > > >-Darrell Loverin > > > > >On Wed, Jan 22, 2014 at 1:25 PM, Darrell Loverin ><darrell.love...@gmail.com>wrote: > >> You can create a "soft dependency" from one configuration variable to >> another and get the same effect as this code. I don't have the code in >> front of me right now but there should be some examples in the >> Configuration classes of the old MXML compiler. In this case >>library-path >> would have a soft dependency on target-player. >> >> >> -Darrell >> >> >> On Wed, Jan 22, 2014 at 11:44 AM, <aha...@apache.org> wrote: >> >>> Updated Branches: >>> refs/heads/develop 8966eda94 -> b5a06269f >>> >>> >>> guarantee that target-player gets processed before library-path >>>otherwise >>> wrong player gets checked >>> >>> >>> Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo >>> Commit: >>> http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b5a06269 >>> Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b5a06269 >>> Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b5a06269 >>> >>> Branch: refs/heads/develop >>> Commit: b5a06269f51aa1843cc6da79dd3a6eb0f4848345 >>> Parents: 8966eda >>> Author: Alex Harui <aha...@apache.org> >>> Authored: Wed Jan 22 16:42:40 2014 +0000 >>> Committer: Alex Harui <aha...@apache.org> >>> Committed: Wed Jan 22 16:42:40 2014 +0000 >>> >>> ---------------------------------------------------------------------- >>> .../compiler/config/ConfigurationBuffer.java | 23 >>>++++++++++++++++++++ >>> 1 file changed, 23 insertions(+) >>> ---------------------------------------------------------------------- >>> >>> >>> >>> >>>http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b5a06269/compile >>>r/src/org/apache/flex/compiler/config/ConfigurationBuffer.java >>> ---------------------------------------------------------------------- >>> diff --git >>> a/compiler/src/org/apache/flex/compiler/config/ConfigurationBuffer.java >>> b/compiler/src/org/apache/flex/compiler/config/ConfigurationBuffer.java >>> index b6484fd..f76bf17 100644 >>> --- >>> a/compiler/src/org/apache/flex/compiler/config/ConfigurationBuffer.java >>> +++ >>> b/compiler/src/org/apache/flex/compiler/config/ConfigurationBuffer.java >>> @@ -102,6 +102,8 @@ import com.google.common.collect.ImmutableList; >>> */ >>> public final class ConfigurationBuffer >>> { >>> + private static final String TARGET_PLAYER = "target-player"; >>> + >>> public ConfigurationBuffer(Class<? extends Configuration> >>> configClass) >>> { >>> this(configClass, new HashMap<String, String>()); >>> @@ -714,6 +716,27 @@ public final class ConfigurationBuffer >>> Set<String> done = new HashSet<String>(); >>> boolean success = true; >>> >>> + // get target-player first because its setting affect >>>expansion >>> of some >>> + // tokens later. The varList is populated by getMethods() >>>which >>> returns >>> + // the methods in random order and can result in >>> compiler.library-path being >>> + // evaluated before target-player and then we end up looking >>>up >>> the wrong >>> + // version of playerglobal. >>> + if (varList.contains(TARGET_PLAYER)) >>> + { >>> + varList.remove(TARGET_PLAYER); >>> + if (varMap.containsKey(TARGET_PLAYER)) >>> + { >>> + try >>> + { >>> + commitVariable(config, TARGET_PLAYER, done); >>> + } >>> + catch (ConfigurationException e) >>> + { >>> + problems.add(new ConfigurationProblem(e)); >>> + success = false; >>> + } >>> + } >>> + } >>> for (Iterator<String> vars = varList.iterator(); >>>vars.hasNext();) >>> { >>> String var = vars.next(); >>> >>> >>