Git Product home page Git Product logo

googledatatransport's Introduction

Version License Platform

Actions Status

GoogleDataTransport

This library is for internal Google use only. It allows the logging of data and telemetry from Google SDKs.

Integration Testing

These instructions apply to minor and patch version updates. Major versions need a customized adaptation.

After the CI is green:

  • Determine the next version for release by checking the tagged releases. Ensure that the next release version keeps the Swift PM and CocoaPods versions in sync.
  • Verify that the releasing version is the latest entry in the CHANGELOG.md, updating it if necessary.
  • Update the version in the podspec to match the latest entry in the CHANGELOG.md
  • Checkout the main branch and ensure it is up to date.
    git checkout main
    git pull
  • Add the CocoaPods tag ({version} will be the latest version in the podspec)
    git tag CocoaPods-{version}
    git push origin CocoaPods-{version}
  • Push the podspec to the designated repo
    • If this version of GDT is intended to launch before or with the next Firebase release:

      Push to SpecsStaging
      pod repo push --skip-tests staging GoogleDataTransport.podspec

      If the command fails with Unable to find the 'staging' repo., add the staging repo with:

      pod repo add staging [email protected]:firebase/SpecsStaging.git
    • Otherwise:

      Push to SpecsDev
      pod repo push --skip-tests dev GoogleDataTransport.podspec

      If the command fails with Unable to find the 'dev' repo., add the dev repo with:

      pod repo add dev [email protected]:firebase/SpecsDev.git
  • Run Firebase CI by waiting until next nightly or adding a PR that touches Gemfile.
  • On google3, create a workspace and new CL. Then copybara and run a global TAP.
    /google/data/ro/teams/copybara/copybara third_party/firebase/ios/Releases/GoogleDataTransport/copy.bara.sky \
    --piper-description-behavior=OVERWRITE \
    --destination-cl=YOUR_CL gdt
    

Publishing

The release process is as follows:

  1. Tag and release for Swift PM
  2. Publish to CocoaPods
  3. Create GitHub Release
  4. Perform post release cleanup

Swift Package Manager

By creating and pushing a tag for Swift PM, the newly tagged version will be immediately released for public use. Given this, please verify the intended time of release for Swift PM.

  • Add a version tag for Swift PM
git tag {version}
git push origin {version}

Note: Ensure that any inflight PRs that depend on the new GoogleDataTransport version are updated to point to the newly tagged version rather than a checksum.

CocoaPods

  • Publish the newly versioned pod to CocoaPods

    It's recommended to point to the GoogleDataTransport.podspec in staging to make sure the correct spec is being published.

    [!WARNING] Manually update your local SpecsStaging clone or run pod repo update before proceeding.

    pod trunk push ~/.cocoapods/repos/staging/GoogleDataTransport/{version}/GoogleDataTransport.podspec --skip-tests

    The pod push was successful if the above command logs: 🚀 GoogleDataTransport ({version}) successfully published. In addition, a new commit that publishes the new version (co-authored by CocoaPodsAtGoogle) should appear in the CocoaPods specs repo. Last, the latest version should be displayed on GoogleDataTransport's CocoaPods page.

Update the release template's Tag version and Release title fields with the latest version. In addition, reference the Release Notes in the release's description.

See this release for an example.

Don't forget to perform the post release cleanup!

Post Release Cleanup

Clean up SpecsStaging
pwd=$(pwd)
mkdir -p /tmp/release-cleanup && cd $_
git clone [email protected]:firebase/SpecsStaging.git
cd SpecsStaging/
git rm -rf GoogleDataTransport/
git commit -m "Post publish cleanup"
git push origin master
rm -rf /tmp/release-cleanup
cd $pwd

Set logging level

Swift

  • Import GoogleDataTransport module:
    import GoogleDataTransport
  • Set logging level global variable to the desired value before calling FirebaseApp.configure():
    GDTCORConsoleLoggerLoggingLevel = GDTCORLoggingLevel.debug.rawValue

Objective-C

  • Import GoogleDataTransport:
    #import <GoogleDataTransport/GoogleDataTransport.h>
  • Set logging level global variable to the desired value before calling -[FIRApp configure]:
    GDTCORConsoleLoggerLoggingLevel = GDTCORLoggingLevelDebug;

Prereqs

  • gem install --user cocoapods cocoapods-generate
  • brew install protobuf nanopb-generator
  • easy_install --user protobuf

To develop

  • Run ./GoogleDataTransport/generate_project.sh after installing the prereqs

When adding new logging endpoint

  • Use commands similar to:
    • python -c "line='https://www.firebase.com'; print line[0::2]"
    • python -c "line='https://www.firebase.com'; print line[1::2]"

When adding internal code that shouldn't be easily usable on github

  • Consider using go/copybara-library/scrubbing#cc_scrub

Development

Ensure that you have at least the following software:

For the pod that you want to develop:

pod gen GoogleDataTransport.podspec --local-sources=./ --auto-open --platforms=ios

Note: If the CocoaPods cache is out of date, you may need to run pod repo update before the pod gen command.

Note: Set the --platforms option to macos or tvos to develop/test for those platforms. Since 10.2, Xcode does not properly handle multi-platform CocoaPods workspaces.

Development for Catalyst

  • pod gen GoogleDataTransport.podspec --local-sources=./ --auto-open --platforms=ios
  • Check the Mac box in the App-iOS Build Settings
  • Sign the App in the Settings Signing & Capabilities tab
  • Click Pods in the Project Manager
  • Add Signing to the iOS host app and unit test targets
  • Select the Unit-unit scheme
  • Run it to build and test

Alternatively disable signing in each target:

  • Go to Build Settings tab
  • Click +
  • Select Add User-Defined Setting
  • Add CODE_SIGNING_REQUIRED setting with a value of NO

Code Formatting

To ensure that the code is formatted consistently, run the script ./scripts/check.sh before creating a PR.

GitHub Actions will verify that any code changes are done in a style compliant way. Install clang-format and mint:

brew install clang-format@17
brew install mint

Running Unit Tests

Select a scheme and press Command-u to build a component and run its unit tests.

Contributing

See Contributing for more information on contributing to the Firebase iOS SDK.

License

The contents of this repository is licensed under the Apache License, version 2.0.

googledatatransport's People

Contributors

andrewheard avatar bhaktipriya avatar bjhomer avatar charlotteliang avatar ddnan avatar dependabot[bot] avatar dmaclach avatar granluo avatar itslazyvar avatar jasonhu-g avatar jeremyjiang-dev avatar maksymmalyhin avatar mikehaney24 avatar mikelehen avatar morganchen12 avatar ncooke3 avatar paulb777 avatar pranavrajgopal avatar ryanwilson avatar samedson avatar tejasd avatar ulukaya avatar vimanyu avatar visumickey avatar wilhuff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

googledatatransport's Issues

Thread Sanitizer Data race in [GDTCCTUploadOperation finishOperation]

I've just ran my code trough Thread Sanitizer and got report for data race in GDTCCTUploadOperation

We use the following Pods

  pod 'Firebase/Core'
  pod 'Firebase/Performance'
  pod 'Firebase/Messaging'
  pod 'Firebase/Analytics'
  pod 'Firebase/Crashlytics'

Already updated to latest versions:

Installing Firebase 7.9.0 (was 7.8.1)
Installing FirebaseABTesting 7.9.0 (was 7.8.0)
Installing FirebaseAnalytics 7.9.0 (was 7.8.1)
Installing FirebaseCore 7.9.0 (was 7.8.0)
Installing FirebaseCoreDiagnostics 7.9.0 (was 7.8.0)
Installing FirebaseCrashlytics 7.9.0 (was 7.8.0)
Installing FirebaseInstallations 7.9.0 (was 7.8.0)
Installing FirebaseInstanceID 7.9.0 (was 7.8.0)
Installing FirebaseMessaging 7.9.0 (was 7.8.0)
Installing FirebasePerformance 7.9.0 (was 7.8.0)
Installing FirebaseRemoteConfig 7.9.0 (was 7.8.0)
Installing GoogleAppMeasurement 7.9.0 (was 7.8.1)

In code we have custom Crashlytics logs and custom analytics event and screen tracking.
The project uses Swift + SwiftUI and targets iOS 14.
The issue has been detected on iOS 14 Simulator.

Console output:

WARNING: ThreadSanitizer: data race (pid=72528)
  Write of size 1 at 0x7b44000901f9 by thread T18:
    #0 -[GDTCCTUploadOperation finishOperation] GDTCCTUploadOperation.m:508 (GoogleDataTransport:x86_64+0x11821)
    #1 __53-[GDTCCTUploadOperation uploadTarget:withConditions:]_block_invoke.72 GDTCCTUploadOperation.m:184 (GoogleDataTransport:x86_64+0xccdf)
    #2 __44-[FBLPromise(CatchAdditions) onQueue:catch:]_block_invoke FBLPromise+Catch.m:34 (FBLPromises:x86_64+0xbf1e)
    #3 __56-[FBLPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.68 FBLPromise.m:277 (FBLPromises:x86_64+0x2378f)
    #4 __44-[FBLPromise observeOnQueue:fulfill:reject:]_block_invoke_2 FBLPromise.m:229 (FBLPromises:x86_64+0x22738)
    #5 __wrap_dispatch_group_async_block_invoke <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x71c37)
    #6 _dispatch_client_callout <null>:2 (libdispatch.dylib:x86_64+0x39c7)

  Previous read of size 1 at 0x7b44000901f9 by thread T16:
    #0 -[GDTCCTUploadOperation isFinished] GDTCCTUploadOperation.m:489 (GoogleDataTransport:x86_64+0x11cec)
    #1 __NSOQSchedule_f <null>:2 (Foundation:x86_64+0xddcee)
    #2 _dispatch_client_callout <null>:2 (libdispatch.dylib:x86_64+0x39c7)

  Location is heap block of size 320 at 0x7b4400090100 allocated by thread T16:
    #0 calloc <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x4f072)
    #1 _objc_rootAllocWithZone <null>:2 (libobjc.A.dylib:x86_64+0x16a99)
    #2 __52-[GDTCORUploadCoordinator uploadTargets:conditions:]_block_invoke GDTCORUploadCoordinator.m:112 (GoogleDataTransport:x86_64+0x4352b)
    #3 __tsan::invoke_and_release_block(void*) <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x70ebb)
    #4 _dispatch_client_callout <null>:2 (libdispatch.dylib:x86_64+0x39c7)

  Thread T18 (tid=3005412, running) is a GCD worker thread

  Thread T16 (tid=3004697, running) is a GCD worker thread

SUMMARY: ThreadSanitizer: data race GDTCCTUploadOperation.m:508 in -[GDTCCTUploadOperation finishOperation]

Screenshots:
Screen Shot 2021-03-27 at 9 54 05
Screen Shot 2021-03-27 at 9 54 20
Screen Shot 2021-03-27 at 9 54 28
Screen Shot 2021-03-27 at 9 54 37

Rename `transform:` API due to App Store Rejections

Originally reported in firebase/firebase-ios-sdk#7177

The existing transform: public API can lead to false-positives regarding private API usage in the App Store. We should rename it to avoid this, likely adding a prefix, renaming to transformGDTEvent:, or something similar.

This is a breaking change, so all dependencies need to be updated as well.

Build Failed

I'm developing a React Native app and when I run react-native run-ios I receive this error related with GoogleDataTransport:

The following build commands failed:
CompileC /Users/fair/Library/Developer/Xcode/DerivedData/FairMobile-bqgeuszvlfcgenemmqawwkroifuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/GoogleDataTransport.build/Objects-normal/x86_64/GDTCCTUploadOperation.o /Users/fair/Documents/fair-mobile-react-native/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/GDTCCTUploadOperation.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

How can I proceed?

Crash on GDTCCTUploader.m

Hi,

we are using latest Firebase, that is using latest GoogleDataTransport (9.0.1). We found crash in crashlytics today:

Crashed: com.google.GDTCORUploadCoordinator
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x7000000010cf7047
-[GDTCCTUploader uploadTarget:withConditions:]


Crashed: com.google.GDTCORUploadCoordinator
0  Foundation                     0x181e90f5c ____addOperations_block_invoke.621 + 228
1  Foundation                     0x181e8fb7c __addOperations + 1272
2  Bibino                         0x10086d814 -[GDTCCTUploader uploadTarget:withConditions:] + 121 (GDTCCTUploader.m:121)
3  Bibino                         0x10087d050 __52-[GDTCORUploadCoordinator uploadTargets:conditions:]_block_invoke + 113 (GDTCORUploadCoordinator.m:113)
4  libdispatch.dylib              0x180d58aa0 _dispatch_call_block_and_release + 24
5  libdispatch.dylib              0x180d58a60 _dispatch_client_callout + 16
6  libdispatch.dylib              0x180d629b4 _dispatch_queue_serial_drain$VARIANT$mp + 608
7  libdispatch.dylib              0x180d632fc _dispatch_queue_invoke$VARIANT$mp + 336
8  libdispatch.dylib              0x180d63cc8 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 340
9  libdispatch.dylib              0x180d6c098 _dispatch_workloop_worker_thread$VARIANT$mp + 668
10 libsystem_pthread.dylib        0x18108be70 _pthread_wqthread + 860
11 libsystem_pthread.dylib        0x18108bb08 start_wqthread + 4

Bazel/Blaze BUILD

Hey Googlers!

Any chance you'd be down to release the Blaze/Bazel (Blazel!) BUILD files for this code? Would be handy to those of use building with Bazel.

Two of the external dependencies have done so already (nanopb and PromisesObjC), and I'd asked GoogleUtilities if they'd do the same in google/GoogleUtilities#72

If useful, here's one I spun up for my own quick use.

# Created from https://github.com/google/GoogleDataTransport/blob/1a65c30db4fc841e06586441682c2dda036d9db3/GoogleDataTransport.podspec

objc_library(
    name = "GoogleDataTransport",
    hdrs = glob(["GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/*.h"]),
    visibility = ["//visibility:public"],

    srcs = glob(["GoogleDataTransport/GDTCORLibrary/**/*", "GoogleDataTransport/GDTCCTLibrary/**/*"]),
    deps = [
        "@GooglePromises//:FBLPromises",
        "@GoogleUtilities//:Environment",
        "@GoogleUtilities//:Logger",
        "@nanopb//:nanopb",
    ],
    sdk_frameworks = [
        "CoreTelephony",
        "SystemConfiguration",
    ],
    sdk_dylibs = ["libz"],
)

Thanks for your consideration!
Chris
(ex-Googler)

P.S. To load nanopb, you'll need a patch file to enable malloc. To save time, here's one that works for the latest commit (2210cd92a6237a9ff82b58cfbe0c58da25ce1e11) that supports the compiled protos you're embedding

--- pb.h
+++ pb.h
@@ -13,2 +13,2 @@
 /* Enable support for dynamically allocated fields */
-/* #define PB_ENABLE_MALLOC 1 */
+#define PB_ENABLE_MALLOC 1

--- BUILD
+++ BUILD
@@ -7,2 +7,3 @@
 cc_library(
   name = "nanopb",
+  include_prefix = "nanopb",

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.