diff --git a/build.gradle b/build.gradle index 0bca9c3b59cf4a645ea34ddd2ff8e9cc9cfe2cfa..cdc1bc40f9e1058d22bf136da6a9bdcac0e643db 100644 --- a/build.gradle +++ b/build.gradle @@ -49,3 +49,18 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir } + +// This allows to disable pre dexing. If not disabled, it makes each CI build slow +// See https://circleci.com/docs/android/#disable-pre-dexing-to-improve-build-performance +// http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance +project.ext.preDexLibs = !project.hasProperty('disablePreDex') + +subprojects { + project.plugins.whenPluginAdded { plugin -> + if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) { + project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs + } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) { + project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs + } + } +} diff --git a/circle.yml b/circle.yml index e8b3dd401fc2cef0d8bac30b560b3fcf58b92c6f..3bf62451a3e817cf9729ecd3361f3fb0ad4325c3 100644 --- a/circle.yml +++ b/circle.yml @@ -1,16 +1,38 @@ machine: + environment: + CLOUDSDK_CORE_DISABLE_PROMPTS: 1 + CLOUDSDK_PYTHON_SITEPACKAGES: 1 + CLOUDSDK_INSTALL_DIR: /tmp java: version: oraclejdk8 dependencies: pre: - echo y | android update sdk --no-ui --all --filter "build-tools-23.0.3" + # For some reasons, there is an issue with the pre-installed gcloud that + # PyOpenSSL is not available when trying to activate the service account. + # Re-installing the gcloud worked as a workaround. + # See https://discuss.circleci.com/t/deployment-to-appengine-fails-pyopenssl-not-available/2154 + - sudo apt-get remove python-virtualenv python-openssl python3-openssl + - sudo apt-get update + - sudo apt-get install python-openssl python3-openssl + - sudo rm -rf /opt/google-cloud-sdk/ + - curl https://sdk.cloud.google.com | bash + - source ~/.bashrc cache_directories: - ~/.android override: - ./gradlew dependencies + post: + - echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ${HOME}/client-secret.json + - /tmp/google-cloud-sdk/bin/gcloud config set project ${GCLOUD_PROJECT} + - /tmp/google-cloud-sdk/bin/gcloud --quiet components update + - /tmp/google-cloud-sdk/bin/gcloud --quiet components install beta + - /tmp/google-cloud-sdk/bin/gcloud auth activate-service-account ${GCLOUD_SERVICE_ACCOUNT} --key-file ${HOME}/client-secret.json test: override: - # TODO: Enable connectedAndroidTest - - ./gradlew build + - ./gradlew build assembleAndroidTest + - echo "y" | /tmp/google-cloud-sdk/bin/gcloud beta test android run --type instrumentation --app app/build/outputs/apk/app-debug.apk --test flexbox/build/outputs/apk/flexbox-debug-androidTest-unaligned.apk --device-ids hammerhead,flounder,condor_umts --os-version-ids 19,21,23 --locales en,ar_SS --orientations portrait,landscape --results-bucket ${GCLOUD_TEST_BUCKET_LIBRARY} --timeout 180s + post: + - /tmp/google-cloud-sdk/bin/gsutil -m cp -r -U `/tmp/google-cloud-sdk/bin/gsutil ls gs://${GCLOUD_TEST_BUCKET_LIBRARY} | tail -1` $CIRCLE_ARTIFACTS/ | true