"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-5187/android/sdk/build.gradle" (2 Aug 2021, 9018 Bytes) of package /linux/misc/jitsi-meet-5187.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Java source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "build.gradle": 5186_vs_5187.

    1 apply plugin: 'com.android.library'
    2 apply plugin: 'maven-publish'
    3 
    4 android {
    5     compileSdkVersion rootProject.ext.compileSdkVersion
    6 
    7     defaultConfig {
    8         minSdkVersion rootProject.ext.minSdkVersion
    9         targetSdkVersion rootProject.ext.targetSdkVersion
   10     }
   11 
   12     buildTypes {
   13         debug {
   14             buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
   15             buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${rootProject.ext.googleServicesEnabled}"
   16         }
   17         release {
   18             minifyEnabled false
   19             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
   20             buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
   21             buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${rootProject.ext.googleServicesEnabled}"
   22         }
   23     }
   24 
   25     sourceSets {
   26         main {
   27             java {
   28                 exclude "test/"
   29             }
   30         }
   31     }
   32 }
   33 
   34 dependencies {
   35     implementation fileTree(dir: 'libs', include: ['*.jar'])
   36 
   37     implementation 'androidx.appcompat:appcompat:1.2.0'
   38     implementation 'androidx.fragment:fragment:1.2.5'
   39     implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
   40     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
   41 
   42     //noinspection GradleDynamicVersion
   43     api 'com.facebook.react:react-native:+'
   44     //noinspection GradleDynamicVersion
   45     implementation 'org.webkit:android-jsc:+'
   46 
   47     implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
   48     implementation 'com.jakewharton.timber:timber:4.7.1'
   49     implementation 'com.squareup.duktape:duktape-android:1.3.0'
   50     implementation 'com.google.code.gson:gson:2.8.6'
   51 
   52     if (rootProject.ext.libreBuild) {
   53         implementation(project(':react-native-device-info')) {
   54             exclude group: 'com.google.firebase'
   55             exclude group: 'com.google.android.gms'
   56             exclude group: 'com.android.installreferrer'
   57         }
   58     } else {
   59         implementation project(':react-native-device-info')
   60         implementation(project(":react-native-google-signin")) {
   61             exclude group: 'com.google.android.gms'
   62             exclude group: 'androidx'
   63         }
   64     }
   65 
   66     implementation project(':react-native-async-storage')
   67     implementation project(':react-native-background-timer')
   68     implementation project(':react-native-calendar-events')
   69     implementation project(':react-native-community_netinfo')
   70     implementation project(':react-native-default-preference')
   71     implementation project(':react-native-immersive')
   72     implementation project(':react-native-keep-awake')
   73     implementation project(':react-native-slider')
   74     implementation project(':react-native-sound')
   75     implementation project(':react-native-splash-screen')
   76     implementation project(':react-native-svg')
   77     implementation project(':react-native-video')
   78     implementation project(':react-native-webrtc')
   79     implementation project(':react-native-webview')
   80 
   81     testImplementation 'junit:junit:4.12'
   82 }
   83 
   84 
   85 // Here we bundle all assets, resources and React files. We cannot use the
   86 // react.gradle file provided by react-native because it's designed to be used
   87 // in an application (it taps into applicationVariants, but the SDK is a library
   88 // so we need libraryVariants instead).
   89 android.libraryVariants.all { def variant ->
   90     // Create variant and target names
   91     def targetName = variant.name.capitalize()
   92     def targetPath = variant.dirName
   93 
   94     // React js bundle directories
   95     def jsBundleDir = file("$buildDir/generated/assets/react/${targetPath}")
   96     def resourcesDir = file("$buildDir/generated/res/react/${targetPath}")
   97 
   98     def jsBundleFile = file("$jsBundleDir/index.android.bundle")
   99 
  100     def currentBundleTask = tasks.create(
  101             name: "bundle${targetName}JsAndAssets",
  102             type: Exec) {
  103         group = "react"
  104         description = "bundle JS and assets for ${targetName}."
  105 
  106         // Create dirs if they are not there (e.g. the "clean" task just ran)
  107         doFirst {
  108             jsBundleDir.deleteDir()
  109             jsBundleDir.mkdirs()
  110             resourcesDir.deleteDir()
  111             resourcesDir.mkdirs()
  112         }
  113 
  114         // Set up inputs and outputs so gradle can cache the result
  115         def reactRoot = file("${projectDir}/../../")
  116         inputs.files fileTree(dir: reactRoot, excludes: ["android/**", "ios/**"])
  117         outputs.dir jsBundleDir
  118         outputs.dir resourcesDir
  119 
  120         // Set up the call to the react-native cli
  121         workingDir reactRoot
  122 
  123         // Set up dev mode
  124         def devEnabled = !targetName.toLowerCase().contains("release")
  125 
  126         // Run the bundler
  127         commandLine(
  128                 "node",
  129                 "node_modules/react-native/local-cli/cli.js",
  130                 "bundle",
  131                 "--platform", "android",
  132                 "--dev", "${devEnabled}",
  133                 "--reset-cache",
  134                 "--entry-file", "index.android.js",
  135                 "--bundle-output", jsBundleFile,
  136                 "--assets-dest", resourcesDir)
  137 
  138         // Disable bundling on dev builds
  139         enabled !devEnabled
  140     }
  141 
  142     currentBundleTask.ext.generatedResFolders = files(resourcesDir).builtBy(currentBundleTask)
  143     currentBundleTask.ext.generatedAssetsFolders = files(jsBundleDir).builtBy(currentBundleTask)
  144     variant.registerGeneratedResFolders(currentBundleTask.generatedResFolders)
  145 
  146     def mergeAssetsTask = variant.mergeAssetsProvider.get()
  147     def mergeResourcesTask = variant.mergeResourcesProvider.get()
  148 
  149     mergeAssetsTask.dependsOn(currentBundleTask)
  150     mergeResourcesTask.dependsOn(currentBundleTask)
  151 
  152     mergeAssetsTask.doLast {
  153         def assetsDir = mergeAssetsTask.outputDir.get()
  154 
  155         // Bundle sounds
  156         //
  157         copy {
  158             from("${projectDir}/../../sounds/incomingMessage.wav")
  159             from("${projectDir}/../../sounds/joined.wav")
  160             from("${projectDir}/../../sounds/left.wav")
  161             from("${projectDir}/../../sounds/liveStreamingOn.mp3")
  162             from("${projectDir}/../../sounds/liveStreamingOff.mp3")
  163             from("${projectDir}/../../sounds/outgoingRinging.wav")
  164             from("${projectDir}/../../sounds/outgoingStart.wav")
  165             from("${projectDir}/../../sounds/recordingOn.mp3")
  166             from("${projectDir}/../../sounds/recordingOff.mp3")
  167             from("${projectDir}/../../sounds/rejected.wav")
  168             into("${assetsDir}/sounds")
  169         }
  170 
  171         // Copy React assets
  172         //
  173         if (currentBundleTask.enabled) {
  174             copy {
  175                 from(jsBundleFile)
  176                 into(assetsDir)
  177             }
  178         }
  179     }
  180 
  181     mergeResourcesTask.doLast {
  182         // Copy React resources
  183         //
  184         if (currentBundleTask.enabled) {
  185             copy {
  186                 from(resourcesDir)
  187                 into(mergeResourcesTask.outputDir.get())
  188             }
  189         }
  190     }
  191 }
  192 
  193 
  194 publishing {
  195     publications {
  196         aarArchive(MavenPublication) {
  197             groupId 'org.jitsi.react'
  198             artifactId 'jitsi-meet-sdk'
  199             version System.env.OVERRIDE_SDK_VERSION ?: project.sdkVersion
  200 
  201             artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  202                 extension "aar"
  203             }
  204             pom.withXml {
  205                 def pomXml = asNode()
  206                 pomXml.appendNode('name', 'jitsi-meet-sdk')
  207                 pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
  208                 def dependencies = pomXml.appendNode('dependencies')
  209                 configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  210                     // The (third-party) React Native modules that we depend on
  211                     // are in source code form and do not have groupId. That is
  212                     // why we have a dedicated groupId for them. But the other
  213                     // dependencies come through Maven and, consequently, have
  214                     // groupId.
  215                     def groupId = it.moduleGroup
  216                     def artifactId = it.moduleName
  217 
  218                     if (artifactId.startsWith('react-native-') && groupId.equals('jitsi-meet')) {
  219                         groupId = rootProject.ext.moduleGroupId
  220                     }
  221 
  222                     def dependency = dependencies.appendNode('dependency')
  223                     dependency.appendNode('groupId', groupId)
  224                     dependency.appendNode('artifactId', artifactId)
  225                     dependency.appendNode('version', it.moduleVersion)
  226                 }
  227             }
  228         }
  229 
  230     }
  231     repositories {
  232         maven {
  233             url rootProject.ext.mavenRepo
  234             if (!rootProject.ext.mavenRepo.startsWith("file")) {
  235                 credentials {
  236                     username rootProject.ext.mavenUser
  237                     password rootProject.ext.mavenPassword
  238                 }
  239             }
  240         }
  241     }
  242 }