tag:support.gradlefx.org,2011-05-23:/discussions/problems/67-transitive-dependenciesGradleFx: Discussion 2016-08-11T02:32:09Ztag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T07:18:26Z2013-01-31T07:19:46ZTransitive dependencies<div><p>When you compile your library (swc) project, there are two
options:</p>
<ul>
<li>
<p>either you use merged or internal and the dependency will be
compiled into your swc, which will then give no problems when
compiling your swf because the code is already compiled into the
swc</p>
</li>
<li>
<p>or you use external. It's basically saying like "I know my
library needs this dependency, so I'm giving it the dependency
during compilation, but after compilation I'm taking the dependency
away and it's up to the swf project to define how it will link to
the dependency (which can be merged, internal or rsl)"</p>
</li>
</ul>
<p>So depending on the type of linking you use in the swc project
you have to redefine the dependency with a different scope in the
swf project. It just how the Flex compilers work :)</p>
<p>Also, rsl dependencies (which is typically what swz files are
used for) are not supported in library projects, which is again a
compc compiler limitation (aka the -runtime-shared-library-path
option isn't supported in compc). So in your library project you
should define that dependency with scope "external".</p></div>Yennick Trevelstag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T07:22:22Z2013-01-31T07:22:22ZTransitive dependencies<div><p>Thank you!</p>
<p>I did it, but still have the same compilation problem.</p>
<p>Now I have my "common" swc depending on swiz as "external" and
my swf depends on "common" swc as "merged". is it correct?</p></div>Pavel Bernshtamtag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T07:32:54Z2013-01-31T07:32:54ZTransitive dependencies<div><p>no :)</p>
<p>If your swc depends on the swz with scope external, then your
swf has to redefine the dependency either as merged, internal or
rsl. Otherwise it won't have the swz dependency at runtime.</p>
<p>Let's say you would've defined the swz dependency with scope
merged in your swc project, then you wouldn't have to redefine the
dependency in the swf project because it has a dependency to your
swc project (which has the swz compiled in it). Using merged in a
swc project is discouraged though since it will increase the size
of your swc.</p></div>Yennick Trevelstag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T07:36:49Z2013-01-31T07:36:49ZTransitive dependencies<div><p>Thank you, so do I understand correctly that only external
dependencies are transitive?</p>
<p>So if my swf depends on my swc as "merged", I need redefine in
swf all swc external dependencies?</p>
<p>(Thank you very much for your help, I'm Java programmer, new to
Flex, and I need now convert some flex project from manual
compilation to gradle build)</p></div>Pavel Bernshtamtag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T07:44:04Z2013-01-31T07:44:26ZTransitive dependencies<div><p>Yes, that's right. But in your swf project you should change the
scope of those swc external dependencies.</p>
<p>So a small example:</p>
<h2>swc project build.gradle file</h2>
<pre>
<code>type = "swc"
external group: 'org.as3commons', name: 'as3commons-lang', version: '2.4', ext: 'swc'</code>
</pre>
<h2>swf project build.gradle file</h2>
<pre>
<code>type = "swf"
merged project(':swclibraryproject')
merged group: 'org.as3commons', name: 'as3commons-lang', version: '2.4', ext: 'swc'</code>
</pre>
<p>It's a bit different then in Java, but that's the nature of the
Flex compiler.</p></div>Yennick Trevelstag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T07:48:30Z2013-01-31T07:48:31ZTransitive dependencies<div><p>Got it!</p>
<p>As I understand, the reason for this is that, unlike Java, here
I should tell not just dependency but also how I link it. And this
requires for me declaration of dependency twice.</p>
<p>Correct?</p></div>Pavel Bernshtamtag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T07:56:49Z2013-01-31T07:56:49ZTransitive dependencies<div><p>exactly</p></div>Yennick Trevelstag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T09:09:04Z2013-01-31T09:09:35ZTransitive dependencies<div><p>The difference with Java is that for a Flex application or
library, file size is of the essence. That's why all those
different, somewhat complicated linking options exist.</p>
<p>As for your conversion task: if the build configuration already
exists in your IDE (IntelliJ IDEA as I understand it), you should
be able to just copy the linking scopes that were defined in
there.<br>
In your project's settings window, go to the 'dependencies' tab. In
the 'linkage' column you can find how libraries were linked in
IntelliJ. You should be able to simply translate this to GradleFx
dependency scopes.</p>
<p>On a side note: unfortunately IntelliJ has no support for RSL
linking libraries, only the Flex framework itself can be linked as
RSL (it's a total mistery to me why there's such a glaring
omission; feel free to vote on <a href=
"http://youtrack.jetbrains.com/issue/IDEA-80149">this issue</a>).
So for the time being this is one option more available to you
through GradleFx or CLI build.</p></div>Maxime Coweztag:support.gradlefx.org,2011-05-23:Comment/244203782013-01-31T19:44:04Z2013-01-31T19:44:07ZTransitive dependencies<div><p>Thank you, Maxime, I voted</p></div>Pavel Bernshtam