From a8394b5e198d8a3b3e3696175557aa61b706246a Mon Sep 17 00:00:00 2001 From: diegolmello Date: Fri, 2 Aug 2019 11:59:29 -0300 Subject: [PATCH] Android build --- .circleci/config.yml | 23 ++++++++++-------- android/app/BUCK | 18 +++----------- android/app/src/main/AndroidManifest.xml | 1 - android/build.gradle | 31 +++++++++++++----------- android/gradle.properties | 2 +- metro.config.js | 3 ++- yarn.lock | 19 ++++++++++++++- 7 files changed, 55 insertions(+), 42 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e1745caa..964b2a896 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,30 +102,32 @@ jobs: android-build: <<: *defaults docker: - - image: circleci/android:api-28-node + - image: circleci/android:api-29-node environment: # GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError" - GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false - JVM_OPTS: -Xmx4096m + # GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false + # JVM_OPTS: -Xmx4096m + JAVA_OPTS: '-Xms512m -Xmx2g' + GRADLE_OPTS: '-Xmx3g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"' TERM: dumb BASH_ENV: "~/.nvm/nvm.sh" steps: - checkout - - restore_cache: - name: Restore NPM cache - key: node-modules-{{ checksum "yarn.lock" }} + # - restore_cache: + # name: Restore NPM cache + # key: node-modules-{{ checksum "yarn.lock" }} - run: name: Install NPM modules command: | yarn - - restore_cache: - name: Restore gradle cache - key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }} + # - restore_cache: + # name: Restore gradle cache + # key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }} - run: name: Configure Gradle @@ -133,7 +135,7 @@ jobs: cd android echo -e "" > ./gradle.properties - echo -e "android.enableAapt2=false" >> ./gradle.properties + # echo -e "android.enableAapt2=false" >> ./gradle.properties if [[ $KEYSTORE ]]; then echo $KEYSTORE_BASE64 | base64 --decode > ./app/$KEYSTORE @@ -154,6 +156,7 @@ jobs: - run: name: Build Android App command: | + npx jetify cd android if [[ $KEYSTORE ]]; then ./gradlew bundleRelease diff --git a/android/app/BUCK b/android/app/BUCK index a6395be89..88155d119 100644 --- a/android/app/BUCK +++ b/android/app/BUCK @@ -8,23 +8,13 @@ # - `buck install -r android/app` - compile, install and run application # +load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") + lib_deps = [] -for jarfile in glob(['libs/*.jar']): - name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] - lib_deps.append(':' + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) +create_aar_targets(glob(["libs/*.aar"])) -for aarfile in glob(['libs/*.aar']): - name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] - lib_deps.append(':' + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) +create_jar_targets(glob(["libs/*.jar"])) android_library( name = "all-libs", diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d2bbb1cdf..df3179623 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -17,7 +17,6 @@ android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme" - tools:replace="android:appComponentFactory" > - afterEvaluate { - if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { - android { - compileSdkVersion 28 - buildToolsVersion "28.0.3" - defaultConfig { - targetSdkVersion 28 - } - } - } - } -} \ No newline at end of file +// subprojects { subproject -> +// afterEvaluate { +// if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { +// android { +// compileSdkVersion 28 +// buildToolsVersion "28.0.3" +// defaultConfig { +// targetSdkVersion 28 +// } +// } +// } +// } +// } \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties index f62703c85..bf40c6de3 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -16,7 +16,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -android.enableAapt2=false # commenting this makes notifications to stop working +# android.enableAapt2=false # commenting this makes notifications to stop working # android.useDeprecatedNdk=true android.useAndroidX=true android.enableJetifier=true diff --git a/metro.config.js b/metro.config.js index ef78bfccb..3c8cf1489 100644 --- a/metro.config.js +++ b/metro.config.js @@ -13,5 +13,6 @@ module.exports = { inlineRequires: true } }) - } + }, + maxWorkers: 2 }; diff --git a/yarn.lock b/yarn.lock index 154e213d4..1bd1afd03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3688,6 +3688,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +base-64@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" + integrity sha1-eAqZyE59YAJgNhURxId2E78k9rs= + base64-js@^1.0.2, base64-js@^1.1.2, base64-js@^1.2.3: version "1.3.0" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" @@ -6787,6 +6792,18 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= +glob@7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.6.tgz#211bafaf49e525b8cd93260d14ab136152b3f57a" + integrity sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo= + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -9917,7 +9934,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -"minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.3, minimatch@^3.0.4: +"minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==