Artist Build Setup

As described in this post, recent updates to ARTist’s internal workings require an update of this documentation. This note will vanish as soon as the new documentation is published.
Until that, you can still use the description below to some extend, but expect some things to not work anymore.

Artist’s build setup is quite complex, but easy to set up if you follow this tutorial.

Software Requirements

High Level Steps

  1. CodeLib: Build CodeLib with gradle or Android Studio
    • codelib-gen: Generate codelib.* sourcefiles
  2. Android w/ ARTist: Download android with custom download source for folder platform/art
    • Build Android
    • Switch art’s branch
    • (place codelib.h/.cc sourcefiles in env/ folder)
    • rebuild art project solo
  3. Build ArtistGUI
    • Bundle dex2oat (w/ artist)
    • (optional) Bundle CodeLib

General information

ARTist’s art repositories branched from the following Android release tags:

  • android-6.0.1_r62 (Build: MTC20F) => artist_marshmallow_master
  • android-7.0.0_r12 (Build: NBD90W) => artist_nougat_master
  • android-7.1.1_r6 (Build: NMF26Q) => artist_nougat_7.1_master
  • android-8.0.0_r9 (Build: OPR3.170623.007) => artist_oreo_master

You can also choose your own release tag from the Android Website.

Artist should work with it, but we don’t guarantee it.

To be sure, jut choose one of the above listed Source Code Tags.

See: Android: Codenames, Tags, and Build Numbers

Building Android & Artist

For a general tutorial on how to build Android check the android projects official build documentation.

mkdir aosp_artist
cd aosp_artist
# repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r62
# repo init -u https://android.googlesource.com/platform/manifest -b android-7.0.0_r12
# repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r6
# repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r9
repo init -u https://android.googlesource.com/platform/manifest -b <RELEASE_TAG>
mkdir .repo/local_manifests

# curl -o .repo/local_manifests/artist.xml https://artist.cispa.saarland/res/marshmallow/local_manifests/artist.https.xml
# curl -o .repo/local_manifests/artist.xml https://artist.cispa.saarland/res/nougat_7.0/local_manifests/artist.https.xml
# curl -o .repo/local_manifests/artist.xml https://artist.cispa.saarland/res/nougat_7.1/local_manifests/artist.https.xml
# curl -o .repo/local_manifests/artist.xml https://artist.cispa.saarland/res/oreo/local_manifests/artist.https.xml
# if you have a GitHub account and a corresponding ssh key available, you can also use artist.ssh.xml instead of the https version
curl -o .repo/local_manifests/artist.xml https://artist.cispa.saarland/res/<VERSION>/local_manifests/artist.https.xml
repo sync
source build/envsetup.sh
lunch
# (Choose Your Target via name or number, e.g. aosp_arm-eng OR aosp_arm64-eng)
make clobber
# e.g. make -j8
make -j<THREADS>
# After XXX minutes.... android is built

After Android compiled completely, switched to ARTist’s branch.

It is important, that Android compiled completely one time, before you switch branches.

cd art
# git checkout <BRANCH>
# git checkout artist_marshmallow_master
# git checkout artist_nougat_master
# git checkout artist_nougat_7.1_master
# git checkout artist_oreo_master
git checkout <BRANCH>
# cd compiler/optimizing/artist; git checkout <BRANCH>; cd ../../.. # NOT necessary, default is master via `repo` tool
# make art / make dex2oat
# e.g. mmma art -j8
mmma art -j<THREADS> # First time build needs to build the dependencies, too
# e.g. mmm art -j8
mmm art  -j<THREADS> # Subsequent build without dependencies

Building CodeLib

git clone https://github.com/Project-ARTist/CodeLib.git
cd codelib
# create local.properties from local.properties.template 
# => either manually or start AndroidStudio (see local.properties.template)
# (optional) create gradle.properties
# => increase gradle heap space (see: gradle.properties.template)
gradle assemble

codelib-gen usage

Generate native codelib.cc/.h files from your CodeLib java source.

See the CodeLib Development Guide on a separate page.

Building ArtistGui

ArtistGui contains a submodule, which is usable as standalone command-line tool. It’s called Dexterous and can get obtained from github.

git clone --recursive https://github.com/Project-ARTist/ArtistGui.git
# create local.properties
# => either manually or start AndroidStudio (see local.properties.template)
# (optional) create gradle.properties
# => increase gradle heap space (see: gradle.properties.template)
gradle ArtistGui assemble
# gradle assemble

We first copy over our compiled CodeLib to ArtistGui

cp <CODE_LIB>/app/build/outputs/apk/app-debug.apk <ARTIST_GUI>/app/src/main/assets/codelib/<CODELIB_NAME>.apk

Once you know that ARTist and ArtistGui compile, you need to copy all of the artist/dex2oat libraries into the corresponding asset folders:

  • Copy the following files from <AOSP>/out/target/product/generic/symbols/system/lib/:
      libc.so
      libc++.so
      libnativebridge.so
      libnativehelper.so
      libnativeloader.so 
      libart.so
      libart-compiler.so
      libvixl.so
      libbacktrace.so
      libbase.so
      liblog.so
      libcutils.so
      libsigchain.so
      libunwind.so
      libutils.so
      libdl.so
      libm.so
      liblzma.so
      liblz4.so
    

    into <ArtistGui>/app/src/main/assets/artist/android-<API-LEVEL>/lib/

  • Copy <AOSP>/out/target/product/generic/symbols/system/bin/dex2oat into <ArtistGui>/app/src/main/assets/artist/android-<API-LEVEL>/

It is advised, that you adapt and use the deployment scripts in <ArtistGui>/scripts/* since they already take care of the compilation and copying.

  1. cp <ArtistGui>/scripts/config/ssh-2x.config.example <ArtistGui>/scripts/config/ssh-<API-LEVEL>.config
    • e.g.: cp <ArtistGui>/scripts/config/ssh-2x.config.example <ArtistGui>/scripts/config/ssh-25.config
  2. Adapt the path(s) and config vars in your newly created file, the variables are explained there.
    • You could also use localhost if you don’t use a build server.
    • server_aosp and mounted_aosp would be equal in this case
  3. Execute one of the 3 build scripts, that corresponds to your API level.
    • e.g.: <ArtistGui>/scripts/build_ssh_nougat_7.1.sh
    • There are also gradle targets if you want to click on them in Android Studio (look in the “other” category in the gradle build targets).
  4. Now click PLAY in Android Studio or gradle ArtistGui assemble to package the copied ARTist files in the APK.

Developing with Artist

Now that your development setup is complete, you can start compiling the examples.

Also check the Development Guide.