From ab2f8e124d1304d46d6226b8143b1c63f8cd88cd Mon Sep 17 00:00:00 2001 From: Frieder Bluemle Date: Thu, 12 Jan 2023 19:45:15 -0800 Subject: [PATCH] Patch container sources for androidx migration --- .github/workflows/ci.yml | 2 +- android/moviesreloaded/ern.gradle | 62 ++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4477845..7cc2b1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: path: electrode-native - working-directory: electrode-native/ run: node setup-dev.js - - run: ern platform use 0.49.2 + - run: ern platform use 1000.0.0 - run: yarn --frozen-lockfile - working-directory: android/ run: ./gradlew createAndPublishErnDevContainer diff --git a/android/moviesreloaded/ern.gradle b/android/moviesreloaded/ern.gradle index fe2208f..2f4cb2a 100644 --- a/android/moviesreloaded/ern.gradle +++ b/android/moviesreloaded/ern.gradle @@ -15,14 +15,74 @@ task copyApiImplSrc(type: Copy) { into "$CONTAINER_PATH/lib/src/main/java/com/ern/api/impl" } +// Patch container sources for in-progress androidx migration (Jan 2022) - Remove later + +task patchApiSrc(type: Copy) { + from "$CONTAINER_PATH/lib/src/main/java/com/ernnavigationApi/ern" + into "$buildDir/tmp/patched-api" + filter { line -> line.replaceAll('android\\.support', 'androidx') } + filter { line -> line.replaceAll('ernnavigationApi', 'ernnavigation') } +} +task deleteApiSrc(type: Delete) { + delete "$CONTAINER_PATH/lib/src/main/java/com/ernnavigationApi" +} +task replaceApiSrc(type: Copy) { + from "$buildDir/tmp/patched-api" + into "$CONTAINER_PATH/lib/src/main/java/com/ernnavigation/ern" +} + +task patchBridgeSrc(type: Copy) { + from "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/electrode/reactnative/bridge" + into "$buildDir/tmp/patched-bridge" + filter { line -> line.replaceAll('android\\.support', 'androidx') } +} +task deleteBridgeSrc(type: Delete) { + delete "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/electrode/reactnative/bridge" +} +task replaceBridgeSrc(type: Copy) { + from "$buildDir/tmp/patched-bridge" + into "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/electrode/reactnative/bridge" +} + +task patchPluginsSrc(type: Copy) { + from "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/ern/container/plugins" + into "$buildDir/tmp/patched-plugins" + filter { line -> line.replaceAll('android\\.support', 'androidx') } +} +task deletePluginsSrc(type: Delete) { + delete "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/ern/container/plugins" +} +task replacePluginsSrc(type: Copy) { + from "$buildDir/tmp/patched-plugins" + into "$CONTAINER_PATH/lib/src/main/java/com/walmartlabs/ern/container/plugins" +} + task patchContainer { dependsOn deleteApiImplSrc dependsOn copyApiImplSrc + dependsOn patchApiSrc + dependsOn deleteApiSrc + dependsOn replaceApiSrc + dependsOn patchBridgeSrc + dependsOn deleteBridgeSrc + dependsOn replaceBridgeSrc + dependsOn patchPluginsSrc + dependsOn deletePluginsSrc + dependsOn replacePluginsSrc tasks.findByName('copyApiImplSrc').mustRunAfter 'deleteApiImplSrc' + tasks.findByName('patchApiSrc').mustRunAfter 'copyApiImplSrc' + tasks.findByName('deleteApiSrc').mustRunAfter 'patchApiSrc' + tasks.findByName('replaceApiSrc').mustRunAfter 'deleteApiSrc' + tasks.findByName('patchBridgeSrc').mustRunAfter 'replaceApiSrc' + tasks.findByName('deleteBridgeSrc').mustRunAfter 'patchBridgeSrc' + tasks.findByName('replaceBridgeSrc').mustRunAfter 'deleteBridgeSrc' + tasks.findByName('patchPluginsSrc').mustRunAfter 'replaceBridgeSrc' + tasks.findByName('deletePluginsSrc').mustRunAfter 'patchPluginsSrc' + tasks.findByName('replacePluginsSrc').mustRunAfter 'deletePluginsSrc' } task publishErnContainer(type: Exec) { - commandLine "ern", "publish-container", "-p", "ern-container-publisher-maven@1.0.5", "-u", "file://$HOMEDIR/.m2/repository", "--platform", "android", "-e", '{"artifactId":"container-movies-reloaded","groupId":"com.walmartlabs.ern"}' + commandLine "ern", "publish-container", "-p", "maven", "-u", "file://$HOMEDIR/.m2/repository", "--platform", "android", "-e", '{"artifactId":"container-movies-reloaded","groupId":"com.walmartlabs.ern"}' } task createAndPublishErnDevContainer() {