A few more gradle script questions

55 views
Skip to first unread message

Bill Phillips

unread,
Apr 23, 2015, 5:48:35 PM4/23/15
to bndtool...@googlegroups.com
1. Is there a way to import bundles into a local indexed repository via the default gradle scripts?


2. Is there a way to trigger a release via the default gradle scripts?



Bill

Bill Phillips

unread,
Apr 23, 2015, 5:51:24 PM4/23/15
to bndtool...@googlegroups.com
I guess I need to add one more question:

3. Is there a way to specify a release as a SNAPSHOT via the gradle script?


Thanks,


Bill

BJ Hargrave

unread,
Apr 23, 2015, 6:10:29 PM4/23/15
to bndtool...@googlegroups.com
On Apr 23, 2015, at 17:48 , Bill Phillips <william.r....@gmail.com> wrote:

1. Is there a way to import bundles into a local indexed repository via the default gradle scripts?

No. You would need to write your own gradle tasks.



2. Is there a way to trigger a release via the default gradle scripts?

The biz.aQute.bnd gradle plugin defines the release task which will release a projects jars to the -releaserepo.




Bill

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 

BJ



BJ Hargrave

unread,
Apr 23, 2015, 6:13:53 PM4/23/15
to bndtool...@googlegroups.com
On Apr 23, 2015, at 17:51 , Bill Phillips <william.r....@gmail.com> wrote:

I guess I need to add one more question:

3. Is there a way to specify a release as a SNAPSHOT via the gradle script?

Define SNAPSHOT :-)

You can make your bundle’s version any valid OSGi version. However, to end in “-SNAPSHOT” as maven wants, you will need some qualifier string to precede the - as - is not a valid version segment separator in OSGi. For example: 1.2.3.-SNAPSHOT is ok. Or 1.2.3.somthing-SNAPSHOT.

But I don’t think there is anything in the biz.aQute.bnd gradle plugin to release jars to a maven repo.



Thanks,


Bill


--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 

BJ



Ferry Huberts

unread,
Apr 24, 2015, 2:53:25 AM4/24/15
to bndtool...@googlegroups.com


On 23/04/15 23:48, Bill Phillips wrote:
1. Is there a way to import bundles into a local indexed repository via the default gradle scripts?


In my plugin:
Not directly, but a copy of the bundle into the repo followed by an index of that repo will do it.
It's easy to write a small gradle task that combines these steps.

Indexing tasks are provided to you in the setup my plugin creates.



2. Is there a way to trigger a release via the default gradle scripts?

See BJ's reply




Bill
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Ferry Huberts

Bill Phillips

unread,
Apr 28, 2015, 11:02:01 AM4/28/15
to bndtool...@googlegroups.com

2. Is there a way to trigger a release via the default gradle scripts?

The biz.aQute.bnd gradle plugin defines the release task which will release a projects jars to the -releaserepo.

 
From "gradle tasks" command, I see "release" and "releaseNeeded".

Is this what you refer to?


In the bndtools gui, there are three release options:
1. Update versions and Release
2. Update versions
3. Release


From gradle, how do I invoke the "Update versions" option?

I am hoping to automate the version calculation.



Thanks,


Bill

Ferry Huberts

unread,
Apr 28, 2015, 11:04:57 AM4/28/15
to bndtool...@googlegroups.com


On 28/04/15 17:02, Bill Phillips wrote:

2. Is there a way to trigger a release via the default gradle scripts?

The biz.aQute.bnd gradle plugin defines the release task which will release a projects jars to the -releaserepo.

 
From "gradle tasks" command, I see "release" and "releaseNeeded".

Is this what you refer to?


In the bndtools gui, there are three release options:
1. Update versions and Release
2. Update versions
3. Release


From gradle, how do I invoke the "Update versions" option?

You don't.
The build will simply fail if your versions are incorrect.



I am hoping to automate the version calculation.



Thanks,


Bill
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Ferry Huberts

Ferry Huberts

unread,
Apr 28, 2015, 11:10:19 AM4/28/15
to bndtool...@googlegroups.com


On 28/04/15 17:04, Ferry Huberts wrote:


On 28/04/15 17:02, Bill Phillips wrote:

2. Is there a way to trigger a release via the default gradle scripts?

The biz.aQute.bnd gradle plugin defines the release task which will release a projects jars to the -releaserepo.

 
From "gradle tasks" command, I see "release" and "releaseNeeded".

Is this what you refer to?


In the bndtools gui, there are three release options:
1. Update versions and Release
2. Update versions
3. Release


From gradle, how do I invoke the "Update versions" option?

You don't.
The build will simply fail if your versions are incorrect.



I am hoping to automate the version calculation.


A note about this:
Automating version increment calculation is dangerous.
An example: you might change semantics of an interface without changing its signature, which would be a major change that isn't reflected in the interface.
This is why version adjustments should be actions performed by a human (because the tooling can only see signatures of interface methods, and even there generics are erased).

"Never stop thinking" is the motto with version changes

Bill's Gmail

unread,
Apr 28, 2015, 1:22:50 PM4/28/15
to bndtool...@googlegroups.com

>> From "gradle tasks" command, I see "release" and "releaseNeeded".
>>
>> Is this what you refer to?
>>
>>
>> In the bndtools gui, there are three release options:
>> 1. Update versions and Release
>> 2. Update versions
>> 3. Release
>>
>>
>> From gradle, how do I invoke the "Update versions" option?
>
> You don't.
> The build will simply fail if your versions are incorrect.


If my versions are incorrect, what fails from a gradle perspective?
The build task?
The release task?

Is there a way to use gradle to ask whether it has detected the need for a new version without failing a build?
Is there a way to use gradle to ask whether a version has already been released?

I'm trying to piece all this together.
Is there some documentation that describes this?


Thanks,

Bill

BJ Hargrave

unread,
Apr 28, 2015, 1:35:03 PM4/28/15
to bndtool...@googlegroups.com

> On Apr 28, 2015, at 13:22 , Bill's Gmail <william.r....@gmail.com> wrote:
>
>
>>> From "gradle tasks" command, I see "release" and "releaseNeeded".
>>>
>>> Is this what you refer to?
>>>
>>>
>>> In the bndtools gui, there are three release options:
>>> 1. Update versions and Release
>>> 2. Update versions
>>> 3. Release
>>>
>>>
>>> From gradle, how do I invoke the "Update versions" option?
>>
>> You don't.
>> The build will simply fail if your versions are incorrect.
>
>
> If my versions are incorrect, what fails from a gradle perspective?
> The build task?
> The release task?

I expect the release task will fail.

>
> Is there a way to use gradle to ask whether it has detected the need for a new version without failing a build?
> Is there a way to use gradle to ask whether a version has already been released?

Yes. Gradle is groovy. So you can write any custom task you want and interact with the bnd API to do things unique to your build requirements. The bnd Project object is in the gradle project in the bnd extension under the project property. So bnd.project will hold the bnd Project object for the project. From there you can use the bnd API to do custom things.

>
> I'm trying to piece all this together.
> Is there some documentation that describes this?

Using bnd is (mostly) documented at http://bnd.bndtools.org/ but it is still a work-in-progress. The bnd API is most documented through the source/javadoc. Take a look at the bnd gradle plugin source to see how it uses the bnd API. For example, https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/src/aQute/bnd/gradle/BndPlugin.groovy#L259 shows the release task.

>
>
> Thanks,
>
> Bill
>
> --
> You received this message because you are subscribed to the Google Groups "bndtools-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--

BJ



Ferry Huberts

unread,
Apr 28, 2015, 2:24:18 PM4/28/15
to bndtool...@googlegroups.com


On 28/04/15 19:34, BJ Hargrave wrote:
>> On Apr 28, 2015, at 13:22 , Bill's Gmail <william.r....@gmail.com> wrote:
>>
>>
>>>> From "gradle tasks" command, I see "release" and "releaseNeeded".
>>>>
>>>> Is this what you refer to?
>>>>
>>>>
>>>> In the bndtools gui, there are three release options:
>>>> 1. Update versions and Release
>>>> 2. Update versions
>>>> 3. Release
>>>>
>>>>
>>>> From gradle, how do I invoke the "Update versions" option?
>>> You don't.
>>> The build will simply fail if your versions are incorrect.
>>
>> If my versions are incorrect, what fails from a gradle perspective?
>> The build task?
>> The release task?
> I expect the release task will fail.


First the jar task will fail.
Therefore the release will not be run.

>
>> Is there a way to use gradle to ask whether it has detected the need for a new version without failing a build?
>> Is there a way to use gradle to ask whether a version has already been released?
> Yes. Gradle is groovy. So you can write any custom task you want and interact with the bnd API to do things unique to your build requirements. The bnd Project object is in the gradle project in the bnd extension under the project property. So bnd.project will hold the bnd Project object for the project. From there you can use the bnd API to do custom things.
>
>> I'm trying to piece all this together.
>> Is there some documentation that describes this?
> Using bnd is (mostly) documented at http://bnd.bndtools.org/ but it is still a work-in-progress. The bnd API is most documented through the source/javadoc. Take a look at the bnd gradle plugin source to see how it uses the bnd API. For example, https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/src/aQute/bnd/gradle/BndPlugin.groovy#L259 shows the release task.
>
>>
>> Thanks,
>>
>> Bill
>>
>> --
>> You received this message because you are subscribed to the Google Groups "bndtools-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> Ferry Huberts

Bill Phillips

unread,
Aug 27, 2015, 1:46:00 PM8/27/15
to bndtools-users


On Thursday, April 23, 2015 at 6:10:29 PM UTC-4, BJ Hargrave wrote:

On Apr 23, 2015, at 17:48 , Bill Phillips <william.r....@gmail.com> wrote:

1. Is there a way to import bundles into a local indexed repository via the default gradle scripts?

No. You would need to write your own gradle tasks.


Coming back to this question, can someone give me a pointer on  where the repository import code is in the bndtools code base?




Bill

Eli Jordan

unread,
Oct 18, 2015, 7:59:12 AM10/18/15
to bndtools-users
It depends what type of repo, but the local repo uses https://github.com/bndtools/bnd/blob/master/biz.aQute.repository/src/aQute/bnd/deployer/repository/LocalIndexedRepo.java

Files are added by the putArtifact method.

In general all repositories are an implementation of RepositoryPlugin

https://github.com/bndtools/bnd/blob/master/biz.aQute.bndlib/src/aQute/bnd/service/RepositoryPlugin.java

David Daniel

unread,
Oct 18, 2015, 9:52:01 AM10/18/15
to bndtools-users
I am wondering if this was commented on in response to my other thread.  Is what you are saying is that there is not a repo right now to handle the situation of adding files from the current project so I should write a custom repo to pull from the current project.

Eli Jordan

unread,
Oct 18, 2015, 6:05:16 PM10/18/15
to bndtools-users
It was in reply to Bill's question about where the repository code is in bnd
Reply all
Reply to author
Forward
0 new messages