Building a New Extension

194 views
Skip to first unread message

Farzeen Harunani

unread,
Aug 8, 2016, 4:26:35 PM8/8/16
to App Inventor Open Source Development
Hi,
I built several AppVis components that use isenseproject.org that we used for our summer camp in Medford and Everett. The version of AI with the new components is at ai.cspathways.org, and that all works very well. I decided to implement the iSENSEPublisher component, a nonvisible component, as an extension, and my source code is at farxinu/appinventor-sources (branch: extension). However, when I change the package to something custom, it still builds correctly and the local instance still recognizes an iSENSEPublisher component, but running "ant extensions" creates an empty build folder with nothing in it. 
Any ideas?
Thanks! 

Jos Flores

unread,
Aug 9, 2016, 8:05:16 AM8/9/16
to app-inventor-open-source-dev
Hi Farzeen,

I know nothing about extensions, so all this might be plainly wrong. I
recall from reading the docs a good while back, that extensions have
to be placed in the runtime directory of the components project. That
basically sets the package to that location. If you are changing the
package name, you will have to move the files to somewhere else,
right? I guess the build script only looks for stuff in one place, so
it cannot find your files. Have you had a look at the ant files that
do the packaging?

To he honest, I would very much like to see a design in which an
extension can be placed anywhere, with a config file pointing to the
main sources on disk. That way an extension could be its own repo, and
they could be shared (in source form), distribute, and maintain much
more easily.

There have been recent (ish) changes to the packaging script [1]. Not
sure what's in it, but if you haven't pulled from master for a while,
that might help (or not!).

[1] https://github.com/mit-cml/appinventor-sources/commit/2696cac3800ce24f4db53b73242a30d5a3fb07e6

cheers,
José
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to app-inventor-open-so...@googlegroups.com.
> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

Evan Patton

unread,
Aug 9, 2016, 8:13:09 AM8/9/16
to app-inventor-o...@googlegroups.com
Andrew and I have talked about extension development a bit and we are planning on writing an Android Studio plugin to streamline the setup, building, and packaging process. We do not have an ETA for that plugin at this time, however.

Evan
signature.asc

Jos Flores

unread,
Aug 9, 2016, 9:33:19 AM8/9/16
to app-inventor-open-source-dev
A plugin is a fantastic idea (especially if it also works in IntelliJ
community) but the underlying infrastructure needs are the same,
mainly having a good way to separate extension code from the rest of
the code (meaning actual files).

Evan, not sure you've ever seen it, but in the _misc_ folder there's a
python script (GUI) to create the boilerplate code for components [1].
It was an Open Academy project a few years ago. I still use it but
don't know if others do. Shouldn't be terribly difficult to add
extension support in the short term.

[1] https://github.com/mit-cml/appinventor-sources/tree/master/appinventor/misc/componentcreator

cheers,
José

Farzeen Harunani

unread,
Aug 9, 2016, 10:22:31 AM8/9/16
to app-inventor-o...@googlegroups.com
Hi,
According to the docs, when you develop the extension, you develop it like any other. However, when you're packaging a new extension, you change the package name to something custom, move it out of the runtime directory and into the corresponding directory according to your custom package. Then you're supposed to run "ant extensions" and it does the right thing. 
That's according to the docs. What actually happens is that I still get my component appearing and everything, but ant extensions does not build an aix. 
Thanks,
Farzeen


>>> To post to this group, send email to

>>> Visit this group at
>>> https://groups.google.com/group/app-inventor-open-source-dev.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
>> To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

>> Visit this group at https://groups.google.com/group/app-inventor-open-source-dev.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
> To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-open-source-dev/sbYLJng9ypo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

Taifun

unread,
Aug 9, 2016, 10:33:35 AM8/9/16
to App Inventor Open Source Development
you can try one of the sample extensions, for example my clipboard extension, source is here https://puravidaapps.com/clipboard.php

create a file TaifunClipboard.java, copy the source code inside and move the file into the folder 
/appinventor-sources/appinventor/components/src/com/puravidaapps

then run ant clean and ant extensions

and you should find the extension in 
/appinventor-sources/appinventor/components/build/extensions

now modify your extension accordingly
Taifun

Hal Abelson

unread,
Aug 9, 2016, 9:38:26 PM8/9/16
to App Inventor Open Source Development, Jeff Schiller, Justus Raju

Farzeen,

I believe that Jeff and Justus are working on a update to the extension system -- check with them.

== Hal

Justus Raju

unread,
Aug 10, 2016, 10:52:26 AM8/10/16
to Hal Abelson, App Inventor Open Source Development, Jeff Schiller
Hi

@Farzeen

You are allowed to change the package to something custom. But you are also expected to follow the java convention of putting the source file Extension.java in a folder that corresponds to the package path. 

For example if your extension is written nicely in the file Extension.java 
And you have the package set as my.custom.package
Then you are required to put your Extension.java inside the folder my/custom/package/. 
So your source file is precisely located at "appinventor-sources/appinventor/components/src/my/custom/package/Extension.java".

Sorry about that, but that's how ant build recursively works on generating annotations and all. Getting the package and location not agree with each other can get us into some trouble. 

This should be stressed enough in the documentation. I should be doing that as soon as I can. 

Thank you.

farzeen....@gmail.com

unread,
Aug 10, 2016, 10:54:41 AM8/10/16
to Justus Raju, Hal Abelson, App Inventor Open Source Development, Jeff Schiller

Hi,

Thanks for the answer! I did that. The custom package is edu/uml/cs/isense, and the corresponding java file is in components/src/edu/uml/cs/isense.

Thanks,

Farzeen

--

You received this message because you are subscribed to a topic in the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-open-source-dev/sbYLJng9ypo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.

Justus Raju

unread,
Aug 10, 2016, 11:11:15 AM8/10/16
to farzeen....@gmail.com, Hal Abelson, App Inventor Open Source Development, Jeff Schiller
Hi

@Farzeen

Do you mean that correcting the package path still gives gives you an error?

Are you on the latest commit in appinventor-sources?
Because few weeks ago I made a commit that fixes extension building issues. So you should be on any state after that commit.

If you are at a state after that commit and still have any error on ant extensions, then I am interested into what exactly the issue might be.
It would be a case I would like to investigate on. If you don't mind :)

Thank you



To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

farzeen....@gmail.com

unread,
Aug 10, 2016, 11:41:05 AM8/10/16
to Justus Raju, Hal Abelson, App Inventor Open Source Development, Jeff Schiller

Hi,

Exactly. There’s no “error”, per se—it just doesn’t build an extension.

I definitely am up to date on that commit.

How can I help you investigate?

Thanks so much!

To unsubscribe from this group and all its topics, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.

Taifun

unread,
Aug 10, 2016, 12:06:10 PM8/10/16
to App Inventor Open Source Development
Exactly. There’s no “error”, per se—it just doesn’t build an extension.
are you able to build one of the example extensions as suggested in my last post?
Taifun

farzeen....@gmail.com

unread,
Aug 10, 2016, 12:14:58 PM8/10/16
to Taifun, App Inventor Open Source Development

Oh! Sorry, I forgot to mention that no, it doesn’t work to build any extensions for me. It continues to say “build successful” and that it created the extensions directory, but the directory is empty.

 

 

From: Taifun
Sent: Wednesday, August 10, 2016 12:06 PM
To: App Inventor Open Source Development
Subject: Re: [App Inventor Open Source Development] Re: Building aNewExtension

 

Exactly. There’s no “error”, per se—it just doesn’t build an extension.

are you able to build one of the example extensions as suggested in my last post?

Taifun

 

--

Justus Raju

unread,
Aug 10, 2016, 2:24:04 PM8/10/16
to farzeen....@gmail.com, Hal Abelson, App Inventor Open Source Development, Jeff Schiller
Just a few things to check : 

Did you put this annotation on your Extension class ?
@SimpleObject(external = true) 

Do you check for extensions in the correct directory?
appinventor-sources/appinventor/components/build/extensions/

Are you on Windows? I am not sure with windows platform. I haven't tested it there. I have seen the extensions build properly on Mac and Linux.

How many extension sources are present in your appinventor-sources/appinventor/components/src/ ?
If any, make sure each extensions has their package name and file path agreeing to each other. This is important.

Do you find any folders like these externalComponents, externalComponents-class, extensions inside appinventor-sources/appinventor/components/build/ ?
They must exist. You might want to explore whats inside these folders and tell me about it.

:)


To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

farzeen....@gmail.com

unread,
Aug 10, 2016, 2:40:04 PM8/10/16
to Justus Raju, Hal Abelson, App Inventor Open Source Development, Jeff Schiller

Ahh, that’s it! The “SimpleObject(external=true)” annotation was missing. I didn’t see that listed anywhere in the App Inventor Extensions document, so I didn’t realize it needed to be there. Thanks so much! All of it works now 😊

To unsubscribe from this group and all its topics, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.

Justus Raju

unread,
Aug 10, 2016, 2:41:57 PM8/10/16
to farzeen....@gmail.com, Hal Abelson, App Inventor Open Source Development, Jeff Schiller

Glad it worked! :)

farzeen....@gmail.com

unread,
Aug 10, 2016, 2:55:14 PM8/10/16
to Justus Raju, Hal Abelson, App Inventor Open Source Development, Jeff Schiller, Fred Martin

Thanks again! Is there any way that we can get the iSENSE extension into the supported extensions for AppInventor for public use?

Justus Raju

unread,
Aug 10, 2016, 3:23:15 PM8/10/16
to Farzeen Harunani, Hal Abelson, App Inventor Open Source Development, Jeff Schiller, Fred Martin
This question should go over to the folks at MIT.

I don't know exactly. 

Usually people provide their extensions through their own websites. This is one awesome example by Taifun (http://puravidaapps.com/extensions.php)!
If your talking about getting your extension here http://appinventor.mit.edu/extensions/.  I don't know.
The extensions posted there are the ones developed by MIT and other 'guinea pig' extensions which were used during the making of the extensions feature.

I don't think there is a place for public extensions now. There might be in the future. 
Probably there will be a way to let developers showcase their extensions. (In the future)
But this is hard to do mainly because of security and the need of a review team. 
The MIT App Inventor team is a small team but they are busy doing amazing and important things. So I doubt if they would get time for reviewing public extensions. 

Like I said this question should really be thrown at folks at MIT. 
@Hal? @Jeff? 

Thank you :)

 

Glad it worked! :)

 

To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

Josh @ MIT

unread,
Aug 11, 2016, 6:05:54 AM8/11/16
to App Inventor Open Source Development, quixoti...@gmail.com, halatmi...@gmail.com, j...@mit.edu, fgmar...@gmail.com
Thanks all for helping sort this out and get the iSENSE extension running.

Would someone who has access check the documentation and verify whether or not the SimpleObject notation documentation is in there, and if not, please add it? 

To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.

Justus Raju

unread,
Aug 11, 2016, 7:52:34 AM8/11/16
to Josh @ MIT, App Inventor Open Source Development, Hal Abelson, Jeffrey Schiller, Fred Martin
It was already written in the document right here 

But I went ahead and added a reminder in the packaging section.  :)

To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsubs...@googlegroups.com.

Hal Abelson

unread,
Aug 11, 2016, 8:58:24 AM8/11/16
to Justus Raju, Josh @ MIT, App Inventor Open Source Development, Jeffrey Schiller, Fred Martin
Thanks, Justus!

== Hal

Hal Abelson
h...@mit.edu
Prof. of Comp. Sci. and Eng.
MIT Dept. of Elec. Eng. and Comp. Sci.


Reply all
Reply to author
Forward
0 new messages