Skip to content
This repository was archived by the owner on Jun 4, 2020. It is now read-only.
Yusuf Cihan edited this page Feb 3, 2020 · 5 revisions

First setup

Set up the environment

  1. Create a new repository for storing your extension's source files. You can make it Public or Private.

  2. Create a folder called src (in GitHub or locally), and create another 2 folders according to your extension's package name. For example, if your extension's package name is com.yusufcihan.maths then your directory tree must be like this:

/src/com/yusufcihan/Maths/
  1. Lastly, add your Java source code to the inner folder.

If you created the folders in your computer, upload the src folder with all subdirectories to the GitHub, you can do that by using drag-drop upload feature or with GitHub Desktop.

Install the GitHub action

  1. Create a new GitHub actions file called build.yml in the /.github/workflows/ directory by typing .github/workflows/build.yml in the file name text box. GitHub will automatically create directories for slashes.

Creating Actions file

  1. Now copy this snippet and paste to the your new build.yml file.
on: push
name: Build my extension
jobs:
  buildAIX:
    name: Build AIX
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@master
    - name: Build AIX
      id: build_aix
      uses: ysfchn/appinventor-aix-action@master
      with:
          source: 'https://github.com/mit-cml/appinventor-sources.git'
    - name: Upload Artifact
      id: upload-artifact
      uses: actions/[email protected]
      with:
        name: ${{ steps.build_aix.outputs.file }}
        path: appinventor-sources/appinventor/components/build/extensions/${{ steps.build_aix.outputs.file }}
  1. Commit changes, and wait for your extension to compile. When build finished successfully, you need to go "Actions" tab in your repository, find Artifacts button and get the your .aix file.

Done!

Extra steps

If you want to add additional JAR libraries to your extension, you can follow this guide.

Adding a new library

  1. Fork mit-cml/appinventor-sources. Skip this step if you already forked App Inventor sources before.

  2. Open appinventor > lib folder.

  3. Create a folder in this directory (you can use the library name as folder name).

  4. And upload JAR file in that folder.

Example: Adding libraries

  1. Go back to the parent directory, and open components > build.xml file.

Adding libraries

  1. Edit the file and find CopyComponentLibraries section.

  2. Copy this code and append to the CopyComponentLibraries section.

<copy toFile="${public.deps.dir}/library.jar" file="${lib.dir}/folderName/library.jar" />
  1. Replace library word with jar library's file name which you uploaded in step #4. (In this case, file name is socket.io-client-1.0.0.jar)

  2. Replace folderName word with folder name which you created recently in step #3. (In this case, folder name is socketio)

Example:

<copy toFile="${public.deps.dir}/socket.io-client-1.0.0.jar" file="${lib.dir}/socketio/socket.io-client-1.0.0.jar" />
  1. Commit/save changes.

  2. Go back to your build.yml file and replace App Inventor sources Git URL with your own fork's Git URL.

Referencing the library

To use libraries in your extension;

  1. Go back to your extension's Java source.

  2. Add library file name (.jar) to @UsesLibraries section.

Adding libraries

  1. Commit changes and you now have an extension which packaged with this .jar file! Note that library name must be same with .jar file which you uploaded in step #4.

That's it! If you have any other questions, you can create an Issue.