"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7688/android/build.gradle" (1 Dec 2023, 7688 Bytes) of package /linux/misc/jitsi-meet-7688.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.

    1 import groovy.json.JsonSlurper
    2 import org.gradle.util.VersionNumber
    3 
    4 // Top-level build file where you can add configuration options common to all
    5 // sub-projects/modules.
    6 
    7 buildscript {
    8     repositories {
    9         google()
   10         mavenCentral()
   11     }
   12     dependencies {
   13         classpath 'com.android.tools.build:gradle:7.3.1'
   14         classpath 'com.google.gms:google-services:4.4.0'
   15         classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
   16     }
   17 }
   18 
   19 ext {
   20     kotlinVersion = "1.7.0"
   21     buildToolsVersion = "33.0.2"
   22     compileSdkVersion = 33
   23     minSdkVersion    = 24
   24     targetSdkVersion = 33
   25     supportLibVersion = "28.0.0"
   26 
   27     // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
   28     ndkVersion = "23.1.7779620"
   29 
   30     // The Maven artifact groupId of the third-party react-native modules which
   31     // Jitsi Meet SDK for Android depends on and which are not available in
   32     // third-party Maven repositories so we have to deploy to a Maven repository
   33     // of ours.
   34     moduleGroupId = 'com.facebook.react'
   35 
   36     // Maven repo where artifacts will be published
   37     mavenRepo = System.env.MVN_REPO ?: ""
   38     mavenUser = System.env.MVN_USER ?: ""
   39     mavenPassword = System.env.MVN_PASSWORD ?: ""
   40 
   41     // Libre build
   42     libreBuild = (System.env.LIBRE_BUILD ?: "false").toBoolean()
   43 
   44     googleServicesEnabled = project.file('app/google-services.json').exists() && !libreBuild
   45 }
   46 
   47 allprojects {
   48     repositories {
   49         // React Native (JS, Obj-C sources, Android binaries) is installed from npm.
   50         maven { url "$rootDir/../node_modules/react-native/android" }
   51         // Android JSC is installed from npm.
   52         maven { url("$rootDir/../node_modules/jsc-android/dist") }
   53         mavenCentral {
   54             // We don't want to fetch react-native from Maven Central as there are
   55             // older versions over there.
   56             content {
   57                 excludeGroup "com.facebook.react"
   58             }
   59         }
   60         google()
   61         maven { url 'https://www.jitpack.io' }
   62     }
   63 
   64     // Make sure we use the react-native version in node_modules and not the one
   65     // published in jcenter / elsewhere.
   66     configurations.all {
   67         resolutionStrategy {
   68             eachDependency { DependencyResolveDetails details ->
   69                 if (details.requested.group == 'com.facebook.react'
   70                         && details.requested.name == 'react-native') {
   71                     def file = new File("$rootDir/../node_modules/react-native/package.json")
   72                     def version = new JsonSlurper().parseText(file.text).version
   73                     details.useVersion version
   74                 }
   75             }
   76         }
   77     }
   78 
   79     // Third-party react-native modules which Jitsi Meet SDK for Android depends
   80     // on and which are not available in third-party Maven repositories need to
   81     // be deployed in a Maven repository of ours.
   82     //
   83 
   84     if (project.name.startsWith('react-native-')) {
   85         apply plugin: 'maven-publish'
   86         publishing {
   87             publications {}
   88             repositories {
   89                 maven {
   90                     url rootProject.ext.mavenRepo
   91                     if (!rootProject.ext.mavenRepo.startsWith("file")) {
   92                         credentials {
   93                             username rootProject.ext.mavenUser
   94                             password rootProject.ext.mavenPassword
   95                         }
   96                     }
   97                 }
   98             }
   99         }
  100     }
  101 
  102     // Use the number of seconds/10 since Jan 1 2019 as the version qualifier number.
  103     // This will last for the next ~680 years.
  104     // https://stackoverflow.com/a/38643838
  105     def versionQualifierNumber = (int)(((new Date().getTime()/1000) - 1546297200) / 10)
  106 
  107     afterEvaluate { project ->
  108         if (project.plugins.hasPlugin('android') || project.plugins.hasPlugin('android-library')) {
  109             project.android {
  110                 compileSdkVersion rootProject.ext.compileSdkVersion
  111                 buildToolsVersion rootProject.ext.buildToolsVersion
  112             }
  113         }
  114 
  115         if (project.name.startsWith('react-native-')) {
  116             def npmManifest = project.file('../package.json')
  117             def json = new JsonSlurper().parseText(npmManifest.text)
  118 
  119             // Release every dependency the SDK has with a -jitsi-XXX qualified version. This allows
  120             // us to pin the dependencies and make sure they are always updated, no matter what.
  121 
  122             project.version = "${json.version}-jitsi-${versionQualifierNumber}"
  123 
  124             task jitsiAndroidSourcesJar(type: Jar) {
  125                 classifier = 'sources'
  126                 from android.sourceSets.main.java.source
  127             }
  128 
  129             publishing.publications {
  130                 aarArchive(MavenPublication) {
  131                     groupId rootProject.ext.moduleGroupId
  132                     artifactId project.name
  133                     version project.version
  134 
  135                     artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  136                         extension "aar"
  137                     }
  138                     artifact(jitsiAndroidSourcesJar)
  139                     pom.withXml {
  140                         def pomXml = asNode()
  141                         pomXml.appendNode('name', project.name)
  142                         pomXml.appendNode('description', json.description)
  143                         pomXml.appendNode('url', json.homepage)
  144                         if (json.license) {
  145                             def license = pomXml.appendNode('licenses').appendNode('license')
  146                             license.appendNode('name', json.license)
  147                             license.appendNode('distribution', 'repo')
  148                         }
  149 
  150                         def dependencies = pomXml.appendNode('dependencies')
  151                         configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  152                             def artifactId = it.moduleName
  153                             def version = it.moduleVersion
  154                             // React Native signals breaking changes by
  155                             // increasing the minor version number. So the
  156                             // (third-party) React Native modules we utilize can
  157                             // depend not on a specific react-native release but
  158                             // a wider range.
  159                             if (artifactId == 'react-native') {
  160                                 def versionNumber = VersionNumber.parse(version)
  161                                 version = "${versionNumber.major}.${versionNumber.minor}"
  162                             }
  163 
  164                             def dependency = dependencies.appendNode('dependency')
  165                             dependency.appendNode('groupId', it.moduleGroup)
  166                             dependency.appendNode('artifactId', artifactId)
  167                             dependency.appendNode('version', version)
  168                         }
  169                     }
  170                 }
  171             }
  172         }
  173     }
  174 }
  175 
  176 // Force the version of the Android build tools we have chosen on all
  177 // subprojects. The forcing was introduced for react-native and the third-party
  178 // modules that we utilize such as react-native-background-timer.
  179 subprojects { subproject ->
  180     afterEvaluate{
  181         if ((subproject.plugins.hasPlugin('android')
  182                     || subproject.plugins.hasPlugin('android-library'))
  183                 && rootProject.ext.has('buildToolsVersion')) {
  184             android {
  185                 buildToolsVersion rootProject.ext.buildToolsVersion
  186             }
  187         }
  188     }
  189 }