Skip to content

Commit

Permalink
Add 3pp files for org_checkerframework_checker_util.
Browse files Browse the repository at this point in the history
Needed by downstream guava target. I think we could also try to fine tune the filter as the file is probably getting eaten by it. https://critique.corp.google.com/cl/477290627/depot/google3/chrome/android/autoroll/build/generate_trimmed_jar.bzl

Bug: 1340593
Change-Id: I906a4c14ad1bbc2d3cf8456c01d83b537b30eded
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3925475
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Benjamin Joyce (Ben) <bjoyce@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1052845}
  • Loading branch information
Ben Joyce authored and Chromium LUCI CQ committed Sep 29, 2022
1 parent c6bc453 commit 562ddfb
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 0 deletions.
8 changes: 8 additions & 0 deletions third_party/android_deps/BUILD.gn
Expand Up @@ -1365,6 +1365,14 @@ if (!limit_android_deps) {
testonly = true
}

# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("org_checkerframework_checker_util_java") {
jar_path = "libs/org_checkerframework_checker_util/checker-util-3.22.1.jar"
output_name = "org_checkerframework_checker_util"
supports_android = true
deps = [ ":org_checkerframework_checker_qual_java" ]
}

# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("org_codehaus_mojo_animal_sniffer_annotations_java") {
jar_path = "libs/org_codehaus_mojo_animal_sniffer_annotations/animal-sniffer-annotations-1.17.jar"
Expand Down
1 change: 1 addition & 0 deletions third_party/android_deps/additional_readme_paths.json
Expand Up @@ -121,6 +121,7 @@
"libs/org_ccil_cowan_tagsoup_tagsoup",
"libs/org_checkerframework_checker_compat_qual",
"libs/org_checkerframework_checker_qual",
"libs/org_checkerframework_checker_util",
"libs/org_checkerframework_dataflow_errorprone",
"libs/org_codehaus_mojo_animal_sniffer_annotations",
"libs/org_eclipse_jgit_org_eclipse_jgit",
Expand Down
1 change: 1 addition & 0 deletions third_party/android_deps/build.gradle
Expand Up @@ -145,6 +145,7 @@ dependencies {
// Used by downstream targets.
compile "com.google.errorprone:error_prone_annotations:${errorproneVersion}"
compile 'org.checkerframework:checker-compat-qual:2.5.3'
compile 'org.checkerframework:checker-util:3.22.1'
compile 'org.codehaus.mojo:animal-sniffer-annotations:1.17'

// Dedicated configuration to avoid using higher version number. The 9999 version is empty.
Expand Down
Expand Up @@ -170,6 +170,9 @@ class ChromiumDepGraph {
org_checkerframework_checker_qual: new PropertyOverride(
licenseUrl: 'https://raw.githubusercontent.com/typetools/checker-framework/master/LICENSE.txt',
licenseName: 'GPL v2 with the classpath exception'),
org_checkerframework_checker_util: new PropertyOverride(
licenseUrl: 'https://raw.githubusercontent.com/typetools/checker-framework/master/checker-util/LICENSE.txt',
licenseName: 'MIT'),
org_checkerframework_dataflow_errorprone: new PropertyOverride(
licenseUrl: 'https://raw.githubusercontent.com/typetools/checker-framework/master/LICENSE.txt',
licenseName: 'GPL v2 with the classpath exception'),
Expand Down
@@ -0,0 +1,16 @@
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.

create {
source {
script { name: "fetch.py" }
}
}

upload {
pkg_prefix: "chromium/third_party/android_deps/libs"
universal: true
}
@@ -0,0 +1,78 @@
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.

import argparse
import json
import os
import re
import urllib.request

_REPO_URL = 'https://repo.maven.apache.org/maven2'
_GROUP_NAME = 'org/checkerframework'
_MODULE_NAME = 'checker-util'
_FILE_EXT = 'jar'
_OVERRIDE_LATEST = None
_PATCH_VERSION = 'cr1'


def do_latest():
if _OVERRIDE_LATEST is not None:
print(_OVERRIDE_LATEST + f'.{_PATCH_VERSION}')
return
maven_metadata_url = '{}/{}/{}/maven-metadata.xml'.format(
_REPO_URL, _GROUP_NAME, _MODULE_NAME)
metadata = urllib.request.urlopen(maven_metadata_url).read().decode(
'utf-8')
# Do not parse xml with the python included parser since it is susceptible
# to maliciously crafted xmls. Only use regular expression parsing to be
# safe. RE should be enough to handle what we need to extract.
match = re.search('<latest>([^<]+)</latest>', metadata)
if match:
latest = match.group(1)
else:
# if no latest info was found just hope the versions are sorted and the
# last one is the latest (as is commonly the case).
latest = re.findall('<version>([^<]+)</version>', metadata)[-1]
print(latest + f'.{_PATCH_VERSION}')


def get_download_url(version):
# Remove the patch version when getting the download url
version_no_patch, patch = version.rsplit('.', 1)
if patch.startswith('cr'):
version = version_no_patch
file_url = '{0}/{1}/{2}/{3}/{2}-{3}.{4}'.format(_REPO_URL, _GROUP_NAME,
_MODULE_NAME, version,
_FILE_EXT)
file_name = file_url.rsplit('/', 1)[-1]

partial_manifest = {
'url': [file_url],
'name': [file_name],
'ext': '.' + _FILE_EXT,
}
print(json.dumps(partial_manifest))


def main():
ap = argparse.ArgumentParser()
sub = ap.add_subparsers()

latest = sub.add_parser('latest')
latest.set_defaults(func=lambda _opts: do_latest())

download = sub.add_parser('get_url')
download.set_defaults(
func=lambda _opts: get_download_url(os.environ['_3PP_VERSION']))

opts = ap.parse_args()
opts.func(opts)


if __name__ == '__main__':
main()
@@ -0,0 +1,22 @@
Checker Framework utilities
Copyright 2004-present by the Checker Framework developers

MIT License:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1 @@
file://third_party/android_deps/OWNERS
@@ -0,0 +1,14 @@
Name: Checker Util
Short Name: checker-util
URL: https://checkerframework.org
Version: 3.22.1
License: MIT
License File: LICENSE
CPEPrefix: unknown
Security Critical: yes

Description:
checker-util contains utility classes for programmers to use at run time.

Local Modifications:
No modifications.
@@ -0,0 +1,10 @@
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# To create CIPD package run the following command.
# cipd create --pkg-def cipd.yaml -tag version:2@3.22.1.cr1
package: chromium/third_party/android_deps/libs/org_checkerframework_checker_util
description: "Checker Util"
data:
- file: checker-util-3.22.1.jar

0 comments on commit 562ddfb

Please sign in to comment.