Re: Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

2016-10-11 Thread Sergio Schvezov
El martes, 11 de octubre de 2016 07h'37:33 ART, Jian LUO 
 escribió:

On Oct 11, 2016 12:23, "Sergio Schvezov" 
wrote:


El martes, 11 de octubre de 2016 06h'38:49 ART, Jian LUO <

jian.luo...@gmail.com> escribió:


Hi,

Thanks for the explanation. That's exactly what comes first in my mind.
I've tried to customize the ant / jdk plugin by overriding the env

method.

The doc string of BasePlugin.env reads "return a list with the execution
environment for building". However the result env applies both to build
time and to the generated wrapper nonetheless. How can i 
override runtime

only env in the plugin?



Look at how we do it in the go plugin. That will give you anice idea.


Thanks. I'll give it a try.



With regards to a way to do it more generically we want to eventually

introduce a build-environment keyword for parts and have that carry some
weight in the chaining of parts with the `after` keyword. As an
illustration you would be able to do something like this:


parts:
   my-app:
   plugin:maven
   source: 
   after: [ibm-java]
   environment:
   - CLASSPATH:
   build-environment:
   - $ibm-java
   ibm-java:
   plugin: dump
   source: 
   build-environment:
   - JAVA_HOME: 
   - PATH:
   environment:
   - PATH:

And for apps:

apps:
   my-app:
   command: 
   environment:
   - $ibm-java
   -

Something like that. This in the design phase though. But this way you

can provide a Java to build as a part and a subsequent one to use as the
runtime.

Great! Will it be back ported to 16.04 when finished?


Indeed it will


--
Enviado con Dekko desde mi dispositivo Ubuntu

--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

2016-10-11 Thread Jian LUO
On Oct 11, 2016 12:23, "Sergio Schvezov" 
wrote:
>
> El martes, 11 de octubre de 2016 06h'38:49 ART, Jian LUO <
jian.luo...@gmail.com> escribió:
>>
>> Hi,
>>
>> Thanks for the explanation. That's exactly what comes first in my mind.
>> I've tried to customize the ant / jdk plugin by overriding the env
method.
>> The doc string of BasePlugin.env reads "return a list with the execution
>> environment for building". However the result env applies both to build
>> time and to the generated wrapper nonetheless. How can i override runtime
>> only env in the plugin?
>
>
> Look at how we do it in the go plugin. That will give you anice idea.

Thanks. I'll give it a try.

>
> With regards to a way to do it more generically we want to eventually
introduce a build-environment keyword for parts and have that carry some
weight in the chaining of parts with the `after` keyword. As an
illustration you would be able to do something like this:
>
> parts:
>my-app:
>plugin:maven
>source: 
>after: [ibm-java]
>environment:
>- CLASSPATH:
>build-environment:
>- $ibm-java
>ibm-java:
>plugin: dump
>source: 
>build-environment:
>- JAVA_HOME: 
>- PATH:
>environment:
>- PATH:
>
> And for apps:
>
> apps:
>my-app:
>command: 
>environment:
>- $ibm-java
>-
>
> Something like that. This in the design phase though. But this way you
can provide a Java to build as a part and a subsequent one to use as the
runtime.

Great! Will it be back ported to 16.04 when finished?

Jian
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

2016-10-11 Thread Sergio Schvezov
El martes, 11 de octubre de 2016 06h'38:49 ART, Jian LUO 
 escribió:

Hi,

Thanks for the explanation. That's exactly what comes first in my mind.
I've tried to customize the ant / jdk plugin by overriding the env method.
The doc string of BasePlugin.env reads "return a list with the execution
environment for building". However the result env applies both to build
time and to the generated wrapper nonetheless. How can i override runtime
only env in the plugin?


Look at how we do it in the go plugin. That will give you anice idea.

With regards to a way to do it more generically we want to eventually 
introduce a build-environment keyword for parts and have that carry some 
weight in the chaining of parts with the `after` keyword. As an 
illustration you would be able to do something like this:


parts:
   my-app:
   plugin:maven
   source: 
   after: [ibm-java]
   environment:
   - CLASSPATH:
   build-environment:
   - $ibm-java
   ibm-java:
   plugin: dump
   source: 
   build-environment:
   - JAVA_HOME: 
   - PATH:
   environment:
   - PATH:

And for apps:

apps:
   my-app:
   command: 
   environment:
   - $ibm-java
   -

Something like that. This in the design phase though. But this way you can 
provide a Java to build as a part and a subsequent one to use as the 
runtime.
   



--
Enviado con Dekko desde mi dispositivo Ubuntu

--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

2016-10-11 Thread Jian LUO
Hi,

Thanks for the explanation. That's exactly what comes first in my mind.
I've tried to customize the ant / jdk plugin by overriding the env method.
The doc string of BasePlugin.env reads "return a list with the execution
environment for building". However the result env applies both to build
time and to the generated wrapper nonetheless. How can i override runtime
only env in the plugin?

Jian

On Oct 11, 2016 09:53, "Didier Roche"  wrote:

Le 10/10/2016 à 23:49, Jian LUO a écrit :

Hi,

I don't think it counts as cross compiling since Java (at least in my case)
is cross platform. Just wanted to compile Java with one JDK and run with
another.


Hey,

I'm adding Sergio to the conversation, but I think the easiest path is to
create a custom plugin, inheriting from the base java one, which is
outputting a wrapper scripts with different JAVA env variables.
That way, you keep the current building behavior (build with java on the
machine), but output a script which will point to an armhf java path for
instance and download the correct version and packages version for all
those.
Cross-compilation-like may be needed as Manik suggested as you will need to
pull some packages which are architectures specific.

On how to create a custom plugin, here is some documentation:
http://snapcraft.io/docs/build-snaps/plugins and the playpen has some
example: https://github.com/ubuntu/snappy-playpen/blob/master/
idea/parts/plugins/x-antIntellij.py
I'll let Sergio adding more info as needed :)

Cheers,
Didier



Jian

On Oct 10, 2016 20:05, "Manik Taneja"  wrote:

>
>
> On Mon, Oct 10, 2016 at 6:33 AM, Jian LUO  wrote:
>
>> Hi List,
>>
>> Is there any formal way in snapcraft  to set environment variables
>> separately for build time and run time? The use case I'm facing is building
>> a Java snap on amd64 host for armhf target.
>>
> Snapcraft does not support cross-compilation. Consider building natively
> on armhf, or using this as reference-
>
> https://github.com/snapcore/snapd/blob/master/docs/cross-build.md
>
> and let us know if you see any issues.
>
> /Manik
>




--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: https://lists.ubuntu.com/
mailman/listinfo/snapcraft
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

2016-10-11 Thread Didier Roche
Le 10/10/2016 à 23:49, Jian LUO a écrit :
>
> Hi,
>
> I don't think it counts as cross compiling since Java (at least in my
> case) is cross platform. Just wanted to compile Java with one JDK and
> run with another.
>

Hey,

I'm adding Sergio to the conversation, but I think the easiest path is
to create a custom plugin, inheriting from the base java one, which is
outputting a wrapper scripts with different JAVA env variables.
That way, you keep the current building behavior (build with java on the
machine), but output a script which will point to an armhf java path for
instance and download the correct version and packages version for all
those.
Cross-compilation-like may be needed as Manik suggested as you will need
to pull some packages which are architectures specific.

On how to create a custom plugin, here is some documentation:
http://snapcraft.io/docs/build-snaps/plugins and the playpen has some
example:
https://github.com/ubuntu/snappy-playpen/blob/master/idea/parts/plugins/x-antIntellij.py
I'll let Sergio adding more info as needed :)

Cheers,
Didier


> Jian
>
>
> On Oct 10, 2016 20:05, "Manik Taneja"  > wrote:
>
>
>
> On Mon, Oct 10, 2016 at 6:33 AM, Jian LUO  > wrote:
>
> Hi List,
>
> Is there any formal way in snapcraft  to set environment
> variables separately for build time and run time? The use case
> I'm facing is building a Java snap on amd64 host for armhf target.
>
> Snapcraft does not support cross-compilation. Consider building
> natively on armhf, or using this as reference-
>
> https://github.com/snapcore/snapd/blob/master/docs/cross-build.md
> 
>
> and let us know if you see any issues.
>
> /Manik
>
>
>

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

2016-10-10 Thread Jian LUO
Hi,

I don't think it counts as cross compiling since Java (at least in my case)
is cross platform. Just wanted to compile Java with one JDK and run with
another.

Jian

On Oct 10, 2016 20:05, "Manik Taneja"  wrote:

>
>
> On Mon, Oct 10, 2016 at 6:33 AM, Jian LUO  wrote:
>
>> Hi List,
>>
>> Is there any formal way in snapcraft  to set environment variables
>> separately for build time and run time? The use case I'm facing is building
>> a Java snap on amd64 host for armhf target.
>>
> Snapcraft does not support cross-compilation. Consider building natively
> on armhf, or using this as reference-
>
> https://github.com/snapcore/snapd/blob/master/docs/cross-build.md
>
> and let us know if you see any issues.
>
> /Manik
>
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

2016-10-10 Thread Manik Taneja
On Mon, Oct 10, 2016 at 6:33 AM, Jian LUO  wrote:

> Hi List,
>
> Is there any formal way in snapcraft  to set environment variables
> separately for build time and run time? The use case I'm facing is building
> a Java snap on amd64 host for armhf target.
>
Snapcraft does not support cross-compilation. Consider building natively on
armhf, or using this as reference-

https://github.com/snapcore/snapd/blob/master/docs/cross-build.md

and let us know if you see any issues.

/Manik
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft