One needs a Mac running macOS 10.13.4. Download and install Java SE JDK 8 from Oracle. Make sure $JAVA_HOME is set properly by editing ~/.bash_profile

export JAVA_HOME=$(/usr/libexec/java_home)

Install Xcode from the Mac App Store.

Use xcode-select command line tool to select correct Xcode if there are multiple versions of Xcode.

xcode-select -s /Applications/Xcode.app
or
xcode-select -s /Applications/OtherVersion/Xcode.app

Installing Xcode Command Line Tools

xcode-select --install

You may need to install cmake, pkg-config, openssl if this is first time.

brew install pkg-config
brew install cmake
brew install openssl

Install any other missing components your build systems may complain about.

Clone GitHub repo.

git clone https://github.com/ibinti/bugvm bvm
cd bvm

BugVM uses Gradle build system. Little or no knowledge of Gradle is required to build BugVM. There is nothing you need to install or configure. Just simple one command line is all you need.

./gradlew all

Note: Gradle will self-configure and download necessary things from the Internet. It takes a few hours to complete all the build processes.

Building BugVM on Ubuntu 16.04.4 LTS

One may need:

apt -y install make
apt -y install cmake
apt -y install g++
apt -y install g++-multilib
apt -y install clang
apt -y install libcap-dev
apt -y install libxml2-dev
apt -y install zlib1g-dev
apt -y install openjdk-8-jdk

Clone GitHub and Build

git clone https://github.com/ibinti/bugvm bvm
cd bvm
./gradlew all

./gradlew install

Sample HelloWorld Console App

git clone https://github.com/ibinti/bugvm-console bcon
cd bcon/helloworld
./gradlew

Sample iOS Apps

git clone https://github.com/ibinti/bugvm-ios bios

Button App
cd bios/button
./gradlew sim

WebView App
cd bios/webview
./gradlew sim

Using Gradle Plugin

build.gradle

buildscript {
    ext {
        bugvm_version = "1.2.9"
        kotlin_version = "1.2.40"
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "com.bugvm:bugvm-gradle:$bugvm_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: "bugvm"
apply plugin: "kotlin"

kotlin {
    experimental {
        coroutines "enable"
    }
}

compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile "com.bugvm:bugvm-rt:$bugvm_version"
    compile "com.bugvm:bugvm-apple:$bugvm_version"
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.3"
}

task sim {
    dependsOn launchIPhoneSimulator, build, clean
    launchIPhoneSimulator.mustRunAfter build
    build.mustRunAfter clean
}

task pad {
    dependsOn launchIPadSimulator, build, clean
    launchIPadSimulator.mustRunAfter build
    build.mustRunAfter clean
}

task dev {
    dependsOn launchIOSDevice, build, clean
    launchIOSDevice.mustRunAfter build
    build.mustRunAfter clean
}

task dist {
    dependsOn createIPA
    doLast {
        println "The IPA should be in build/bugvm directory."
    }
}

/*
In order to install to device or to package for the app store, one needs to follow Apple's
signing requirements. Easy way to setup signing and all is to create a sample iOS project
with Xcode. Xcode will advise you if something is missing or not correct.
Once Xcode can build and upload to the iTunes Connect, all setup is good.
*/
gradle.taskGraph.whenReady { graph ->
    if (graph.hasTask(dev)) {
        bugvm.iosSignIdentity = "iPhone Developer"
    } else
    if (graph.hasTask(dist)) {
        bugvm.iosSignIdentity = "iPhone Distribution"
    }
}

Gradle Tasks

Launch to iPhone Simulator

./gradlew sim

Launch to iPad Simulator

./gradlew pad

Install to Device

./gradlew dev

Create App for App Store Distribution

./gradlew dist