@Test
public void missingSourceCompat() throws Exception {

  // Wrong target (source, not target
  // Should rewrite to suggest checking JAVA_HOME
  createTempXmlFile();
  String output =
    ":MyApplication:preBuild UP-TO-DATE\n" +
    ":MyApplication:preFreeDebugBuild UP-TO-DATE\n" +
    ":MyApplication:preFreeReleaseBuild UP-TO-DATE\n" +
    ":MyApplication:preProDebugBuild UP-TO-DATE\n" +
    ":MyApplication:preProReleaseBuild UP-TO-DATE\n" +
    ":MyApplication:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" +
    ":MyApplication:prepareFreeDebugDependencies\n" +
    ":MyApplication:compileFreeDebugAidl UP-TO-DATE\n" +
    ":MyApplication:compileFreeDebugRenderscript UP-TO-DATE\n" +
    ":MyApplication:generateFreeDebugBuildConfig UP-TO-DATE\n" +
    ":MyApplication:mergeFreeDebugAssets UP-TO-DATE\n" +
    ":MyApplication:mergeFreeDebugResources UP-TO-DATE\n" +
    ":MyApplication:processFreeDebugManifest UP-TO-DATE\n" +
    ":MyApplication:processFreeDebugResources UP-TO-DATE\n" +
    ":MyApplication:generateFreeDebugSources UP-TO-DATE\n" +
    ":MyApplication:compileFreeDebug\n" +
    "Ignoring platform 'android-1': build.prop is missing.\n" +
    ":MyApplication:compileFreeDebug FAILED\n" +
    "\n" +
    "FAILURE: Build failed with an exception.\n" +
    "\n" +
    "* What went wrong:\n" +
    "Execution failed for task ':MyApplication:compileFreeDebug'.\n" +
    "> invalid source release: 1.7\n" +
    "\n" +
    "* Try:\n" +
    "Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\n" +
    "\n" +
    "BUILD FAILED\n" +
    "\n" +
    "Total time: 5.47 secs";
  assertEquals("0: Simple::MyApplication:preBuild UP-TO-DATE\n" +
               "1: Simple::MyApplication:preFreeDebugBuild UP-TO-DATE\n" +
               "2: Simple::MyApplication:preFreeReleaseBuild UP-TO-DATE\n" +
               "3: Simple::MyApplication:preProDebugBuild UP-TO-DATE\n" +
               "4: Simple::MyApplication:preProReleaseBuild UP-TO-DATE\n" +
               "5: Simple::MyApplication:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" +
               "6: Simple::MyApplication:prepareFreeDebugDependencies\n" +
               "7: Simple::MyApplication:compileFreeDebugAidl UP-TO-DATE\n" +
               "8: Simple::MyApplication:compileFreeDebugRenderscript UP-TO-DATE\n" +
               "9: Simple::MyApplication:generateFreeDebugBuildConfig UP-TO-DATE\n" +
               "10: Simple::MyApplication:mergeFreeDebugAssets UP-TO-DATE\n" +
               "11: Simple::MyApplication:mergeFreeDebugResources UP-TO-DATE\n" +
               "12: Simple::MyApplication:processFreeDebugManifest UP-TO-DATE\n" +
               "13: Simple::MyApplication:processFreeDebugResources UP-TO-DATE\n" +
               "14: Simple::MyApplication:generateFreeDebugSources UP-TO-DATE\n" +
               "15: Simple::MyApplication:compileFreeDebug\n" +
               "16: Simple:Ignoring platform 'android-1': build.prop is missing.\n" +
               "17: Simple::MyApplication:compileFreeDebug FAILED\n" +
               "18: Error:Execution failed for task ':MyApplication:compileFreeDebug'.\n" +
               // TODO: This is all we currently get. We should find a way to trap this and point to the
               // right source file where the invalid source flag is set
               "> invalid source release: 1.7\n" +
               "19: Info:BUILD FAILED\n" +
               "20: Info:Total time: 5.47 secs\n",
               toString(parser.parseGradleOutput(output)));
  sourceFile.delete();
}