Skip to content

Commit

Permalink
Patch container sources for androidx migration
Browse files Browse the repository at this point in the history
  • Loading branch information
friederbluemle authored and rthic23 committed Jan 13, 2023
1 parent 9f4238a commit ab2f8e1
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 61 additions & 1 deletion android/moviesreloaded/ern.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit ab2f8e1

Please sign in to comment.