diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 13317701..922fe169 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -512,6 +512,7 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext else: # Scan before building... logging.info("Scanning source for common problems...") + scanner.options = options # pass verbose through count = scanner.scan_source(build_dir, build) if count > 0: if force: diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 6560c4da..1c30d189 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import imghdr import json import os import re @@ -33,7 +34,11 @@ from .exception import BuildException, VCSException config = None options = None -json_per_build = None +DEFAULT_JSON_PER_BUILD = {'errors': [], 'warnings': [], 'infos': []} +json_per_build = DEFAULT_JSON_PER_BUILD + +MAVEN_URL_REGEX = re.compile(r"""\smaven\s*{.*?(?:setUrl|url)\s*=?\s*(?:uri)?\(?\s*["']?([^\s"']+)["']?[^}]*}""", + re.DOTALL) def get_gradle_compile_commands(build): @@ -99,8 +104,6 @@ def scan_source(build_dir, build=metadata.Build()): if r.match(s) and not is_whitelisted(s): yield n - gradle_mavenrepo = re.compile(r'maven *{ *(url)? *[\'"]?([^ \'"]*)[\'"]?') - allowed_repos = [re.compile(r'^https://' + re.escape(repo) + r'/*') for repo in [ 'repo1.maven.org/maven2', # mavenCentral() 'jcenter.bintray.com', # jcenter() @@ -144,33 +147,38 @@ def scan_source(build_dir, build=metadata.Build()): return False def ignoreproblem(what, path_in_build_dir): - logging.info('Ignoring %s at %s' % (what, path_in_build_dir)) + msg = ('Ignoring %s at %s' % (what, path_in_build_dir)) + logging.info(msg) if json_per_build is not None: - json_per_build['infos'].append([what, path_in_build_dir]) + json_per_build['infos'].append([msg, path_in_build_dir]) return 0 def removeproblem(what, path_in_build_dir, filepath): - logging.info('Removing %s at %s' % (what, path_in_build_dir)) + msg = ('Removing %s at %s' % (what, path_in_build_dir)) + logging.info(msg) if json_per_build is not None: - json_per_build['infos'].append([what, path_in_build_dir]) + json_per_build['infos'].append([msg, path_in_build_dir]) os.remove(filepath) return 0 def warnproblem(what, path_in_build_dir): if toignore(path_in_build_dir): - return + return 0 logging.warning('Found %s at %s' % (what, path_in_build_dir)) if json_per_build is not None: json_per_build['warnings'].append([what, path_in_build_dir]) + return 0 def handleproblem(what, path_in_build_dir, filepath): if toignore(path_in_build_dir): return ignoreproblem(what, path_in_build_dir) if todelete(path_in_build_dir): return removeproblem(what, path_in_build_dir, filepath) - if options.json: + if 'src/test' in filepath or '/test/' in filepath: + return warnproblem(what, path_in_build_dir) + if options and options.json: json_per_build['errors'].append([what, path_in_build_dir]) - if not options.json or options.verbose: + if options and (options.verbose or not options.json): logging.error('Found %s at %s' % (what, path_in_build_dir)) return 1 @@ -196,6 +204,8 @@ def scan_source(build_dir, build=metadata.Build()): for sp in safe_paths: if sp.match(path): return True + if imghdr.what(path) is not None: + return True return False gradle_compile_commands = get_gradle_compile_commands(build) @@ -225,25 +235,29 @@ def scan_source(build_dir, build=metadata.Build()): path_in_build_dir = os.path.relpath(filepath, build_dir) _ignored, ext = common.get_extension(path_in_build_dir) - if ext == 'so': - count += handleproblem('shared library', path_in_build_dir, filepath) - elif ext == 'a': - count += handleproblem('static library', path_in_build_dir, filepath) - elif ext == 'class': - count += handleproblem('Java compiled class', path_in_build_dir, filepath) + if curfile in ('gradle-wrapper.jar', 'gradlew', 'gradlew.bat'): + removeproblem(curfile, path_in_build_dir, filepath) elif ext == 'apk': - removeproblem('APK file', path_in_build_dir, filepath) + removeproblem(_('Android APK file'), path_in_build_dir, filepath) + elif ext == 'a': + count += handleproblem(_('static library'), path_in_build_dir, filepath) + elif ext == 'aar': + count += handleproblem(_('Android AAR library'), path_in_build_dir, filepath) + elif ext == 'class': + count += handleproblem(_('Java compiled class'), path_in_build_dir, filepath) + elif ext == 'dex': + count += handleproblem(_('Android DEX code'), path_in_build_dir, filepath) + elif ext == 'gz': + count += handleproblem(_('gzip file archive'), path_in_build_dir, filepath) + elif ext == 'so': + count += handleproblem(_('shared library'), path_in_build_dir, filepath) + elif ext == 'zip': + count += handleproblem(_('ZIP file archive'), path_in_build_dir, filepath) elif ext == 'jar': for name in suspects_found(curfile): count += handleproblem('usual suspect \'%s\'' % name, path_in_build_dir, filepath) - if curfile == 'gradle-wrapper.jar': - removeproblem('gradle-wrapper.jar', path_in_build_dir, filepath) - else: - warnproblem('JAR file', path_in_build_dir) - - elif ext == 'aar': - warnproblem('AAR file', path_in_build_dir) + count += handleproblem(_('Java JAR file'), path_in_build_dir, filepath) elif ext == 'java': if not os.path.isfile(filepath): @@ -265,9 +279,8 @@ def scan_source(build_dir, build=metadata.Build()): count += handleproblem("usual suspect \'%s\'" % (name), path_in_build_dir, filepath) noncomment_lines = [line for line in lines if not common.gradle_comment.match(line)] - joined = re.sub(r'[\n\r\s]+', ' ', ' '.join(noncomment_lines)) - for m in gradle_mavenrepo.finditer(joined): - url = m.group(2) + no_comments = re.sub(r'/\*.*?\*/', '', ''.join(noncomment_lines), flags=re.DOTALL) + for url in MAVEN_URL_REGEX.findall(no_comments): if not any(r.match(url) for r in allowed_repos): count += handleproblem('unknown maven repo \'%s\'' % url, path_in_build_dir, filepath) @@ -277,16 +290,16 @@ def scan_source(build_dir, build=metadata.Build()): elif is_executable(filepath): if is_binary(filepath) and not safe_path(path_in_build_dir): - warnproblem('possible binary', path_in_build_dir) + warnproblem(_('executable binary, possibly code'), path_in_build_dir) for p in scanignore: if p not in scanignore_worked: - logging.error('Unused scanignore path: %s' % p) + logging.error(_('Unused scanignore path: %s') % p) count += 1 for p in scandelete: if p not in scandelete_worked: - logging.error('Unused scandelete path: %s' % p) + logging.error(_('Unused scandelete path: %s') % p) count += 1 return count @@ -336,7 +349,7 @@ def main(): if app.Disabled and not options.force: logging.info(_("Skipping {appid}: disabled").format(appid=appid)) - json_per_appid = json_per_appid['infos'].append('Skipping: disabled') + json_per_appid['disabled'] = json_per_build['infos'].append('Skipping: disabled') continue try: @@ -352,7 +365,7 @@ def main(): else: logging.info(_("{appid}: no builds specified, running on current source state") .format(appid=appid)) - json_per_build = {'errors': [], 'warnings': [], 'infos': []} + json_per_build = DEFAULT_JSON_PER_BUILD json_per_appid['current-source-state'] = json_per_build count = scan_source(build_dir) if count > 0: @@ -362,7 +375,7 @@ def main(): app.builds = [] for build in app.builds: - json_per_build = {'errors': [], 'warnings': [], 'infos': []} + json_per_build = DEFAULT_JSON_PER_BUILD json_per_appid[build.versionCode] = json_per_build if build.disable and not options.force: diff --git a/tests/build.TestCase b/tests/build.TestCase index 547c0b6e..0495bb79 100755 --- a/tests/build.TestCase +++ b/tests/build.TestCase @@ -132,7 +132,6 @@ class BuildTest(unittest.TestCase): fdroidserver.common.fill_config_defaults(config) fdroidserver.common.config = config fdroidserver.build.options = mock.Mock() - fdroidserver.build.options.json = False fdroidserver.build.options.notarball = True fdroidserver.build.options.skipscan = False @@ -141,7 +140,8 @@ class BuildTest(unittest.TestCase): build = fdroidserver.metadata.Build() build.commit = '1.0' build.output = app.id + '.apk' - build.scanignore = ['baz.so'] + build.scandelete = ['baz.so'] + build.scanignore = ['foo.aar'] build.versionCode = '1' build.versionName = '1.0' vcs = mock.Mock() @@ -186,11 +186,11 @@ class BuildTest(unittest.TestCase): force=False, onserver=False, refresh=False ) - self.assertTrue(os.path.exists('baz.so')) self.assertTrue(os.path.exists('foo.aar')) self.assertTrue(os.path.isdir('build')) self.assertTrue(os.path.isdir('reports')) self.assertTrue(os.path.isdir('target')) + self.assertFalse(os.path.exists('baz.so')) self.assertFalse(os.path.exists('bin')) self.assertFalse(os.path.exists('build/reports')) self.assertFalse(os.path.exists('gen')) diff --git a/tests/gradle-maven-blocks.yaml b/tests/gradle-maven-blocks.yaml new file mode 100644 index 00000000..f6587f94 --- /dev/null +++ b/tests/gradle-maven-blocks.yaml @@ -0,0 +1,778 @@ +- "\tmaven {\n\t\t\turl \"$rootDir/../node_modules/react-native-background-fetch/android/libs\"\ + \n\t\t}" +- "\tmaven {\n\t\t\turl \"https://plugins.gradle.org/m2/\"\n\t\t}" +- "\tmaven {\n\t\t\turl 'http://4thline.org/m2'\n\t\t}" +- "\tmaven {\n\t\t\turl 'https://maven.google.com/'\n\t\t\tname 'Google'\n\t\t}" +- "\tmaven {\n\t\turl \"file://$pwd/.m2repo\"\n\t}" +- "\tmaven {\n\t\turl \"https://jitpack.io\"\n\t}" +- "\tmaven {\n\t\turl 'https://maven.google.com/'\n\t\tname 'Google'\n\t}" +- "\tmaven {\n\t url 'https://maven.google.com'\n\t}" +- "\tmaven { url \"http://JRAF.org/static/maven/2\" }" +- "\tmaven { url \"http://dl.bintray.com/populov/maven\" }" +- "\tmaven { url \"https://jitpack.io\" }" +- "\tmaven { url 'http://maven.ghostscript.com/' }" +- "\tmaven { url 'https://jitpack.io' }" +- "\tmaven { url 'https://maven.fabric.io/public' }" +- "\tmaven { url MAVEN_REPO }" +- " maven {\n\t url 'https://jitpack.io'\n }" +- " maven {\n url rootProject.ext.mavenRepo\n \ + \ if (!rootProject.ext.mavenRepo.startsWith(\"file\")) {\n \ + \ credentials {\n username rootProject.ext.mavenUser\n\ + \ password rootProject.ext.mavenPassword\n \ + \ }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n url \"$rootDir/libs/gutenberg-mobile/node_modules/react-native/android\"\ + \n }" +- " maven {\n url \"file:~/.m2/\"\n artifactUrls \"\ + file:~/.m2/\"\n }" +- " maven {\n url \"https://maven-central-asia.storage-download.googleapis.com/repos/central/data/\"\ + \n content {\n excludeGroup(\"Kotlin/Native\"\ + )\n }" +- " maven {\n url \"https://maven-central-asia.storage-download.googleapis.com/repos/central/data/\"\ + \n }" +- " maven {\n url \"https://plugins.gradle.org/m2/\"\n }" +- " maven {\n url \"https://repo.commonsware.com.s3.amazonaws.com\"\ + \n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n // All of React Native (JS, Android binaries) is installed\ + \ from npm\n url \"$rootDir/react/node_modules/react-native/android\"\ + \n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n // url \"$rootDir/../node_modules/react-native/android\"\ + \n\n // Replace AAR from original RN with AAR from react-native-v8\n\ + \ url(\"$rootDir/../node_modules/react-native-v8/dist\")\n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n url \"$rootDir/../node_modules/react-native/android\"\ + \n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n url(\"$rootDir/../node_modules/react-native/android\"\ + )\n }" +- " maven {\n // Android JSC is installed from npm\n url(\"\ + $rootDir/../node_modules/jsc-android/dist\")\n }" +- " maven {\n // Android JSC is installed from npm\n url(\"\ + $rootDir/react/node_modules/jsc-android/dist\")\n }" +- " maven {\n // Local Maven repo containing AARs with JSC library built\ + \ for Android\n // url \"$rootDir/../node_modules/jsc-android/dist\"\n\ + \n // prebuilt libv8android.so\n url(\"$rootDir/../node_modules/v8-android/dist\"\ + )\n }" +- " maven {\n // Local Maven repo containing AARs with JSC library built\ + \ for Android\n url \"$rootDir/../node_modules/jsc-android/dist\"\n \ + \ }" +- " maven {\n //noinspection GroovyAssignabilityCheck\n url\ + \ 'https://jitpack.io'\n }" +- " maven {\n //noinspection GroovyAssignabilityCheck\n url\ + \ 'https://s3.amazonaws.com/moat-sdk-builds'\n }" +- " maven {\n //url 'https://maven.google.com/'\n url 'https://jitpack.io'\n\ + \ name 'Google'\n }" +- " maven {\n name 'glide-snapshot'\n url 'http://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n name 'glide-snapshot'\n url 'https://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n name = \"sonatype\"\n\n def releasesRepoUrl =\ + \ \"https://oss.sonatype.org/service/local/staging/deploy/maven2/\"\n \ + \ def snapshotsRepoUrl = \"https://oss.sonatype.org/content/repositories/snapshots/\"\ + \n url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl\n\ + \n credentials {\n username ossrhUsername\n \ + \ password ossrhPassword\n }" +- " maven {\n url \"http://developer.huawei.com/repo/\"\n }" +- " maven {\n url \"http://dl.bintray.com/dasar/maven\"\n }" +- " maven {\n url \"http://dl.bintray.com/jenzz/maven\"\n }" +- " maven {\n url \"http://dl.bintray.com/journeyapps/maven\"\n \ + \ }" +- " maven {\n url \"http://dl.bintray.com/lukaville/maven\"\n }" +- " maven {\n url \"http://dl.bintray.com/ona/kujaku\"\n }" +- " maven {\n url \"http://dl.bintray.com/piasy/maven\"\n content\ + \ {\n includeGroupByRegex \"com\\\\.github\\\\.piasy\"\n \ + \ }" +- " maven {\n url \"http://kotlin.bintray.com/kotlin-dev\"\n \ + \ content {\n excludeGroup(\"Kotlin/Native\")\n }" +- " maven {\n url \"http://oss.sonatype.org/content/repositories/snapshots\"\ + \n }" +- " maven {\n url \"https://clojars.org/repo/\"\n }" +- " maven {\n url \"https://dl.bintray.com/kotlin/ktor\"\n content\ + \ {\n excludeGroup(\"Kotlin/Native\")\n }" +- " maven {\n url \"https://dl.bintray.com/soywiz/soywiz\"\n \ + \ content {\n excludeGroup(\"Kotlin/Native\")\n }" +- " maven {\n url \"https://dl.bintray.com/wire-android/third-party\"\n\ + \ }" +- " maven {\n url \"https://github.com/vector-im/jitsi_libre_maven/raw/master/releases\"\ + \n }" +- " maven {\n url \"https://jitpack.io\"\n\n }" +- " maven {\n url \"https://jitpack.io\"\n content {\n \ + \ // For some reason gradle attempts to get bugsnag from here, which returns\ + \ 522\n // after which gradle just drops jitpack. Exclude so it doesn't\ + \ bother trying.\n excludeGroupByRegex \".*bugsnag.*\"\n \ + \ }" +- " maven {\n url \"https://jitpack.io\"\n content {\n \ + \ excludeGroup(\"Kotlin/Native\")\n }" +- " maven {\n url \"https://jitpack.io\"\n }" +- " maven {\n url \"https://jitpack.io/\"\n }" +- " maven {\n url \"https://kotlin.bintray.com/kotlinx\"\n content\ + \ {\n excludeGroup(\"Kotlin/Native\")\n }" +- " maven {\n url \"https://maven-central-asia.storage-download.googleapis.com/repos/central/data/\"\ + \n }" +- " maven {\n url \"https://maven.fabric.io/public\"\n }" +- " maven {\n url \"https://maven.google.com\"\n name 'Google'\n\ + \ }" +- " maven {\n url \"https://maven.google.com\"\n }" +- " maven {\n url \"https://maven.google.com/\"\n }" +- " maven {\n url \"https://maven.mozilla.org/maven2\"\n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots\"\ + \n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots/\"\ + \n }" +- " maven {\n url \"https://plugins.gradle.org/m2/\"\n }" +- " maven {\n url \"https://repo1.maven.org/maven2\"\n jcenter()\n\ + \ }" +- " maven {\n url \"https://s3.amazonaws.com/repo.commonsware.com\"\n \ + \ }" +- " maven {\n url \"https://s3.amazonaws.com/repo.commonsware.com\"\n \ + \ }" +- " maven {\n url \"https://snapshots.maven.mozilla.org/maven2\"\n \ + \ }" +- " maven {\n url '${mavenUrl}" +- " maven {\n url 'http://maven.aliyun.com/nexus/content/repositories/releases/'\n\ + \ }" +- " maven {\n url 'http://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n url 'http://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ }" +- " maven {\n url 'http://www.idescout.com/maven/repo/'\n name\ + \ 'IDEScout, Inc.'\n }" +- " maven {\n url 'http://www.idescout.com/maven/repo/'\n }" +- " maven {\n url 'https://clojars.org/repo'\n }" +- " maven {\n url 'https://dl.bintray.com/alexeydanilov/maven'\n \ + \ }" +- " maven {\n url 'https://dl.bintray.com/drummer-aidan/maven'\n \ + \ }" +- " maven {\n url 'https://dl.bintray.com/kotlin/kotlin-eap'\n \ + \ content {\n excludeGroup(\"Kotlin/Native\")\n }" +- " maven {\n url 'https://github.com/suckgamony/RapidDecoder/raw/master/repository'\n\ + \ }" +- " maven {\n url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'\n\ + \ }" +- " maven {\n url 'https://jitpack.io'\n content {\n \ + \ // Use this repo only for matrix SDK library\n includeGroupByRegex\ + \ \"com\\\\.github\\\\.Bubu\"\n // Also add subgroups, due to SDK\ + \ split into modules\n includeGroupByRegex \"com\\\\.github\\\\.Bubu\\\ + \\.matrix-android-sdk\"\n // And Olm library\n includeGroupByRegex\ + \ \"org\\\\.matrix\\\\.gitlab\\\\.matrix-org\"\n // And PhotoView\n\ + \ includeGroupByRegex \"com\\\\.github\\\\.chrisbanes\"\n \ + \ }" +- " maven {\n url 'https://jitpack.io'\n content {\n \ + \ // Use this repo only for olm library\n includeGroupByRegex\ + \ \"org\\\\.matrix\\\\.gitlab\\\\.matrix-org\"\n // And also for\ + \ FilePicker\n includeGroupByRegex \"com\\\\.github\\\\.jaiselrahman\"\ + \n // And monarchy\n includeGroupByRegex \"com\\\\\ + .github\\\\.Zhuinden\"\n // And ucrop\n includeGroupByRegex\ + \ \"com\\\\.github\\\\.yalantis\"\n // JsonViewer\n \ + \ includeGroupByRegex 'com\\\\.github\\\\.BillCarsonFr'\n }" +- " maven {\n url 'https://jitpack.io'\n }" +- " maven {\n url 'https://jitpack.io/'\n }" +- " maven {\n url 'https://maven.aliyun.com/repository/google'\n \ + \ name 'replace google()'\n }" +- " maven {\n url 'https://maven.aliyun.com/repository/jcenter'\n \ + \ name 'replace jcenter()'\n }" +- " maven {\n url 'https://maven.aliyun.com/repository/public'\n \ + \ name 'replace jcenter() and mavenCentral()'\n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n url 'https://maven.google.com'\n // Alternative\ + \ URL is 'https://dl.google.com/dl/android/maven2/'\n }" +- " maven {\n url 'https://maven.google.com'\n }" +- " maven {\n url 'https://maven.google.com/'\n name 'Google'\n\ + \ }" +- " maven {\n url 'https://maven.google.com/'\n }" +- " maven {\n url 'https://oss.sonatype.org/content/groups/public'\n \ + \ }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ content {\n excludeGroup(\"Kotlin/Native\")\n \ + \ }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ }" +- " maven {\n url 'https://plugins.gradle.org/m2'\n }" +- " maven {\n url 'https://plugins.gradle.org/m2/'\n }" +- " maven {\n url 'https://www.jitpack.io'\n }" +- " maven {\n url rootProject.ext.mavenRepo\n if (!rootProject.ext.mavenRepo.startsWith(\"\ + file\")) {\n credentials {\n username rootProject.ext.mavenUser\n\ + \ password rootProject.ext.mavenPassword\n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n url 'https://maven.google.com/'\n }" +- " maven {\n credentials {\n username System.env.ANDVIANE_USERNAME\n password System.env.ANDVIANE_PASSWORD\n }\n //url 'https://oss.sonatype.org/content/repositories/snapshots'\n url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'\n }" +- " maven {\n // CUTR Releases\n url \"https://github.com/CUTR-at-USF/cutr-mvn-repo/raw/master/snapshots\"\ + \n }" +- " maven {\n // Git project library as local library project (ucrop) - see\ + \ https://jitpack.io/docs/\n url 'https://jitpack.io'\n }" +- " maven {\n // Need manual cleanup for new SNAPSHOT update if same name with\ + \ date change only:\n // Smack official SNAPSHOT repository accepted by F-Droid\n\ + \ url 'https://oss.sonatype.org/content/repositories/snapshots'\n\n \ + \ // Smack custom library for org.igniterealtime - not recognize by F-Droid\n\ + \ // url 'https://igniterealtime.org/repo/'\n\n // Custom library\ + \ for org.jitsi - maven-metadata.xml not compatible\n // Unable to load Maven\ + \ meta-data from https://github.com/jitsi/jitsi-maven-repository/tree/master/snapshots/org/jitsi/ice4j/2.0.0-SNAPSHOT/maven-metadata.xml.\n\ + \ // org.xml.sax.SAXParseException; lineNumber: 44; columnNumber: 91; Attribute\ + \ name \"data-pjax-transient\" associated with an element type \"meta\" must be\ + \ followed by the ' = ' character.\n // url 'https://github.com/jitsi/jitsi-maven-repository/tree/master/snapshots'\n\ + \ }" +- " maven {\n // OBA Releases - for comparator to sort alphanumeric routes\n\ + \ url \"http://nexus.onebusaway.org/nexus/content/repositories/releases\"\ + \n }" +- " maven {\n // TODO: Remove this after support library v24 public release.\n\ + \ url \"$rootDir/prebuilts/fullsdk/extras/android/m2repository\"\n }" +- " maven {\n // This maven repo contains artifacts for Flutter's Android embedding.\n\ + \ url 'http://download.flutter.io'\n }" +- " maven {\n // This maven repo is created when you run `flutter build aar`.\ + \ It contains compiled code\n // and resources for flutter_module itself.\n\ + \ url '../../flutter_module/build/host/outputs/repo'\n }" +- " maven {\n // Used only for PhotoView\n url \"https://jitpack.io\"\ + \n name 'JitPack Github wrapper'\n }" +- " maven {\n // for Amazon Maps\n url uri('../.m2/repository')\n \ + \ }" +- " maven {\n // for testlib\n url \"http://dl.bintray.com/acrowntest/ES_SDK\"\ + \n }" +- " maven {\n //url 'https://maven.google.com/'\n url 'https://jitpack.io'\n\ + \ name 'Google'\n }" +- " maven {\n url \"http://4thline.org/m2\"\n }" +- " maven {\n url \"http://maven.chunyu.mobi/content/groups/public/\"\n \ + \ credentials {\n username maven_user\n password maven_password\n\ + \ }" +- " maven {\n url \"https://dl.google.com/dl/android/maven2/\"\n }" +- " maven {\n url \"https://jitpack.io\"\n }" +- " maven {\n url \"https://maven.fabric.io/public\"\n }" +- " maven {\n url \"https://maven.google.com\"\n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/releases\"\ + \n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots\"\ + \n }" +- " maven {\n url \"https://repo.eclipse.org/content/repositories/paho-releases/\"\ + \n }" +- " maven {\n url '../..'\n }" +- " maven {\n url 'https://dl.bintray.com/amulyakhare/maven'\n }" +- " maven {\n url 'https://github.com/Goddchen/mvn-repo/raw/master/'\n }" +- " maven {\n url 'https://jitpack.io'\n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n url 'https://maven.google.com'\n // Alternative URL is\ + \ 'https://dl.google.com/dl/android/maven2/'\n url \"https://jitpack.io\"\ + \n }" +- " maven {\n url 'https://maven.google.com'\n }" +- " maven {\n url 'https://maven.google.com/'\n name 'Google'\n }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ }" +- " maven {\n url 'https://raw.githubusercontent.com/felixb/mvn-repo/master'\n\ + \ }" +- " maven {\n url 'third_party/m2'\n }" +- " maven {\n url xwalkMavenRepo\n }" +- " maven {\n url(\"https://maven.fabric.io/public\")\n }" +- " maven {\n url(\"https://oss.sonatype.org/content/repositories/snapshots\"\ + )\n }" +- " maven {\n url \"$buildDir/repo\"\n }" +- " maven {\n url \"https://jitpack.io\"\n }" +- " maven {\n url \"https://maven.google.com\"\n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots/\"\ + \n }" +- " maven {\n url \"https://plugins.gradle.org/m2/\"\n }" +- " maven {\n url 'http://download.crashlytics.com/maven'\n }" +- " maven {\n url 'https://clojars.org/repo/'\n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ }" +- " maven {\n url 'https://raw.github.com/ark/ark/master/releases/'\n }" +- " maven {\n url 'https://raw.github.com/iFixit/ark/master/releases/'\n }" +- " maven {\n setUrl(\"https://plugins.gradle.org/m2/\")\n }" +- " maven {\n url 'https://maven.google.com'\n }" +- ' maven { + + // url "https://jitpack.io" + + // url "https://maven-central.storage.googleapis.com" + + // url "http://repo.spring.io/plugins-release/" + + // }' +- ' maven { url "https://maven.google.com" }' +- ' maven { setUrl("https://www.jitpack.io") }' +- ' maven { url "https://dl.bintray.com/bjoernq/maven" }' +- ' maven { url "https://dl.bintray.com/ligi/maven" }' +- ' maven { url "https://dl.bintray.com/lukaville/maven" }' +- ' maven { url "https://jetbrains.bintray.com/trove4j" }' +- ' maven { url "$rootDir/../node_modules/react-native/android" }' +- ' maven { url "file:///home/snowdream/workspace/git/mvn-repo/releases/" }' +- ' maven { url "file:///home/snowdream/workspace/git/mvn-repo/snapshots/" }' +- ' maven { url "http://dl.bintray.com/arturbosch/code-analysis" }' +- ' maven { url "http://dl.bintray.com/countly/maven" }' +- ' maven { url "http://dl.bintray.com/drummer-aidan/maven" }' +- ' maven { url "http://dl.bintray.com/drummer-aidan/maven/com/afollestad" }' +- ' maven { url "http://dl.bintray.com/lukaville/maven" }' +- ' maven { url "http://dl.bintray.com/mobisystech/maven" }' +- ' maven { url "http://dl.bintray.com/populov/maven" }' +- ' maven { url "http://kotlin.bintray.com/kotlin-dev" }' +- ' maven { url "http://maven.batch.com/release" }' +- ' maven { url "http://objectbox.net/beta-repo/" }' +- ' maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }' +- ' maven { url "http://repo.commonsware.com.s3.amazonaws.com" }' +- ' maven { url "http://repo1.maven.org/maven2" }' +- ' maven { url "http://repository.apache.org/snapshots/" }' +- ' maven { url "http://snowdream.github.io/mvn-repo/releases/" }' +- ' maven { url "http://snowdream.github.io/mvn-repo/snapshots/" }' +- ' maven { url "http://storage.googleapis.com/r8-releases/raw/master" }' +- ' maven { url "https://clojars.org/repo" }' +- ' maven { url "https://clojars.org/repo/" }' +- ' maven { url "https://dl.bintray.com/acra/maven" }' +- ' maven { url "https://dl.bintray.com/asf/asf" }' +- ' maven { url "https://dl.bintray.com/badoo/maven" }' +- ' maven { url "https://dl.bintray.com/dasar/maven" }' +- ' maven { url "https://dl.bintray.com/drummer-aidan/maven" }' +- ' maven { url "https://dl.bintray.com/florent37/maven" }' +- ' maven { url "https://dl.bintray.com/gericop/maven" }' +- ' maven { url "https://dl.bintray.com/kotlin/ktor" }' +- ' maven { url "https://dl.bintray.com/markusamshove/maven" }' +- ' maven { url "https://dl.bintray.com/mockito/maven" }' +- ' maven { url "https://dl.bintray.com/robstoll/tutteli-jars" }' +- ' maven { url "https://dl.bintray.com/videolan/Android" }' +- ' maven { url "https://dl.bintray.com/wire-android/releases" }' +- ' maven { url "https://dl.bintray.com/wire-android/releases/" }' +- ' maven { url "https://dl.bintray.com/wire-android/snapshots" }' +- ' maven { url "https://dl.bintray.com/wire-android/snapshots/" }' +- ' maven { url "https://dl.bintray.com/wire-android/third-party" }' +- ' maven { url "https://dl.bintray.com/wire-android/third-party/" }' +- ' maven { url "https://dl.bintray.com/wordpress-mobile/maven" }' +- ' maven { url "https://dl.bintray.com/wordpress-mobile/react-native-mirror/" }' +- ' maven { url "https://fusesource.github.io/jansi/" }' +- ' maven { url "https://giphy.bintray.com/giphy-sdk" }' +- ' maven { url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases" + }' +- ' maven { url "https://jcenter.bintray.com" }' +- " maven { url \"https://jitpack.io\"\n }" +- ' maven { url "https://jitpack.io" }' +- ' maven { url "https://jitpack.io"}' +- ' maven { url "https://kotlin.bintray.com/kotlinx" }' +- ' maven { url "https://mapbox.bintray.com/mapbox" }' +- ' maven { url "https://maven-central-asia.storage-download.googleapis.com/repos/central/data/" + }' +- ' maven { url "https://maven.fabric.io/public" }' +- " maven { url \"https://maven.google.com\"\n }" +- ' maven { url "https://maven.google.com" }' +- ' maven { url "https://maven.google.com"}' +- ' maven { url "https://maven.google.com/" }' +- ' maven { url "https://oss.sonatype.org/content/groups/public" }' +- ' maven { url "https://oss.sonatype.org/content/groups/public/" }' +- ' maven { url "https://oss.sonatype.org/content/repositories/releases/" }' +- ' maven { url "https://oss.sonatype.org/content/repositories/snapshots" }' +- ' maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }' +- ' maven { url "https://plugins.gradle.org/m2" }' +- ' maven { url "https://plugins.gradle.org/m2/" }' +- ' maven { url "https://plugins.gradle.org/m2/"}' +- ' maven { url "https://raw.githubusercontent.com/guardianproject/gpmaven/master" + }' +- ' maven { url "https://repo.commonsware.com.s3.amazonaws.com" }' +- ' maven { url "https://repo.eclipse.org/content/groups/releases" }' +- ' maven { url "https://repo.maven.apache.org/maven2" }' +- ' maven { url "https://repo1.maven.org/maven2/" }' +- ' maven { url "https://s3.amazonaws.com/moat-sdk-builds" }' +- ' maven { url "https://s3.amazonaws.com/repo.commonsware.com" }' +- ' maven { url "https://www.jitpack.io" }' +- ' maven { url ''file:///usr/share/maven-repo'' }' +- ' maven { url ''http://dl.bintray.com/amulyakhare/maven'' }' +- ' maven { url ''http://download.crashlytics.com/maven'' }' +- ' maven { url ''http://guardian.github.com/maven/repo-releases'' }' +- ' maven { url ''http://igniterealtime.org/repo'' }' +- ' maven { url ''http://maven.ghostscript.com/'' }' +- ' maven { url ''http://nexus.testobject.org/nexus/content/repositories/testobject-public-alpha-repo'' + }' +- ' maven { url ''http://oss.sonatype.org/content/repositories/snapshots'' }' +- ' maven { url ''http://repo1.maven.org/maven2'' }' +- ' maven { url ''http://wordpress-mobile.github.io/WordPress-Android'' }' +- ' maven { url ''https://dl.bintray.com/badoo/maven'' }' +- ' maven { url ''https://dl.bintray.com/content/simonpoole/android'' }' +- ' maven { url ''https://dl.bintray.com/content/simonpoole/div'' }' +- ' maven { url ''https://dl.bintray.com/content/simonpoole/osm'' }' +- ' maven { url ''https://dl.bintray.com/florent37/maven'' }' +- ' maven { url ''https://dl.bintray.com/intercom/intercom-maven'' }' +- ' maven { url ''https://dl.bintray.com/jenly/maven'' }' +- ' maven { url ''https://dl.bintray.com/jetbrains/anko'' }' +- ' maven { url ''https://dl.bintray.com/kotlin/kotlin-eap'' }' +- ' maven { url ''https://dl.bintray.com/twofortyfouram/maven'' }' +- ' maven { url ''https://dl.bintray.com/umsdk/release'' }' +- ' maven { url ''https://dl.google.com/dl/android/maven2/'' }' +- ' maven { url ''https://github.com/FireZenk/maven-repo/raw/master/'' }' +- ' maven { url ''https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'' }' +- ' maven { url ''https://guardian.github.com/maven/repo-releases'' }' +- ' maven { url ''https://igniterealtime.org/repo'' }' +- ' maven { url ''https://jitpack.io'' }' +- ' maven { url ''https://jitpack.io/'' }' +- ' maven { url ''https://maven.fabric.io/public'' }' +- ' maven { url ''https://maven.fabric.io/repo'' }' +- ' maven { url ''https://maven.google.com'' }' +- ' maven { url ''https://maven.google.com/'' }' +- ' maven { url ''https://oss.jfrog.org/artifactory/oss-snapshot-local/'' }' +- ' maven { url ''https://oss.sonatype.org/content/repositories/releases/'' }' +- ' maven { url ''https://oss.sonatype.org/content/repositories/snapshots'' }' +- ' maven { url ''https://oss.sonatype.org/content/repositories/snapshots/'' }' +- ' maven { url ''https://plugins.gradle.org/m2/'' }' +- ' maven { url ''https://plugins.gradle.org/m2/''}' +- ' maven { url ''https://repo1.maven.org/maven2'' }' +- ' maven { url ''https://repos.zeroturnaround.com/nexus/content/repositories/zt-public-releases'' + }' +- ' maven { url ''https://repository-achartengine.forge.cloudbees.com/snapshot/'' + }' +- ' maven { url ''https://s3.amazonaws.com/repo.commonsware.com'' }' +- ' maven { url ''https://www.jitpack.io'' }' +- ' maven { url ''https://zendesk.jfrog.io/zendesk/repo'' }' +- ' maven { url ''libs'' }' +- ' maven { url = "https://storage.googleapis.com/r8-releases/raw" }' +- ' maven { url = uri("https://jitpack.io") }' +- ' maven { url = uri("https://maven.fabric.io/public") }' +- ' maven { url MAVEN_REPO_CACHE }' +- ' maven { url(''http://releases.marmeladburk.fidesmo.com/'') }' +- ' maven {url "http://dl.bintray.com/tbruyelle/tbruyelle" }' +- ' maven {url "https://jitpack.io"}' +- ' maven {url ''http://maven.aliyun.com/nexus/content/groups/public/''}' +- " maven{\n url 'https://maven.fabric.io/public'\n }" +- " maven{\n url'https://plugins.gradle.org/m2/'\n }" +- " maven{\n url \"https://maven.google.com\"\n }" +- " maven{\n url 'https://maven.google.com'\n }" +- ' maven{ url "https://oss.sonatype.org/content/repositories/releases/" }' +- ' maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }' +- ' maven{ url ''http://maven.aliyun.com/nexus/content/groups/public/''}' +- ' maven{ url ''https://jitpack.io'' }' +- ' maven{ url ''https://maven.aliyun.com/repository/google'' }' +- ' maven{ url ''https://maven.aliyun.com/repository/google''}' +- ' maven{ url ''https://maven.aliyun.com/repository/gradle-plugin''}' +- ' maven{ url ''https://maven.aliyun.com/repository/jcenter'' }' +- ' maven{ url ''https://maven.aliyun.com/repository/jcenter''}' +- ' maven{ url ''https://maven.aliyun.com/repository/public''}' +- ' maven{url "https://plugins.gradle.org/m2/"}' +- ' maven{url ''http://maven.aliyun.com/nexus/content/groups/public''}' +- "\tmaven {\n\t\t\t\turl \"https://oss.sonatype.org/content/repositories/snapshots\"\ + \n\t\t\t}" +- "\tmaven {\n\t\t\turl \"$rootDir/../node_modules/react-native-background-fetch/android/libs\"\ + \n\t\t}" +- "\tmaven {\n\t\t\turl \"https://jitpack.io\"\n\t\t}" +- "\tmaven {\n\t\t\turl \"https://plugins.gradle.org/m2/\"\n\t\t}" +- "\tmaven {\n\t\t\turl 'http://4thline.org/m2'\n\t\t}" +- "\tmaven {\n\t\t\turl 'https://maven.google.com/'\n\t\t\tname 'Google'\n\t\t}" +- "\tmaven {\n\t\t\turl 'https://plugins.gradle.org/m2/'\n\t\t}" +- "\tmaven {\n\t\turl \"file://$pwd/.m2repo\"\n\t}" +- "\tmaven {\n\t\turl \"https://jitpack.io\"\n\t}" +- "\tmaven {\n\t\turl 'https://maven.google.com/'\n\t\tname 'Google'\n\t}" +- "\tmaven {\n // Google Maven Repository\n url 'https://maven.google.com'\n\ + \ }" +- "\tmaven { url \"http://dl.bintray.com/populov/maven\" }" +- "\tmaven { url \"https://jitpack.io\" }" +- "\tmaven { url 'http://download.crashlytics.com/maven' }" +- "\tmaven { url 'http://maven.ghostscript.com/' }" +- "\tmaven { url 'https://jitpack.io' }" +- "\tmaven { url 'https://maven.fabric.io/public' }" +- "\tmaven { url MAVEN_REPO }" +- ' maven { url "http://repo1.maven.org/maven2" }' +- " maven {\n\t url 'https://jitpack.io'\n }" +- " maven {\n\t url System.getenv()['ANDROID_HOME'] + \"/extras/android/m2repository\"\ + \n }" +- " maven {\n url \"$buildDir/repo\"\n }" +- " maven {\n url \"file:~/.m2/\"\n artifactUrls \"\ + file:~/.m2/\"\n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots\"\ + \n }" +- " maven {\n url \"https://plugins.gradle.org/m2/\"\n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n url repository\n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n // url \"$rootDir/../node_modules/react-native/android\"\ + \n\n // Replace AAR from original RN with AAR from react-native-v8\n\ + \ url(\"$rootDir/../node_modules/react-native-v8/dist\")\n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n url \"$projectDir/../../node_modules/react-native/android\"\ + \n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n url \"$projectDir/../../tests/react-test-app/node_modules/react-native/android\"\ + \n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n url \"$rootDir/../node_modules/react-native/android\"\ + \n }" +- " maven {\n // All of React Native (JS, Obj-C sources, Android binaries)\ + \ is installed from npm\n url(\"$rootDir/../node_modules/react-native/android\"\ + )\n }" +- " maven {\n // Android JSC is installed from npm\n url(\"\ + $rootDir/../node_modules/jsc-android/dist\")\n }" +- " maven {\n // Local Maven repo containing AARs with JSC library built\ + \ for Android\n // url \"$rootDir/../node_modules/jsc-android/dist\"\n\ + \n // prebuilt libv8android.so\n url(\"$rootDir/../node_modules/v8-android/dist\"\ + )\n }" +- " maven {\n //noinspection GroovyAssignabilityCheck\n url\ + \ 'https://jitpack.io'\n }" +- " maven {\n //noinspection GroovyAssignabilityCheck\n url\ + \ 'https://s3.amazonaws.com/moat-sdk-builds'\n }" +- " maven {\n //url 'https://maven.google.com/'\n url 'https://jitpack.io'\n\ + \ name 'Google'\n }" +- " maven {\n name 'glide-snapshot'\n url 'http://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n url \"http://dl.bintray.com/countly/maven\"\n }" +- " maven {\n url \"./maven_repository/\"\n }" +- " maven {\n url \"http://dl.bintray.com/dasar/maven\"\n }" +- " maven {\n url \"http://dl.bintray.com/jenzz/maven\"\n }" +- " maven {\n url \"http://dl.bintray.com/journeyapps/maven\"\n \ + \ }" +- " maven {\n url \"http://dl.bintray.com/lukaville/maven\"\n }" +- " maven {\n url \"https://clojars.org/repo/\"\n }" +- " maven {\n url \"https://dl.bintray.com/videolan/Android\"\n \ + \ }" +- " maven {\n url \"https://github.com/jitsi/jitsi-maven-repository/raw/master/releases\"\ + \n }" +- " maven {\n url \"https://github.com/vector-im/jitsi_libre_maven/raw/master/releases\"\ + \n }" +- " maven {\n url \"https://jcenter.bintray.com\"\n }" +- " maven {\n url \"https://jitpack.io\"\n\n }" +- " maven {\n url \"https://jitpack.io\"\n content {\n \ + \ // For some reason gradle attempts to get bugsnag from here, which returns\ + \ 522\n // after which gradle just drops jitpack. Exclude so it doesn't\ + \ bother trying.\n excludeGroupByRegex \".*bugsnag.*\"\n \ + \ }" +- " maven {\n url \"https://jitpack.io\"\n }" +- " maven {\n url \"https://jitpack.io/\"\n }" +- " maven {\n url \"https://maven.fabric.io/public\"\n }" +- " maven {\n url \"https://maven.google.com\"\n name 'Google'\n\ + \ }" +- " maven {\n url \"https://maven.google.com\"\n }" +- " maven {\n url \"https://maven.google.com/\"\n name 'Google'\n\ + \ }" +- " maven {\n url \"https://maven.mozilla.org/maven2\"\n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots\"\ + \n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots/\"\ + \n }" +- " maven {\n url \"https://plugins.gradle.org/m2/\"\n }" +- " maven {\n url \"https://repo1.maven.org/maven2\"\n jcenter()\n\ + \ }" +- " maven {\n url \"https://repo1.maven.org/maven2\"\n }" +- " maven {\n url \"https://s3.amazonaws.com/repo.commonsware.com\"\n \ + \ }" +- " maven {\n url \"https://s3.amazonaws.com/repo.commonsware.com\"\n \ + \ }" +- " maven {\n url 'http://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n url 'http://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ }" +- " maven {\n url 'http://www.idescout.com/maven/repo/'\n name\ + \ 'IDEScout, Inc.'\n }" +- " maven {\n url 'https://github.com/suckgamony/RapidDecoder/raw/master/repository'\n\ + \ }" +- " maven {\n url 'https://jitpack.io'\n content {\n \ + \ // Use this repo only for matrix SDK library\n includeGroupByRegex\ + \ \"com\\\\.github\\\\.Bubu\"\n // Also add subgroups, due to SDK\ + \ split into modules\n includeGroupByRegex \"com\\\\.github\\\\.Bubu\\\ + \\.matrix-android-sdk\"\n // And Olm library\n includeGroupByRegex\ + \ \"org\\\\.matrix\\\\.gitlab\\\\.matrix-org\"\n // And PhotoView\n\ + \ includeGroupByRegex \"com\\\\.github\\\\.chrisbanes\"\n \ + \ }" +- " maven {\n url 'https://jitpack.io'\n content {\n \ + \ // Use this repo only for matrix SDK library\n includeGroupByRegex\ + \ \"com\\\\.github\\\\.matrix-org\"\n // Also add subgroups, due\ + \ to SDK split into modules\n includeGroupByRegex \"com\\\\.github\\\ + \\.matrix-org\\\\.matrix-android-sdk\"\n // And Olm library\n \ + \ includeGroupByRegex \"org\\\\.matrix\\\\.gitlab\\\\.matrix-org\"\n\ + \ // And PhotoView\n includeGroupByRegex \"com\\\\\ + .github\\\\.chrisbanes\"\n }" +- " maven {\n url 'https://jitpack.io'\n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n url 'https://maven.google.com'\n }" +- " maven {\n url 'https://maven.google.com/'\n name 'Google'\n\ + \ }" +- " maven {\n url 'https://maven.google.com/'\n }" +- " maven {\n url 'https://mint.splunk.com/gradle/'\n }" +- " maven {\n url 'https://oss.sonatype.org/content/groups/public'\n \ + \ }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ }" +- " maven {\n url 'https://plugins.gradle.org/m2/'\n }" +- " maven {\n url 'https://www.jitpack.io'\n }" +- " maven {\n url = \"${project.buildDir}" +- " maven {\n url(\"$rootDir/../node_modules/jsc-android/dist\")\n \ + \ }" +- " maven {\n url(\"$rootDir/../node_modules/react-native/android\")\n\ + \ }" +- " maven {\n // For the latest version of GeckoView (moving target!) use:\n\ + \ // https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.latest.mobile.android-api-16-opt/artifacts/public/android/maven\n\ + \ //\n // For discovering available versions go to:\n // \ + \ https://tools.taskcluster.net/index/gecko.v2.mozilla-central.nightly\n\n \ + \ // ARM GeckoView builds\n url \"https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly\"\ + \ +\n \".${geckoview_nightly_date}" +- " maven {\n // Replace snapshots by releases for releases !\n url\ + \ \"https://linphone.org/snapshots/maven_repository\"\n }" +- " maven {\n // Switch to release for releases !\n url \"https://gitlab.linphone.org/BC/public/maven_repository/raw/master\"\ + \n }" +- " maven {\n // TODO: Remove this after support library v24 public release.\n\ + \ url \"$rootDir/prebuilts/fullsdk/extras/android/m2repository\"\n }" +- " maven {\n // Used only for PhotoView\n url \"https://jitpack.io\"\ + \n name 'JitPack Github wrapper'\n }" +- " maven {\n // aarch64 builds\n url \"https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly\"\ + \ +\n \".${geckoview_nightly_date}" +- " maven {\n // x86 GeckoView builds\n url \"https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly\"\ + \ +\n \".${geckoview_nightly_date}" +- " maven {\n //url 'https://maven.google.com/'\n url 'https://jitpack.io'\n\ + \ name 'Google'\n }" +- " maven {\n url \"http://4thline.org/m2\"\n }" +- " maven {\n url \"http://dl.bintray.com/lukaville/maven\"\n }" +- " maven {\n url \"https://dl.google.com/dl/android/maven2/\"\n }" +- " maven {\n url \"https://jitpack.io\"\n }" +- " maven {\n url \"https://linphone.org/maven_repository\"\n }" +- " maven {\n url \"https://maven.fabric.io/public\"\n }" +- " maven {\n url \"https://maven.google.com\"\n }" +- " maven {\n url \"https://oss.sonatype.org/content/repositories/snapshots\"\ + \n }" +- " maven {\n url \"https://repo.commonsware.com.s3.amazonaws.com\"\n }" +- " maven {\n url \"https://repo1.maven.org/maven2/\"\n }" +- " maven {\n url 'http://4thline.org/m2'\n }" +- " maven {\n url 'http://dl.bintray.com/amulyakhare/maven'\n }" +- " maven {\n url 'https://dl.bintray.com/amulyakhare/maven'\n }" +- " maven {\n url 'https://github.com/Goddchen/mvn-repo/raw/master/'\n }" +- " maven {\n url 'https://github.com/toxbee/mvn-repo/raw/master/maven-deploy'\n\ + \ }" +- " maven {\n url 'https://jitpack.io'\n }" +- " maven {\n url 'https://maven.fabric.io/public'\n }" +- " maven {\n url 'https://maven.google.com'\n // Alternative URL is\ + \ 'https://dl.google.com/dl/android/maven2/'\n url \"https://jitpack.io\"\ + \n }" +- " maven {\n url 'https://maven.google.com'\n }" +- " maven {\n url 'https://maven.google.com/'\n name 'Google'\n }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots'\n\ + \ }" +- " maven {\n url 'https://oss.sonatype.org/content/repositories/snapshots/'\n\ + \ }" +- " maven {\n url 'https://raw.github.com/nicolasjafelle/maven-repo/master/'\n\ + \ }" +- " maven {\n url 'https://raw.githubusercontent.com/felixb/mvn-repo/master'\n\ + \ }" +- " maven {\n url xwalkMavenRepo\n }" +- " maven {\n url \"https://github.com/Goddchen/mvn-repo/raw/master/\"\n }" +- " maven {\n url \"https://github.com/dahlgren/abs-aar/raw/master\"\n }" +- " maven {\n url \"https://jcenter.bintray.com\"\n }" +- " maven {\n url \"https://repo.commonsware.com.s3.amazonaws.com\"\n }" +- " maven {\n url 'http://download.crashlytics.com/maven'\n }" +- " maven {\n url 'https://maven.google.com/'\n name 'Google'\n }" +- " maven {\n url 'https://raw.github.com/ark/ark/master/releases/'\n }" +- " maven {\n url 'https://raw.github.com/iFixit/ark/master/releases/'\n }" +- " maven {\n setUrl(\"https://plugins.gradle.org/m2/\")\n }" +- " maven {\n url 'https://maven.google.com'\n }" +- ' maven { + + // url "https://jitpack.io" + + // url "https://maven-central.storage.googleapis.com" + + // url "http://repo.spring.io/plugins-release/" + + // }' +- ' maven { url "https://maven.google.com" }' +- ' maven { setUrl("https://plugins.gradle.org/m2/") }' +- ' maven { setUrl("https://www.jitpack.io") }' +- ' maven { url "http://dl.bintray.com/dasar/maven" }' +- ' maven { url "https://dl.bintray.com/bjoernq/maven" }' +- ' maven { url "https://dl.bintray.com/ligi/maven" }' +- ' maven { url "https://dl.bintray.com/lukaville/maven" }' +- ' maven { url "https://jetbrains.bintray.com/trove4j" }' +- ' maven { url "$rootDir/../node_modules/react-native/android" }' +- ' maven { url "file:${rootProject.projectDir}' +- ' maven { url "http://dl.bintray.com/amulyakhare/maven" }' +- ' maven { url "http://dl.bintray.com/arturbosch/code-analysis" }' +- ' maven { url "http://dl.bintray.com/countly/maven" }' +- ' maven { url "http://dl.bintray.com/davideas/maven" }' +- ' maven { url "http://dl.bintray.com/drummer-aidan/maven" }' +- ' maven { url "http://dl.bintray.com/drummer-aidan/maven/com/afollestad" }' +- ' maven { url "http://dl.bintray.com/lukaville/maven" }' +- ' maven { url "http://dl.bintray.com/populov/maven" }' +- ' maven { url "http://objectbox.net/beta-repo/" }' +- ' maven { url "http://repo.commonsware.com.s3.amazonaws.com" }' +- ' maven { url "http://repo.maven.apache.org/maven2" }' +- ' maven { url "https://clojars.org/repo" }' +- ' maven { url "https://clojars.org/repo/" }' +- ' maven { url "https://dl.bintray.com/android/android-tools/" }' +- ' maven { url "https://dl.bintray.com/drummer-aidan/maven" }' +- ' maven { url "https://dl.bintray.com/markusamshove/maven" }' +- ' maven { url "https://dl.bintray.com/mockito/maven/" }' +- ' maven { url "https://dl.bintray.com/osborn/Android" }' +- ' maven { url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases" + }' +- ' maven { url "https://jcenter.bintray.com" }' +- " maven { url \"https://jitpack.io\"\n }" +- ' maven { url "https://jitpack.io" }' +- ' maven { url "https://jitpack.io"}' +- ' maven { url "https://kotlin.bintray.com/kotlinx" }' +- ' maven { url "https://maven.fabric.io/public" }' +- " maven { url \"https://maven.google.com\"\n }" +- ' maven { url "https://maven.google.com" }' +- ' maven { url "https://maven.google.com"}' +- ' maven { url "https://maven.google.com/" }' +- ' maven { url "https://oss.sonatype.org/content/groups/public" }' +- ' maven { url "https://oss.sonatype.org/content/groups/public/" }' +- ' maven { url "https://oss.sonatype.org/content/repositories/releases/" }' +- ' maven { url "https://oss.sonatype.org/content/repositories/snapshots" }' +- ' maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }' +- ' maven { url "https://plugins.gradle.org/m2" }' +- ' maven { url "https://plugins.gradle.org/m2/" }' +- ' maven { url "https://plugins.gradle.org/m2/"}' +- ' maven { url "https://repo.commonsware.com.s3.amazonaws.com" }' +- ' maven { url "https://repo.commonsware.com.s3.amazonaws.com"}' +- ' maven { url "https://repo.eclipse.org/content/groups/releases" }' +- ' maven { url "https://repo.maven.apache.org/maven2" }' +- ' maven { url "https://repository.aspose.com/repo/" }' +- ' maven { url "https://s3.amazonaws.com/repo.commonsware.com" }' +- ' maven { url "https://www.jitpack.io" }' +- ' maven { url ''../../prebuilts/gradle-plugin'' }' +- ' maven { url ''../../prebuilts/tools/common/m2/internal'' }' +- ' maven { url ''../../prebuilts/tools/common/m2/repository'' }' +- ' maven { url ''file:///usr/share/maven-repo'' }' +- ' maven { url ''http://dl.bintray.com/amulyakhare/maven'' }' +- ' maven { url ''http://download.crashlytics.com/maven'' }' +- ' maven { url ''http://guardian.github.com/maven/repo-releases'' }' +- ' maven { url ''http://igniterealtime.org/repo'' }' +- ' maven { url ''http://repo1.maven.org/maven2'' }' +- ' maven { url ''http://wordpress-mobile.github.io/WordPress-Android'' }' +- ' maven { url ''https://dl.bintray.com/content/simonpoole/android'' }' +- ' maven { url ''https://dl.bintray.com/content/simonpoole/div'' }' +- ' maven { url ''https://dl.bintray.com/content/simonpoole/osm'' }' +- ' maven { url ''https://dl.bintray.com/twofortyfouram/maven'' }' +- ' maven { url ''https://dl.google.com/dl/android/maven2/'' }' +- ' maven { url ''https://guardian.github.com/maven/repo-releases'' }' +- ' maven { url ''https://igniterealtime.org/repo'' }' +- ' maven { url ''https://jitpack.io'' }' +- ' maven { url ''https://jitpack.io/'' }' +- ' maven { url ''https://maven.fabric.io/public'' }' +- ' maven { url ''https://maven.fabric.io/repo'' }' +- ' maven { url ''https://maven.google.com'' }' +- ' maven { url ''https://maven.google.com''}' +- ' maven { url ''https://maven.google.com/'' }' +- ' maven { url ''https://oss.jfrog.org/artifactory/oss-snapshot-local/'' }' +- ' maven { url ''https://oss.sonatype.org/content/repositories/snapshots'' }' +- ' maven { url ''https://oss.sonatype.org/content/repositories/snapshots/'' }' +- ' maven { url ''https://plugins.gradle.org/m2/'' }' +- ' maven { url ''https://repo1.maven.org/maven2'' /*maven-central with HTTPS*/}' +- ' maven { url ''https://repo1.maven.org/maven2'' }' +- ' maven { url ''https://repository-achartengine.forge.cloudbees.com/snapshot/'' + }' +- ' maven { url ''https://s3.amazonaws.com/repo.commonsware.com'' }' +- ' maven { url ''https://www.jitpack.io'' }' +- ' maven { url ''libs'' }' +- ' maven { url = uri("https://jitpack.io") }' +- ' maven { url = uri("https://maven.fabric.io/public") }' +- ' maven { url MAVEN_REPO_CACHE }' +- ' maven { url(''http://releases.marmeladburk.fidesmo.com/'') }' +- ' maven {url "http://dl.bintray.com/tbruyelle/tbruyelle" }' +- ' maven {url "https://clojars.org/repo/"}' +- ' maven {url "https://jitpack.io"}' +- " maven{\n url 'https://maven.fabric.io/public'\n }" +- " maven{\n url'https://plugins.gradle.org/m2/'\n }" +- " maven{\n url \"https://maven.google.com\"\n }" +- ' maven{ url "https://oss.sonatype.org/content/repositories/releases/" }' +- ' maven{ url "https://oss.sonatype.org/content/repositories/snapshots/" }' +- ' maven{ url ''https://jitpack.io'' }' +- ' maven{ url ''https://maven.aliyun.com/repository/google''}' +- ' maven{ url ''https://maven.aliyun.com/repository/gradle-plugin''}' +- ' maven{ url ''https://maven.aliyun.com/repository/jcenter''}' +- ' maven{ url ''https://maven.aliyun.com/repository/public''}' +- ' maven{url "https://jitpack.io"}' +- ' maven{url "https://plugins.gradle.org/m2/"}' diff --git a/tests/scanner.TestCase b/tests/scanner.TestCase index 4392664e..67cef2fd 100755 --- a/tests/scanner.TestCase +++ b/tests/scanner.TestCase @@ -5,10 +5,13 @@ import inspect import logging import optparse import os +import shutil import sys import tempfile import textwrap import unittest +import uuid +import yaml from unittest import mock localmodule = os.path.realpath( @@ -34,7 +37,7 @@ class ScannerTest(unittest.TestCase): os.chdir(self.basedir) def test_scan_source_files(self): - fdroidserver.scanner.options = type('', (), {})() + fdroidserver.scanner.options = mock.Mock() fdroidserver.scanner.options.json = False source_files = os.path.join(self.basedir, 'source-files') projects = { @@ -80,6 +83,109 @@ class ScannerTest(unittest.TestCase): i += 1 self.assertEqual(count, i) + def test_scan_source_files_sneaky_maven(self): + """Check for sneaking in banned maven repos""" + testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) + os.chdir(testdir) + fdroidserver.scanner.config = None + fdroidserver.scanner.options = mock.Mock() + fdroidserver.scanner.options.json = True + with open('build.gradle', 'w') as fp: + fp.write(textwrap.dedent(""" + maven { + "https://jitpack.io" + url 'https://maven.fabric.io/public' + } + maven { + "https://maven.google.com" + setUrl('https://evilcorp.com/maven') + } + """)) + count = fdroidserver.scanner.scan_source(testdir) + self.assertEqual(2, count, 'there should be this many errors') + + def test_scan_source_file_types(self): + """Build product files are not allowed, test they are detected""" + testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) + os.chdir(testdir) + + fdroidserver.scanner.config = None + fdroidserver.scanner.options = mock.Mock() + fdroidserver.scanner.options.json = True + + keep = [ + 'arg.jar', + 'ascii.out', + 'baz.so', + 'classes.dex', + 'sqlcipher.aar', + 'static.a', + 'src/test/resources/classes.dex', + ] + remove = [ + 'gradle-wrapper.jar', + 'gradlew', + 'gradlew.bat', + ] + os.makedirs('src/test/resources', exist_ok=True) + for f in keep + remove: + with open(f, 'w') as fp: + fp.write('placeholder') + self.assertTrue(os.path.exists(f)) + binaries = [ + 'binary.out', + 'fake.png', + 'snippet.png', + ] + with open('binary.out', 'wb') as fp: + fp.write(b'\x00\x00') + fp.write(uuid.uuid4().bytes) + shutil.copyfile('binary.out', 'fake.png') + os.chmod('fake.png', 0o755) + os.system('ls -l binary.out') + with open('snippet.png', 'wb') as fp: + fp.write(b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x000\x00\x00' + b'\x000\x08\x06\x00\x00\x00W\x02\xf9\x87\x00\x00\x00\x04sB' + b'IT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00\tpHYs\x00\x00\n' + b'a\x00\x00\na\x01\xfc\xccJ%\x00\x00\x00\x19tEXtSoftware') + os.chmod('snippet.png', 0o755) + os.system('ls -l fake.png') + + count = fdroidserver.scanner.scan_source(testdir) + self.assertEqual(6, count, 'there should be this many errors') + + for f in keep + binaries: + self.assertTrue(os.path.exists(f), f + ' should still be there') + for f in remove: + self.assertFalse(os.path.exists(f), f + ' should have been removed') + + files = dict() + for section in ('errors', 'infos', 'warnings'): + files[section] = [] + for msg, f in fdroidserver.scanner.json_per_build[section]: + files[section].append(f) + + self.assertFalse('ascii.out' in files['errors'], + 'an ASCII .out file is not an error') + self.assertFalse('snippet.png' in files['errors'], + 'an executable valid image is not an error') + + self.assertTrue('arg.jar' in files['errors'], 'all JAR files are errors') + self.assertTrue('baz.so' in files['errors'], 'all .so files are errors') + self.assertTrue('binary.out' in files['errors'], 'a binary .out file is an error') + self.assertTrue('classes.dex' in files['errors'], 'all classes.dex files are errors') + self.assertTrue('sqlcipher.aar' in files['errors'], 'all AAR files are errors') + self.assertTrue('static.a' in files['errors'], 'all .a files are errors') + + self.assertTrue('fake.png' in files['warnings'], + 'a random binary that is executable that is not an image is a warning') + self.assertTrue('src/test/resources/classes.dex' in files['warnings'], + 'suspicious file but in a test dir is a warning') + + for f in remove: + self.assertTrue(f in files['infos'], + f + ' should be removed with an info message') + def test_build_local_scanner(self): """`fdroid build` calls scanner functions, test them here""" testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir) @@ -99,7 +205,7 @@ class ScannerTest(unittest.TestCase): build = fdroidserver.metadata.Build() build.commit = '1.0' build.output = app.id + '.apk' - build.scanignore = ['baz.so'] + build.scanignore = ['baz.so', 'foo.aar'] build.versionCode = '1' build.versionName = '1.0' vcs = mock.Mock() @@ -137,6 +243,20 @@ class ScannerTest(unittest.TestCase): self.assertTrue(os.path.exists('foo.aar')) self.assertFalse(os.path.exists('gradle-wrapper.jar')) + def test_gradle_maven_url_regex(self): + """Check the regex can find all the cases""" + with open(os.path.join(self.basedir, 'gradle-maven-blocks.yaml')) as fp: + data = yaml.safe_load(fp) + + urls = [] + for entry in data: + found = False + for m in fdroidserver.scanner.MAVEN_URL_REGEX.findall(entry): + urls.append(m) + found = True + self.assertTrue(found, 'this block should produce a URL:\n' + entry) + self.assertEqual(len(data), len(urls), 'each data example should produce a URL') + if __name__ == "__main__": os.chdir(os.path.dirname(__file__))