publish/scripts/installer.js
/**
 * Create the Android Gradle for installing the Firebase Android dependencies and service dependencies
 *
 * @param {any} result The answers to the micro-service prompts
 */
Create the Android Gradle for installing the Firebase Android dependencies and service dependencies
@param {any} result The answers to the micro-service prompts
Create the Android Gradle for installing the Firebase Android dependencies and service dependencies @param { any } result The answers to the micro - service prompts
function writeGradleFile(result) {
  if (!fs.existsSync(directories.android)) {
    fs.mkdirSync(directories.android);
  }
  try {
    fs.writeFileSync(directories.android + '/include.gradle',
        `
android {
    productFlavors {
        "fireb" {
            dimension "fireb"
        }
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
    jcenter()
}
def supportVersion = project.hasProperty("supportVersion") ? project.supportVersion : "26.1.0"
def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : "16.0.1"
if (googlePlayServicesVersion != '+' && VersionNumber.parse(googlePlayServicesVersion) < VersionNumber.parse('15.0.+')) {
    throw new GradleException(" googlePlayServicesVersion set too low, please update to at least 15.0.0 / 15.0.+ (currently set to $googlePlayServicesVersion)");
}
dependencies {
    compile "com.android.support:appcompat-v7:$supportVersion"
    compile "com.android.support:cardview-v7:$supportVersion"
    compile "com.android.support:customtabs:$supportVersion"
    compile "com.android.support:design:$supportVersion"
    compile "com.android.support:support-compat:$supportVersion"
    // make sure you have these versions by updating your local Android SDK's (Android Support repo and Google repo)
    compile "com.google.firebase:firebase-core:16.0.4"
    // for reading google-services.json and configuration
    compile "com.google.android.gms:play-services-base:$googlePlayServicesVersion"
    // Authentication
    ` + (!externalPushClientOnly && (!isPresent(result.authentication) || isSelected(result.authentication)) ? `` : `//`) + ` compile "com.google.firebase:firebase-auth:16.0.5"
    // Realtime DB
    ` + (!externalPushClientOnly && (!isPresent(result.realtimedb) || isSelected(result.realtimedb)) ? `` : `//`) + ` compile "com.google.firebase:firebase-database:16.0.4"
    // Cloud Firestore
    ` + (isSelected(result.firestore) ? `` : `//`) + ` compile "com.google.firebase:firebase-firestore:17.1.2"
    // Remote Config
    ` + (isSelected(result.remote_config) ? `` : `//`) + ` compile "com.google.firebase:firebase-config:16.1.0"
    // Performance Monitoring
    ` + (isSelected(result.performance_monitoring) ? `` : `//`) + ` compile "com.google.firebase:firebase-perf:16.2.0"
    // Crash Reporting
    ` + (isSelected(result.crash_reporting) && !isSelected(result.crashlytics) ? `` : `//`) + ` compile "com.google.firebase:firebase-crash:16.2.1"
    // Crashlytics
    ` + (isSelected(result.crashlytics) ? `` : `//`) + ` compile "com.crashlytics.sdk.android:crashlytics:2.9.6"
    // Firebase Cloud Messaging (FCM)
    ` + (isSelected(result.messaging) || externalPushClientOnly ? `` : `//`) + ` compile "com.google.firebase:firebase-messaging:17.3.4"
    // Cloud Storage
    ` + (isSelected(result.storage) ? `` : `//`) + ` compile "com.google.firebase:firebase-storage:16.0.3"
    // Cloud Functions
    ` + (isSelected(result.functions) ? `` : `//`) + ` compile "com.google.firebase:firebase-functions:16.1.2"
    // AdMob / Ads
    ` + (isSelected(result.admob) ? `` : `//`) + ` compile "com.google.firebase:firebase-ads:17.0.0"
    // ML Kit
    ` + (isSelected(result.ml_kit) ? `` : `//`) + ` compile "com.google.firebase:firebase-ml-vision:18.0.1"
    ` + (isSelected(result.ml_kit_image_labeling) ? `` : `//`) + ` compile "com.google.firebase:firebase-ml-vision-image-label-model:17.0.2"
    // Facebook Authentication
    ` + (isSelected(result.facebook_auth) ? `` : `//`) + ` compile ("com.facebook.android:facebook-android-sdk:4.35.0"){ exclude group: 'com.google.zxing' }
    // Google Sign-In Authentication
    ` + (isSelected(result.google_auth) ? `` : `//`) + ` compile "com.google.android.gms:play-services-auth:16.0.0"
    // Firebase Invites
    ` + (isSelected(result.invites) ? `` : `//`) + ` compile "com.google.firebase:firebase-invites:16.0.4"
    // Firebase Dynamic Links
    ` + (isSelected(result.dynamic_links) ? `` : `//`) + ` compile "com.google.firebase:firebase-dynamic-links:16.1.2" // BEWARE: 16.1.2 is fine, but 16.1.3 results in a build error
}
apply plugin: "com.google.gms.google-services"
// Crashlytics
` + (isSelected(result.crashlytics) ? `` : `//`) + `apply plugin: "io.fabric"
`);
    console.log('Successfully created Android (include.gradle) file.');
  } catch (e) {
    console.log('Failed to create Android (include.gradle) file.');
    console.log(e);
  }
}
function writeGradleFile ( result ) { if ( ! fs . existsSync ( directories . android ) ) { fs . mkdirSync ( directories . android ) ; } try { fs . writeFileSync ( directories . android + '/include.gradle' , ` ` + ( ! externalPushClientOnly && ( ! isPresent ( result . authentication ) || isSelected ( result . authentication ) ) ? ` ` : ` ` ) + ` ` + ( ! externalPushClientOnly && ( ! isPresent ( result . realtimedb ) || isSelected ( result . realtimedb ) ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . firestore ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . remote_config ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . performance_monitoring ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . crash_reporting ) && ! isSelected ( result . crashlytics ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . crashlytics ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . messaging ) || externalPushClientOnly ? ` ` : ` ` ) + ` ` + ( isSelected ( result . storage ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . functions ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . admob ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . ml_kit ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . ml_kit_image_labeling ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . facebook_auth ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . google_auth ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . invites ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . dynamic_links ) ? ` ` : ` ` ) + ` ` + ( isSelected ( result . crashlytics ) ? ` ` : ` ` ) + ` ` ) ; console . log ( 'Successfully created Android (include.gradle) file.' ) ; } catch ( e ) { console . log ( 'Failed to create Android (include.gradle) file.' ) ; console . log ( e ) ; } }
Create the Android Gradle for installing the Firebase Android dependencies and service dependencies
 @param {any} result The answers to the micro-service prompts
Create the Android Gradle for installing the Firebase Android dependencies and service dependencies @param { any } result The answers to the micro - service prompts