I just figured it out. I had to do some spelunking in the gradle android
plugin itself to figure this out.
We register a custom component in our plugin (which apply's the standard
gradle plugin) that makes sure the dependencies are available when you do
components.aar in the pom.
.... cut...
final Configuration defaultConfiguration =
project.getConfigurations().getByName(DEFAULT_CONFIGURATION_NAME);
project.getComponents().add(new
AndroidLibrarySoftwareComponent(defaultConfiguration));
...cut...
In 0.8.3, the DEFAULT_CONFIGURATION_NAME was set to "default". It looks
like you guys have done some internal refactoring of names and that name no
longer gives the configuration we need. I've switched to "compile" for now
which seems to restore functionality.
Is supporting this new publish mechanism something you would consider? If
so, I can look into whether my organization could contribute some cycles to
it (it would need a lot more work than the hack I put together so I don't
know if i would be able to). At a minimum, I can open an issue :-)
Cheers,
Scott
On Wed, Mar 26, 2014 at 9:12 PM, Scott Battaglia
<[email protected]>wrote:
> Well I think some of the ugliness there is because its not completely
> compatible with the Android plugin yet. I was hoping that was fixed. :-)
> If you remove the ugliness of fixing the pom, its actually pretty nice.
>
> We had a specific reason we needed to be on the new one (the old one was
> not working for us for some reason. I'll have to double check why. Its
> been a few releases that we've been on this one.)
>
>
> On Wed, Mar 26, 2014 at 9:06 PM, Xavier Ducrohet <[email protected]> wrote:
>
>> This is the new publishing plugin right? This looks awful because of the
>> way it works which isn't totally compatible with our plugin (due to how we
>> create our tasks/artifacts). The old plugin works fine, I haven't really
>> looked that much into the new one to figure out what is going on.
>>
>> The particular item in the release notes is about us breaking the support
>> for the old plugin.
>>
>>
>> On Wed, Mar 26, 2014 at 5:54 PM, Scott Battaglia <
>> [email protected]> wrote:
>>
>>> Also, I'm still on Gradle 1.10. I just upgraded the plugin not the
>>> Gradle version.
>>>
>>>
>>> On Wed, Mar 26, 2014 at 8:54 PM, Scott Battaglia <
>>> [email protected]> wrote:
>>>
>>>> When I was on the 0.8.x plugin, I had the following (see below), which
>>>> worked. We published the AAR, a source jar, the javadoc jar, and an apklib
>>>> and our pom.withXml listed the dependencies so we could fix some
>>>> information in the generated pom (components.aar was a component we
>>>> registered. I'm not sure if it was needed or not). With the upgrade this
>>>> doesn't work. The list of nodes in the pom.withXml does not include a
>>>> dependencies node. I removed our artifact (artifact ("build/libs/${
>>>> project.name}-${project.version}.aar")) and now the AAR artifact
>>>> doesn't get published at all (at least as far as I can tell. It has an
>>>> older timestamp than the other snapshots). The generated pom is missing
>>>> dependencies.
>>>>
>>>> publishing {
>>>> publications {
>>>>
>>>> androidArchive(MavenPublication) {
>>>>
>>>> artifact ("build/libs/${project.name}-${project.version}.aar")
>>>> {
>>>> from components.aar
>>>>
>>>> pom.withXml {
>>>> final Node node = asNode()
>>>> final List<String> aarGroupIds =
>>>> Arrays.asList("com.package", "com.package.identity")
>>>>
>>>> for (final Node n : node.children()) {
>>>> if (n.name().toString().contains("dependencies"))
>>>> {
>>>> for (final Node dependency : n.children()) {
>>>> boolean foundType = false;
>>>> boolean groupIdIsAarType;
>>>> for (final Node child :
>>>> dependency.children()) {
>>>> final String childName = child.name
>>>> ().toString();
>>>> if (childName.contains("scope")) {
>>>> child.setValue("compile")
>>>> } else if
>>>> (childName.contains("groupId")) {
>>>> final String childValue =
>>>> child.text();
>>>> groupIdIsAarType =
>>>> aarGroupIds.contains(childValue);
>>>> } else if
>>>> (childName.contains("type")) {
>>>> foundType = true;
>>>> }
>>>> }
>>>>
>>>> if (!foundType && groupIdIsAarType) {
>>>> dependency.appendNode("type",
>>>> "aar");
>>>> }
>>>> }
>>>> break;
>>>> }
>>>> }
>>>> }
>>>> }
>>>> artifact javadocJar
>>>> artifact sourceJar
>>>> artifact apklib
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>> On Wed, Mar 26, 2014 at 8:47 PM, Xavier Ducrohet <[email protected]>wrote:
>>>>
>>>>> What's in your build.gradle?
>>>>>
>>>>>
>>>>> On Wed, Mar 26, 2014 at 5:40 PM, Scott Battaglia <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> The 0.9.x release notes say: "
>>>>>>
>>>>>> - Generated POM files now have the proper dependencies even if
>>>>>> the pom object is manipulated in build.gradle"
>>>>>>
>>>>>> Are there any instructions on using this properly? I can't find it
>>>>>> in the user guide. And running the following:
>>>>>>
>>>>>> gradle clean build publishToMavenLocal
>>>>>>
>>>>>> generates a pom with missing dependencies.
>>>>>>
>>>>>> Thanks
>>>>>> Scott
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "adt-dev" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Xavier Ducrohet
>>>>> Android SDK Tech Lead
>>>>> Google Inc.
>>>>> http://developer.android.com | http://tools.android.com
>>>>>
>>>>> Please do not send me questions directly. Thanks!
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "adt-dev" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Xavier Ducrohet
>> Android SDK Tech Lead
>> Google Inc.
>> http://developer.android.com | http://tools.android.com
>>
>> Please do not send me questions directly. Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.