You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Fu, Junwei" <ju...@intel.com> on 2014/10/28 02:53:30 UTC

RE: plugin with AAR

Hi,

In order to integrate the Crosswalk to Cordova easily, the xwalk_core_library was built into AAR format in Maven repository (https://download.01.org/crosswalk/releases/crosswalk/android/maven2). We expect reference the AAR to crosswalk-core-engine in Gradle scripte, it can be downloaded automatically when Cordova build with Gradle. But Cordova upstream can't  reference a Gradle script to android project automatically  when install the plugin, so I request a PR (https://github.com/apache/cordova-lib/pull/111 ) to cordova-lib, it will reference the Gradle script in plugin to build-extras.gradle which host in root project. We only add a xwalk.gradle file in plugin.
xwalk.gradle:
repositories {
       maven {
              url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
       }
}
dependencies {
         compile 'org.xwalk:xwalk_core_library_beta:9.38.208.4'
}

And add a type of framework named "graldeReference":
<framework src="libs/xwalk_core_library/xwalk.gradle" custom="true" type="gradleReference">

Is it a good approach to use Maven library in plugin? 

Thanks,
Junwei.
-----Original Message-----
From: iclelland@google.com [mailto:iclelland@google.com] On Behalf Of Ian Clelland
Sent: Wednesday, September 24, 2014 3:12 AM
To: dev@cordova.apache.org
Cc: Hu, Ningxin
Subject: Re: plugin with AAR

"Work in progress" is serious here. I wouldn't count on the Gradle build being completely stable until you see a 3.7 or a 4.0 release candidate.

If you're developing plugins with specialized build requirements using Gradle, we're very eager to accommodate you. Just be aware that it's a moving target at this point.

Ian

On Tuesday, September 23, 2014, Andrew Grieve <ag...@chromium.org> wrote:

> Gradle support on master is still somewhat a work-in-progress, but I 
> think it's coming along nicely :)
>
> What you want to do hasn't been done before that I know of, but it 
> *might* just work if you add a build-extras.gradle to your plugin and 
> adding the extra Dependencies line in there.
>
> More eyes on Gradle would be great, as it's still changing quite a bit.
>
> On Tue, Sep 23, 2014 at 4:02 AM, Fu, Junwei <junwei.fu@intel.com 
> <javascript:;>> wrote:
>
> > Hi,
> >
> > I know that the cordova-android master can build subproject with 
> > Gradle, but I have a question. I want to develop a plugin that 
> > dependence AAR
> from
> > remote maven repository, the AAR is library project. I need to make 
> > the plugin to  android project which include AndroidManifest.xml and 
> > project.properties files, but it isn't  what I want. I expect simple 
> > development with follow steps:
> >
> > 1.       Develop plugin with AAR
> >
> > Write a library.gradle file that include how to compiling the AAR, 
> > it looks like:
> >
> > Repositories {
> >
> >        Maven {
> >
> >             mavenCentral()
> >
> >       }
> >                }
> >
> >                Dependencies {
> >                        Compile 'com.sqlcipher:sqlcipher:3.0.1'
> > }
> >
> >
> > 2.       Plugman install the plugin
> >
> > The plugin library.gradle can apply to build.gradle that host in 
> > root project.
> >
> >
> >
> > 3.       The "build multiple apk" can open after install the plugin.
> >
> > Can we develop cordova plugin like that?
> >
> > Thanks,
> > Junwei.
> >
>

RE: plugin with AAR

Posted by "Fu, Junwei" <ju...@intel.com>.
Could someone review and merge the pull request https://github.com/apache/cordova-android/pull/133  ? It is add a section to build.gradle.

Thanks,
Junwei.

-----Original Message-----
From: Andrew Grieve [mailto:agrieve@google.com]
Sent: Wednesday, November 05, 2014 12:44 AM
To: Fu, Junwei
Cc: dev@cordova.apache.org; iclelland@google.com; Hu, Ningxin; Gao, Chun
Subject: Re: plugin with AAR

Had a look at the PR and think it looks good! Only thing I'd say is that I'd like to reserve build-extras.gradle for the user (tools shouldn't modify it).

Modifying build.gradle is challenging as well, since it's modified by build.js, and we want it to be easily replaceable when doing Cordova platform upgrades. However, I don't think it's that bad so long as we're aware of it, and not too far from what we do already for library projects.

So, how about adding a section to build.gradle like:

// PLUGIN GRADLE EXTENSIONS START
apply from: 'libs/xwalk_core_library/xwalk.gradle'
// PLUGIN GRADLE EXTENSIONS END


And we modify this list on each plugin add/remove & also make sure to maintain it within create.js


On Mon, Oct 27, 2014 at 9:53 PM, Fu, Junwei <ju...@intel.com> wrote:

> Hi,
>
> In order to integrate the Crosswalk to Cordova easily, the 
> xwalk_core_library was built into AAR format in Maven repository ( 
> https://download.01.org/crosswalk/releases/crosswalk/android/maven2).
> We expect reference the AAR to crosswalk-core-engine in Gradle 
> scripte, it can be downloaded automatically when Cordova build with 
> Gradle. But Cordova upstream can't  reference a Gradle script to 
> android project automatically when install the plugin, so I request a 
> PR (
> https://github.com/apache/cordova-lib/pull/111 ) to cordova-lib, it 
> will reference the Gradle script in plugin to build-extras.gradle 
> which host in root project. We only add a xwalk.gradle file in plugin.
> xwalk.gradle:
> repositories {
>        maven {
>               url '
> https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
>        }
> }
> dependencies {
>          compile 'org.xwalk:xwalk_core_library_beta:9.38.208.4'
> }
>
> And add a type of framework named "graldeReference":
> <framework src="libs/xwalk_core_library/xwalk.gradle" custom="true"
> type="gradleReference">
>
> Is it a good approach to use Maven library in plugin?
>
> Thanks,
> Junwei.
> -----Original Message-----
> From: iclelland@google.com [mailto:iclelland@google.com] On Behalf Of 
> Ian Clelland
> Sent: Wednesday, September 24, 2014 3:12 AM
> To: dev@cordova.apache.org
> Cc: Hu, Ningxin
> Subject: Re: plugin with AAR
>
> "Work in progress" is serious here. I wouldn't count on the Gradle 
> build being completely stable until you see a 3.7 or a 4.0 release candidate.
>
> If you're developing plugins with specialized build requirements using 
> Gradle, we're very eager to accommodate you. Just be aware that it's a 
> moving target at this point.
>
> Ian
>
> On Tuesday, September 23, 2014, Andrew Grieve <ag...@chromium.org>
> wrote:
>
> > Gradle support on master is still somewhat a work-in-progress, but I 
> > think it's coming along nicely :)
> >
> > What you want to do hasn't been done before that I know of, but it
> > *might* just work if you add a build-extras.gradle to your plugin 
> > and adding the extra Dependencies line in there.
> >
> > More eyes on Gradle would be great, as it's still changing quite a bit.
> >
> > On Tue, Sep 23, 2014 at 4:02 AM, Fu, Junwei <junwei.fu@intel.com 
> > <javascript:;>> wrote:
> >
> > > Hi,
> > >
> > > I know that the cordova-android master can build subproject with 
> > > Gradle, but I have a question. I want to develop a plugin that 
> > > dependence AAR
> > from
> > > remote maven repository, the AAR is library project. I need to 
> > > make the plugin to  android project which include 
> > > AndroidManifest.xml and project.properties files, but it isn't 
> > > what I want. I expect simple development with follow steps:
> > >
> > > 1.       Develop plugin with AAR
> > >
> > > Write a library.gradle file that include how to compiling the AAR, 
> > > it looks like:
> > >
> > > Repositories {
> > >
> > >        Maven {
> > >
> > >             mavenCentral()
> > >
> > >       }
> > >                }
> > >
> > >                Dependencies {
> > >                        Compile 'com.sqlcipher:sqlcipher:3.0.1'
> > > }
> > >
> > >
> > > 2.       Plugman install the plugin
> > >
> > > The plugin library.gradle can apply to build.gradle that host in 
> > > root project.
> > >
> > >
> > >
> > > 3.       The "build multiple apk" can open after install the plugin.
> > >
> > > Can we develop cordova plugin like that?
> > >
> > > Thanks,
> > > Junwei.
> > >
> >
>

Re: plugin with AAR

Posted by Andrew Grieve <ag...@google.com>.
I think it looks good! Ian's going to have a look as well today.

Yes - apply it to master and I'll merged master->4.0.x afterwards.

On Wed, Nov 5, 2014 at 10:05 PM, Fu, Junwei <ju...@intel.com> wrote:

> Thanks for your feedback.
>
> I'm agree with you. I have updated the PR (
> https://github.com/apache/cordova-lib/pull/111 ), could you please take a
> look it?
>
> The PR is requested in CB-3445 branch, should I commit it this patch in
> master branch?  Because I want to use this feature in Cordova 4.0.
>
> -----Original Message-----
> From: Andrew Grieve [mailto:agrieve@google.com]
> Sent: Wednesday, November 05, 2014 12:44 AM
> To: Fu, Junwei
> Cc: dev@cordova.apache.org; iclelland@google.com; Hu, Ningxin; Gao, Chun
> Subject: Re: plugin with AAR
>
> Had a look at the PR and think it looks good! Only thing I'd say is that
> I'd like to reserve build-extras.gradle for the user (tools shouldn't
> modify it).
>
> Modifying build.gradle is challenging as well, since it's modified by
> build.js, and we want it to be easily replaceable when doing Cordova
> platform upgrades. However, I don't think it's that bad so long as we're
> aware of it, and not too far from what we do already for library projects.
>
> So, how about adding a section to build.gradle like:
>
> // PLUGIN GRADLE EXTENSIONS START
> apply from: 'libs/xwalk_core_library/xwalk.gradle'
> // PLUGIN GRADLE EXTENSIONS END
>
>
> And we modify this list on each plugin add/remove & also make sure to
> maintain it within create.js
>
>
> On Mon, Oct 27, 2014 at 9:53 PM, Fu, Junwei <ju...@intel.com> wrote:
>
> > Hi,
> >
> > In order to integrate the Crosswalk to Cordova easily, the
> > xwalk_core_library was built into AAR format in Maven repository (
> > https://download.01.org/crosswalk/releases/crosswalk/android/maven2).
> > We expect reference the AAR to crosswalk-core-engine in Gradle
> > scripte, it can be downloaded automatically when Cordova build with
> > Gradle. But Cordova upstream can't  reference a Gradle script to
> > android project automatically when install the plugin, so I request a
> > PR (
> > https://github.com/apache/cordova-lib/pull/111 ) to cordova-lib, it
> > will reference the Gradle script in plugin to build-extras.gradle
> > which host in root project. We only add a xwalk.gradle file in plugin.
> > xwalk.gradle:
> > repositories {
> >        maven {
> >               url '
> > https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
> >        }
> > }
> > dependencies {
> >          compile 'org.xwalk:xwalk_core_library_beta:9.38.208.4'
> > }
> >
> > And add a type of framework named "graldeReference":
> > <framework src="libs/xwalk_core_library/xwalk.gradle" custom="true"
> > type="gradleReference">
> >
> > Is it a good approach to use Maven library in plugin?
> >
> > Thanks,
> > Junwei.
> > -----Original Message-----
> > From: iclelland@google.com [mailto:iclelland@google.com] On Behalf Of
> > Ian Clelland
> > Sent: Wednesday, September 24, 2014 3:12 AM
> > To: dev@cordova.apache.org
> > Cc: Hu, Ningxin
> > Subject: Re: plugin with AAR
> >
> > "Work in progress" is serious here. I wouldn't count on the Gradle
> > build being completely stable until you see a 3.7 or a 4.0 release
> candidate.
> >
> > If you're developing plugins with specialized build requirements using
> > Gradle, we're very eager to accommodate you. Just be aware that it's a
> > moving target at this point.
> >
> > Ian
> >
> > On Tuesday, September 23, 2014, Andrew Grieve <ag...@chromium.org>
> > wrote:
> >
> > > Gradle support on master is still somewhat a work-in-progress, but I
> > > think it's coming along nicely :)
> > >
> > > What you want to do hasn't been done before that I know of, but it
> > > *might* just work if you add a build-extras.gradle to your plugin
> > > and adding the extra Dependencies line in there.
> > >
> > > More eyes on Gradle would be great, as it's still changing quite a bit.
> > >
> > > On Tue, Sep 23, 2014 at 4:02 AM, Fu, Junwei <junwei.fu@intel.com
> > > <javascript:;>> wrote:
> > >
> > > > Hi,
> > > >
> > > > I know that the cordova-android master can build subproject with
> > > > Gradle, but I have a question. I want to develop a plugin that
> > > > dependence AAR
> > > from
> > > > remote maven repository, the AAR is library project. I need to
> > > > make the plugin to  android project which include
> > > > AndroidManifest.xml and project.properties files, but it isn't
> > > > what I want. I expect simple development with follow steps:
> > > >
> > > > 1.       Develop plugin with AAR
> > > >
> > > > Write a library.gradle file that include how to compiling the AAR,
> > > > it looks like:
> > > >
> > > > Repositories {
> > > >
> > > >        Maven {
> > > >
> > > >             mavenCentral()
> > > >
> > > >       }
> > > >                }
> > > >
> > > >                Dependencies {
> > > >                        Compile 'com.sqlcipher:sqlcipher:3.0.1'
> > > > }
> > > >
> > > >
> > > > 2.       Plugman install the plugin
> > > >
> > > > The plugin library.gradle can apply to build.gradle that host in
> > > > root project.
> > > >
> > > >
> > > >
> > > > 3.       The "build multiple apk" can open after install the plugin.
> > > >
> > > > Can we develop cordova plugin like that?
> > > >
> > > > Thanks,
> > > > Junwei.
> > > >
> > >
> >
>

RE: plugin with AAR

Posted by "Fu, Junwei" <ju...@intel.com>.
Thanks for your feedback.

I'm agree with you. I have updated the PR (https://github.com/apache/cordova-lib/pull/111 ), could you please take a look it?

The PR is requested in CB-3445 branch, should I commit it this patch in master branch?  Because I want to use this feature in Cordova 4.0.

-----Original Message-----
From: Andrew Grieve [mailto:agrieve@google.com] 
Sent: Wednesday, November 05, 2014 12:44 AM
To: Fu, Junwei
Cc: dev@cordova.apache.org; iclelland@google.com; Hu, Ningxin; Gao, Chun
Subject: Re: plugin with AAR

Had a look at the PR and think it looks good! Only thing I'd say is that I'd like to reserve build-extras.gradle for the user (tools shouldn't modify it).

Modifying build.gradle is challenging as well, since it's modified by build.js, and we want it to be easily replaceable when doing Cordova platform upgrades. However, I don't think it's that bad so long as we're aware of it, and not too far from what we do already for library projects.

So, how about adding a section to build.gradle like:

// PLUGIN GRADLE EXTENSIONS START
apply from: 'libs/xwalk_core_library/xwalk.gradle'
// PLUGIN GRADLE EXTENSIONS END


And we modify this list on each plugin add/remove & also make sure to maintain it within create.js


On Mon, Oct 27, 2014 at 9:53 PM, Fu, Junwei <ju...@intel.com> wrote:

> Hi,
>
> In order to integrate the Crosswalk to Cordova easily, the 
> xwalk_core_library was built into AAR format in Maven repository ( 
> https://download.01.org/crosswalk/releases/crosswalk/android/maven2). 
> We expect reference the AAR to crosswalk-core-engine in Gradle 
> scripte, it can be downloaded automatically when Cordova build with 
> Gradle. But Cordova upstream can't  reference a Gradle script to 
> android project automatically when install the plugin, so I request a 
> PR (
> https://github.com/apache/cordova-lib/pull/111 ) to cordova-lib, it 
> will reference the Gradle script in plugin to build-extras.gradle 
> which host in root project. We only add a xwalk.gradle file in plugin.
> xwalk.gradle:
> repositories {
>        maven {
>               url '
> https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
>        }
> }
> dependencies {
>          compile 'org.xwalk:xwalk_core_library_beta:9.38.208.4'
> }
>
> And add a type of framework named "graldeReference":
> <framework src="libs/xwalk_core_library/xwalk.gradle" custom="true"
> type="gradleReference">
>
> Is it a good approach to use Maven library in plugin?
>
> Thanks,
> Junwei.
> -----Original Message-----
> From: iclelland@google.com [mailto:iclelland@google.com] On Behalf Of 
> Ian Clelland
> Sent: Wednesday, September 24, 2014 3:12 AM
> To: dev@cordova.apache.org
> Cc: Hu, Ningxin
> Subject: Re: plugin with AAR
>
> "Work in progress" is serious here. I wouldn't count on the Gradle 
> build being completely stable until you see a 3.7 or a 4.0 release candidate.
>
> If you're developing plugins with specialized build requirements using 
> Gradle, we're very eager to accommodate you. Just be aware that it's a 
> moving target at this point.
>
> Ian
>
> On Tuesday, September 23, 2014, Andrew Grieve <ag...@chromium.org>
> wrote:
>
> > Gradle support on master is still somewhat a work-in-progress, but I 
> > think it's coming along nicely :)
> >
> > What you want to do hasn't been done before that I know of, but it
> > *might* just work if you add a build-extras.gradle to your plugin 
> > and adding the extra Dependencies line in there.
> >
> > More eyes on Gradle would be great, as it's still changing quite a bit.
> >
> > On Tue, Sep 23, 2014 at 4:02 AM, Fu, Junwei <junwei.fu@intel.com 
> > <javascript:;>> wrote:
> >
> > > Hi,
> > >
> > > I know that the cordova-android master can build subproject with 
> > > Gradle, but I have a question. I want to develop a plugin that 
> > > dependence AAR
> > from
> > > remote maven repository, the AAR is library project. I need to 
> > > make the plugin to  android project which include 
> > > AndroidManifest.xml and project.properties files, but it isn't  
> > > what I want. I expect simple development with follow steps:
> > >
> > > 1.       Develop plugin with AAR
> > >
> > > Write a library.gradle file that include how to compiling the AAR, 
> > > it looks like:
> > >
> > > Repositories {
> > >
> > >        Maven {
> > >
> > >             mavenCentral()
> > >
> > >       }
> > >                }
> > >
> > >                Dependencies {
> > >                        Compile 'com.sqlcipher:sqlcipher:3.0.1'
> > > }
> > >
> > >
> > > 2.       Plugman install the plugin
> > >
> > > The plugin library.gradle can apply to build.gradle that host in 
> > > root project.
> > >
> > >
> > >
> > > 3.       The "build multiple apk" can open after install the plugin.
> > >
> > > Can we develop cordova plugin like that?
> > >
> > > Thanks,
> > > Junwei.
> > >
> >
>

Re: plugin with AAR

Posted by Andrew Grieve <ag...@google.com>.
Had a look at the PR and think it looks good! Only thing I'd say is that
I'd like to reserve build-extras.gradle for the user (tools shouldn't
modify it).

Modifying build.gradle is challenging as well, since it's modified by
build.js, and we want it to be easily replaceable when doing Cordova
platform upgrades. However, I don't think it's that bad so long as we're
aware of it, and not too far from what we do already for library projects.

So, how about adding a section to build.gradle like:

// PLUGIN GRADLE EXTENSIONS START
apply from: 'libs/xwalk_core_library/xwalk.gradle'
// PLUGIN GRADLE EXTENSIONS END


And we modify this list on each plugin add/remove & also make sure to
maintain it within create.js


On Mon, Oct 27, 2014 at 9:53 PM, Fu, Junwei <ju...@intel.com> wrote:

> Hi,
>
> In order to integrate the Crosswalk to Cordova easily, the
> xwalk_core_library was built into AAR format in Maven repository (
> https://download.01.org/crosswalk/releases/crosswalk/android/maven2). We
> expect reference the AAR to crosswalk-core-engine in Gradle scripte, it can
> be downloaded automatically when Cordova build with Gradle. But Cordova
> upstream can't  reference a Gradle script to android project automatically
> when install the plugin, so I request a PR (
> https://github.com/apache/cordova-lib/pull/111 ) to cordova-lib, it will
> reference the Gradle script in plugin to build-extras.gradle which host in
> root project. We only add a xwalk.gradle file in plugin.
> xwalk.gradle:
> repositories {
>        maven {
>               url '
> https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
>        }
> }
> dependencies {
>          compile 'org.xwalk:xwalk_core_library_beta:9.38.208.4'
> }
>
> And add a type of framework named "graldeReference":
> <framework src="libs/xwalk_core_library/xwalk.gradle" custom="true"
> type="gradleReference">
>
> Is it a good approach to use Maven library in plugin?
>
> Thanks,
> Junwei.
> -----Original Message-----
> From: iclelland@google.com [mailto:iclelland@google.com] On Behalf Of Ian
> Clelland
> Sent: Wednesday, September 24, 2014 3:12 AM
> To: dev@cordova.apache.org
> Cc: Hu, Ningxin
> Subject: Re: plugin with AAR
>
> "Work in progress" is serious here. I wouldn't count on the Gradle build
> being completely stable until you see a 3.7 or a 4.0 release candidate.
>
> If you're developing plugins with specialized build requirements using
> Gradle, we're very eager to accommodate you. Just be aware that it's a
> moving target at this point.
>
> Ian
>
> On Tuesday, September 23, 2014, Andrew Grieve <ag...@chromium.org>
> wrote:
>
> > Gradle support on master is still somewhat a work-in-progress, but I
> > think it's coming along nicely :)
> >
> > What you want to do hasn't been done before that I know of, but it
> > *might* just work if you add a build-extras.gradle to your plugin and
> > adding the extra Dependencies line in there.
> >
> > More eyes on Gradle would be great, as it's still changing quite a bit.
> >
> > On Tue, Sep 23, 2014 at 4:02 AM, Fu, Junwei <junwei.fu@intel.com
> > <javascript:;>> wrote:
> >
> > > Hi,
> > >
> > > I know that the cordova-android master can build subproject with
> > > Gradle, but I have a question. I want to develop a plugin that
> > > dependence AAR
> > from
> > > remote maven repository, the AAR is library project. I need to make
> > > the plugin to  android project which include AndroidManifest.xml and
> > > project.properties files, but it isn't  what I want. I expect simple
> > > development with follow steps:
> > >
> > > 1.       Develop plugin with AAR
> > >
> > > Write a library.gradle file that include how to compiling the AAR,
> > > it looks like:
> > >
> > > Repositories {
> > >
> > >        Maven {
> > >
> > >             mavenCentral()
> > >
> > >       }
> > >                }
> > >
> > >                Dependencies {
> > >                        Compile 'com.sqlcipher:sqlcipher:3.0.1'
> > > }
> > >
> > >
> > > 2.       Plugman install the plugin
> > >
> > > The plugin library.gradle can apply to build.gradle that host in
> > > root project.
> > >
> > >
> > >
> > > 3.       The "build multiple apk" can open after install the plugin.
> > >
> > > Can we develop cordova plugin like that?
> > >
> > > Thanks,
> > > Junwei.
> > >
> >
>