How to Test Changes to Component Processor


I wanted to play around with the ComponentProcessor system but I’m not sure how to run/test it.

I saw here that @Diego ran ant components_JsonComponentDescription to test his changes, but I can’t seem to get it to work.

Is there a way I can test the system without having to rebuild everything and check the website?

Thank you for your time!

If ant components_JsonComponentDescription doesn’t work for you, just get into the components folder and run ant JsonComponentDescription. That should work properly, as each module has its own build.xml file.

App Inventor has different “modules” (appengine, blocklyeditor, buildserver, common, components), and each module has its own build.xml file that performs the tasks to build it. The main build.xml has different targets (all, noplay, MakeAuthKey…) which just make calls to each different module to perform the tasks defined in their respective build.xml file.
When running a task in the main file (appinventor/), what you are doing, in fact, is calling each module to build a specific task.

If we did not have that “main” build file, to build App Inventor it would be required to go to each module and run the needed tasks in the appropriate order. One of those tasks is JsonComponentDescription, located in the components module.
If you just want to build that task, go to the module folder (appinventor/components/) and run ant JsonComponentDescription, so ant will detect the build.xml file and run that task (as it is not available from the main build.xml).

By the way, I don’t know why, but ant components_JsonComponentDescription does not work for me now. I should have done something else that I forgot to make it work.

1 Like

If I recall correctly, components_JsonComponentDescription doesn’t exist any more, and neither does the JsonComponentDescription target. All of the annotation processors now run as part of the AndroidRuntime target. There is a components_AndroidRuntime target, but it is defined in build-common.xml so needs to be invoked with ant -f build-common.xml components_AndroidRuntime.

1 Like

Oh, sorry, I was running it in Kodular sources and we still have JsonComponentDescription, so it worked. :sweat_smile:
Then I guess that to re-generate the annotations processors it would be needed to run ant clean in components/, so just components runtime gets generated again (with the updated processors).

This isn't true. The AndroidRuntime target depends on AnnotationProcessors. The test for AndroidRuntime.uptodate checks all of the Java files in components/src to determine whether it needs to build (which includes the annotation processor sources).

Edit: I should clarify that technically it is true that it will accomplish the same goal, it just takes more time because more stuff needs to be recompiled.

1 Like

Humm, I see. So, is there any way to just generate now the simple_components.json like we did in the past with JsonComponentDescription? But if not, it does not matter. I cannot thing about any use case that only requires that file without needing the others.
I am trying the updated changes, and it seems like I have to run AndroidRuntime in order to get it (which yes, rebuilds every time I change something in a component without needing clean).

This was also true of JsonComponentDescription. Annotation processors run in the javac process and operate on the abstract syntax tree of the Java files. Technically, when you ran ant JsonComponentDescription it would just compile the AndroidRuntime files but with the specific annotation processor enabled. For each output file, this would rebuild the classes, resulting in running what was essentially the same computation up to five times in a regular build. With the new model, all of the annotation processors run as part of AndroidRuntime, so those 5 compilations reduce to 1.


Thank you guys for the information! Here is my new understanding based on reading your responses, and looking at the components build.xml file. Would you guys be able to check it for me?

ant AnnotationProcessors (from the components directory) compiles all of the annotation processors and their dependencies into an AnnotationProcessors.jar file.

ant AndroidRuntime (from the components directory) is dependent on the AnnotationProcessors target. It runs the AnnotationProcessors.jar file, generating simple_components.json among other files.

If I want to test changes to the file (and friends) I should run ant AndroidRuntime from the components directory. I can then look at simple_components.json to see if my changes worked.

Does that all sound correct?

Thank you again for the help!


Yes, that’s correct.

1 Like