Skip to content

Commit

Permalink
fix(android): upload sourcemap
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy committed Aug 27, 2019
1 parent c345293 commit 8d227ab
Show file tree
Hide file tree
Showing 10 changed files with 1,312 additions and 1,254 deletions.
1 change: 0 additions & 1 deletion client/.babelrc
@@ -1,6 +1,5 @@
{
"presets": [
"@babel/preset-env",
"module:metro-react-native-babel-preset"
],
"plugins": [
Expand Down
3 changes: 3 additions & 0 deletions client/.gitignore
Expand Up @@ -42,6 +42,8 @@ DerivedData
project.xcworkspace
*.dSYM.zip
ios/tmp.xcconfig
ios-sourcemap.*
ios/main.jsbundle

# Android/IntelliJ
#
Expand All @@ -52,6 +54,7 @@ local.properties
*.iml
android-sourcemap.*
*.hprof
android/main.jsbundle

# node.js
#
Expand Down
68 changes: 37 additions & 31 deletions client/Makefile
Expand Up @@ -233,7 +233,7 @@ get_iphone_udid:
$(eval IOS_UDID = $(shell if [ -n '$(IOS_UDID)' ]; then echo '--udid=$(IOS_UDID)'; fi))

.PHONY: deps.android
deps.android: deps.lerna $(PWD)/android/app/google-services.json $(PWD)/.environment
deps.android: deps.lerna $(PWD)/android/app/google-services.json $(PWD)/.environment patch.android
$(PWD)/node_modules/.bin/react-native link --platforms=android
./node_modules/.bin/jetify
cd ../core/platform/mobile && make build.android
Expand Down Expand Up @@ -285,16 +285,26 @@ patch.android:
patch node_modules/react-native-network-info/android/build.gradle_topatch -i patch/gradle.patch -o node_modules/react-native-network-info/android/build.gradle; \
fi


.PHONY: build.android
build.android: deps.android
$(RN) run-android --variant=$(ANDROID_VARIANT) --no-packager

.PHONY: debug.android
debug.android: deps.android patch.android config.debug
$(RN) run-android --no-packager
make debug.react-native
debug.android: ANDROID_VARIANT := debug
debug.android: config.debug build.android

.PHONY: release.android
release.android: deps.android config.release
source .environment \
&& export APP_TOKEN="$$INSTABUG_TOKEN" \
&& $(RN) run-android --variant=release --no-packager
release.android: ANDROID_VARIANT := release
release.android: config.release build.android

.PHONY: staff.android
staff.android: ANDROID_VARIANT := staff
staff.android: config.staff build.android

.PHONY: yolo.android
yolo.android: ANDROID_VARIANT := yolo
yolo.android: config.yolo build.android

.PHONY: deps.osx
deps.osx: osx/node_modules/.updated
Expand All @@ -315,53 +325,49 @@ fclean.osx:
rm -rf osx/node_modules
rm -rf osx/Berty.app

.PHONY: debug.ios
debug.ios: deps.ios get_iphone_udid config.debug
make debug.react-native

.PHONY: build.ios
build.ios: deps.ios get_iphone_udid
$(RN) run-ios \
--no-packager \
--configuration=Debug \
--scheme=debug \
--configuration=$(IOS_CONFIGURATION) \
--scheme=$(IOS_SCHEME) \
$(IOS_UDID)

.PHONY: debug.ios
debug.ios: IOS_SCHEME := debug
debug.ios: IOS_CONFIGURATION ?= Debug
debug.ios: config.debug debug.react-native build.ios

.PHONY: test.debug.ios
test.debug.ios: RN = cavy
test.debug.ios: export REACT_APP_ENVIRONMENT = integration_test
test.debug.ios: debug.ios

.PHONY: release.ios
release.ios: deps.ios get_iphone_udid config.release
$(RN) run-ios \
--no-packager \
--configuration=Release \
--scheme=release \
$(IOS_UDID)
release.ios: IOS_SCHEME := release
release.ios: IOS_CONFIGURATION ?= Release
release.ios: config.release build.ios

.PHONY: test.release.ios
test.release.ios: RN = cavy
test.release.ios: export REACT_APP_ENVIRONMENT = integration_test
test.release.ios: release.ios

.PHONY: adhoc.ios
adhoc.ios: deps.ios get_iphone_udid config.staff
$(RN) run-ios \
--no-packager \
--configuration=adhoc \
--scheme=adhoc \
$(IOS_UDID)
adhoc.ios: IOS_SCHEME := adhoc
adhoc.ios: IOS_CONFIGURATION ?= adhoc
adhoc.ios: config.staff build.ios

.PHONY: test.adhoc.ios
test.adhoc.ios: RN = cavy
test.adhoc.ios: export REACT_APP_ENVIRONMENT = integration_test
test.adhoc.ios: adhoc.ios

.PHONY: house.ios
house.ios: deps.ios get_iphone_udid config.yolo
$(RN) run-ios \
--no-packager \
--configuration=house \
--scheme=house \
$(IOS_UDID)
house.ios: IOS_SCHEME := house
house.ios: IOS_CONFIGURATION ?= house
house.ios: config.yolo build.ios

.PHONY: test.house.ios
test.house.ios: RN = cavy
Expand Down
11 changes: 3 additions & 8 deletions client/android/app/build.gradle
Expand Up @@ -9,6 +9,7 @@ project.ext.envConfigFiles = [
staff: ".environment",
]


apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

/**
Expand Down Expand Up @@ -290,12 +291,6 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: 'publish.gradle'
apply plugin: 'com.google.gms.google-services'

task upload_sourcemap(type: Exec) {
environment "INSTABUG_APP_TOKEN", project.env.get("INSTABUG_TOKEN")
commandLine 'sh', './upload_sourcemap.sh'
}


apply from: 'publish.gradle'
apply from: 'upload_sourcemap.gradle'
36 changes: 36 additions & 0 deletions client/android/app/upload_sourcemap.gradle
@@ -0,0 +1,36 @@
/**
* replace upload_sourcemap from instabug
* it was too long because it rebundled react-native
*/
project(':instabug-reactnative') {
tasks.whenTaskAdded { task ->
if (task.name == 'upload_sourcemap') {
task.enabled = false
}
}
}
android.applicationVariants.all { def variant ->
// from ../../node_modules/react-native/react.gradle
def config = project.hasProperty("react") ? project.react : []

def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"

// Create variant and target names
def targetName = variant.name.capitalize()
def targetPath = variant.dirName

// React js bundle directories
def jsSourceMapsDir = file("$buildDir/generated/sourcemaps/react/${targetPath}")
def jsOutputSourceMapFile = file("$jsSourceMapsDir/${bundleAssetName}.map")


variant.assemble.finalizedBy(
tasks.create(name: "upload${targetName}SourceMap", type: Exec) {
dependsOn "bundle${targetName}JsAndAssets"
description "upload source map to reporter"
environment "INSTABUG_APP_TOKEN", project.env.get("INSTABUG_TOKEN")
environment "JS_OUTPUT_SOURCE_MAP_FILE", jsOutputSourceMapFile
commandLine 'sh', './upload_sourcemap.sh'
}
)
}
3 changes: 3 additions & 0 deletions client/android/app/upload_sourcemap.sh
@@ -0,0 +1,3 @@
#!/bin/sh
zip ${JS_OUTPUT_SOURCE_MAP_FILE} ./android-sourcemap.json
curl -X POST 'https://api.instabug.com/api/sdk/v3/symbols_files' -F "symbols_file=@./android-sourcemap.json" -F "application_token=${INSTABUG_APP_TOKEN}" -F "platform=react_native" -F "os=android"
2 changes: 1 addition & 1 deletion client/android/ble/build.gradle
Expand Up @@ -36,7 +36,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation project(':core')
//implementation project(':core')
}

task deleteJar(type: Delete) {
Expand Down
@@ -1,6 +1,6 @@
package libp2p.transport.ble;

import core.GoBridgeImplem;
//////////////////////////////////////////////////////////////////////////////////////////import core.GoBridgeImplem;

import android.app.Activity;
import android.content.BroadcastReceiver;
Expand Down Expand Up @@ -71,7 +71,7 @@ private BleManager() {}
private static final BluetoothGattCharacteristic writerCharacteristic = new BluetoothGattCharacteristic(WRITER_UUID, PROPERTY_WRITE, PERMISSION_WRITE);

// Go bridge interface
static final GoBridge goBridge = new GoBridgeImplem();
static final GoBridge goBridge = null;

public interface GoBridge {
boolean handlePeerFound(String peerID, String multiAddr);
Expand Down
2,434 changes: 1,225 additions & 1,209 deletions client/android/main.jsbundle

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/ios/Berty.xcodeproj/project.pbxproj
Expand Up @@ -603,7 +603,7 @@
};
9556870F82DE361B84770BF2 /* Upload Sourcemap */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 12;
files = (
);
inputFileListPaths = (
Expand All @@ -615,7 +615,7 @@
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 1;
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export INSTABUG_APP_TOKEN=$INSTABUG_TOKEN\nbash \"../node_modules/instabug-reactnative/ios/upload_sourcemap.sh\"\n";
};
Expand Down

0 comments on commit 8d227ab

Please sign in to comment.