Skip to content

Commit

Permalink
Fix #3285: Create Kotlin script to compile list of maven dependencies…
Browse files Browse the repository at this point in the history
… and license links (#3434)

* Generate maven_install.json

* Add fail_if_repin_required attribute

* Update rules_jvm_external version in versions.bzl and use fail_if_repin_required attribute in maven_install()

* Fix bazel lint error.

* Update code ownership for maven_install.json

* Fix #3290: Add support for generic regex pattern matching

* Apply review suggestions for proto location

* Delete main directory

* Implment script logic and tests

* CI setup part 1

* syntax fix in yaml file

* import nits in dummy file

* Use regex patterns from script in script test

* Make PR suggestions into effect

* Make PR suggestions into effect

* Make PR suggestions into effect

* Improve naming of script_assets variables

* Make PR suggestions into effect

* Create maven_dependencies_list.kts and complete the parsing of the maven_install.json

* Make PR suggestions

* Make PR suggestions

* Improve naming in script and add KDocs for data classes.

* Add EOF for all classes.

* Change data structure to store backup dependencies.

* Revamp testing approach

* nit fixes

* Add maven re-pin command.

* Add BUILD.bazel file and Test file for script.creatre-script-to-compile-list-of-maven-dependencies

* Fix test build error.

* Improve code.

* Make nit suggestions

* Try changing location of maven_install.json

* Convert .kts to .kt

* Save work.

* Rename data classes.

* Remove kscript.

* Fix lints.

* Apply review suggestions on PR

* Refactor PR as per feedback recieved

* Implement review suggestions

* Set different output_base for bazel query command

* nits

* Nit fixes

* nit fix

* Change maven_install_json attribute

* Move maven_install.json to third_party

* Remove maven_install code ownership from CODEOWNERS

* Save changes.

* remove class

* Fix errors

* Review suggestions part 1

* Implement review suggestions part 2

* Fix broken script

* nit fixes

* update static_checks

* add test to repository file

* nit fix

* nit fix

* Validate all Links.

* nit fix

* Implement review suggestions

* bazel files nit fix

* Introduce a library for the regex assets

* Change structure of the script.

* Make directory structure same as that of #3374

* diable ktlint max-line-length

* disable ktlint-max-line

* disable ktlint max-length

* save changes.

* commit

* nit fix

* Add bazel pipeline to app module

* save.

* save.

* save.

* save.

* save.

* save.

* nit fix

* fix broken script

* Fix bug of printing enum values in output.

* Fix bug of printing enum values in output.

* Apply review suggestions

* ktlint fix

* nit fix

* Remove script constants

* nit fix

* Make script to call out the dependencies and licenses for which manual work needs to be completed.

* add todo

* Complete first script

* Add first script to scripts package

* Remove unwanted files

* Remove extra files and fix formatting

* Fix lints.

* Remove unnecessary lines of code

* Add comments for proto

* Add test file.

* Fix lints.

* Remove unwanted dependencies.

* Add suggested changes.

* nit fixes

* Fix lint.

* add testOnly

* Fix nits

* Add suggested changes.

* Add suggested changes

* Update textproto

* Update maven_dependencies.textproto

* Always force https over http

* Always force https over http

* Correct origin type

* Use common/BazelClient

* Fix lints

* Save progress

* create test_maven_install.json

* Restructure script

* Break script in two parts

* Add DependencyListsProvider

* Add DependencyListsProvider

* correct query command

* Correct structure of the script

* Correct structure of the script

* Fix not suggestions

* Use

* Add test file for NetworkAndBazelUtilsImpl.kt

* Add KDocs

* Add KDocs

* try using mockito

* Add test case in BazelClientTest.kt

* Add mockito-kotlin

* Fix nit

* Fix nit

* try fixing tests

* Restructure maven_dependencies.proto

* Fix lint

* add --max_idle_secs

* Fix nits

* Fix nit

* Place KDoc at correct position

* Fix BazelClientTest.kt

* Add xml parser

* Fix pb error

* Revert data module changes

* Add tests

* Add first test that passes

* Add all test cases.

* Fix nit

* Add suggested changes

* Add suggested changes

* Add suggested changes

* Nit changes

* Fix nits

* Fix BazelClient test case

* Add test cases for TestBazelWorkspace

* Add suggested changes

* Add suggested changes

* Fix one test.

* Fix all test cases

* Add TODO for issue #3486

* Add suggestions.

* Fix urls.

* Fix isFalse

* Add all suggested changes.

* Fix nits.

Co-authored-by: Sparsh1212 <[email protected]>
  • Loading branch information
prayutsu and Sparsh1212 authored Jul 16, 2021
1 parent f5fc3d0 commit 63d03f1
Show file tree
Hide file tree
Showing 23 changed files with 2,742 additions and 108 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ dependencies {
)
// Adding the testing module directly causes duplicates of the below groups so we need to
// exclude them before adding the testing module to the androidTestImplementation dependencies
androidTestImplementation (project(":testing")) {
androidTestImplementation(project(":testing")) {
exclude group: 'org.apache.maven', module: 'maven-artifact'
exclude group: 'org.apache.maven', module: 'maven-artifact-manager'
exclude group: 'org.apache.maven', module: 'maven-model'
Expand Down
29 changes: 23 additions & 6 deletions scripts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Kotlin-based scripts to help developers or perform continuous integration tasks.
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_binary", "kt_jvm_library")
load(
"//scripts:script_assets.bzl",
"generate_maven_assets_list_from_text_protos",
"generate_regex_assets_list_from_text_protos",
"generate_test_file_assets_list_from_text_protos",
)
Expand Down Expand Up @@ -34,18 +35,14 @@ package_group(
includes = [
":oppia_script_test_visibility",
],
packages = [
"//scripts/src/java/...",
],
packages = ["//scripts/src/java/..."],
)

kt_jvm_binary(
name = "compute_affected_tests",
testonly = True,
main_class = "org.oppia.android.scripts.ci.ComputeAffectedTestsKt",
runtime_deps = [
"//scripts/src/java/org/oppia/android/scripts/ci:compute_affected_tests_lib",
],
runtime_deps = ["//scripts/src/java/org/oppia/android/scripts/ci:compute_affected_tests_lib"],
)

# TODO(#3428): Refactor textproto assets to subpackage level.
Expand All @@ -55,6 +52,11 @@ REGEX_PATTERN_CHECK_ASSETS = generate_regex_assets_list_from_text_protos(
filepath_pattern_validation_file_names = ["filename_pattern_validation_checks"],
)

MAVEN_ASSETS = generate_maven_assets_list_from_text_protos(
name = "maven_assets",
maven_dependency_filenames = ["maven_dependencies"],
)

kt_jvm_library(
name = "regex_check_assets",
testonly = True,
Expand Down Expand Up @@ -98,3 +100,18 @@ kt_jvm_binary(
main_class = "org.oppia.android.scripts.testfile.TestFileCheckKt",
runtime_deps = ["//scripts/src/java/org/oppia/android/scripts/testfile:test_file_check_lib"],
)

kt_jvm_library(
name = "maven_assets_lib",
testonly = True,
data = MAVEN_ASSETS,
visibility = [":oppia_script_test_visibility"],
)

kt_jvm_binary(
name = "generate_maven_dependencies_list",
testonly = True,
data = MAVEN_ASSETS,
main_class = "org.oppia.android.scripts.maven.GenerateMavenDependenciesListKt",
runtime_deps = ["//scripts/src/java/org/oppia/android/scripts/maven:generate_maven_dependencies_list_lib"],
)
Loading

0 comments on commit 63d03f1

Please sign in to comment.