Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .buildkite/commands/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,20 @@ fi

"$(dirname "${BASH_SOURCE[0]}")/restore-cache.sh"

echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :globe_with_meridians: Check Locales Declaration Consistency"
bundle exec fastlane check_declared_locales_consistency app:"$1"

echo "--- :microscope: Linting"

if [ "$1" = "wordpress" ]; then
./gradlew lintWordpressVanillaRelease
./gradlew lintWordpressVanillaDebug
exit 0
fi

if [ "$1" = "jetpack" ]; then
set +e
./gradlew lintJetpackVanillaRelease
./gradlew lintJetpackVanillaDebug
lint_exit_code=$?
set -e

upload_sarif_to_github "WordPress/build/reports/lint-results-jetpackVanillaRelease.sarif"
upload_sarif_to_github "WordPress/build/reports/lint-results-jetpackVanillaDebug.sarif"
exit $lint_exit_code
fi

Expand Down
41 changes: 41 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ steps:
artifact_paths:
- "**/build/reports/detekt/detekt.html"

- label: "🌐 Locale Consistency"
command: |
if .buildkite/commands/should-skip-job.sh --job-type validation; then
exit 0
fi

install_gems
bundle exec fastlane check_declared_locales_consistency app:wordpress
bundle exec fastlane check_declared_locales_consistency app:jetpack
plugins: [$CI_TOOLKIT]

- label: "🕵️ Lint WordPress"
command: ".buildkite/commands/lint.sh wordpress"
plugins: [$CI_TOOLKIT]
Expand All @@ -71,6 +82,36 @@ steps:
artifact_paths:
- "**/build/reports/lint-results*.*"

- label: "🕵️ Lint libs:editor"
command: |
if .buildkite/commands/should-skip-job.sh --job-type lint; then
exit 0
fi

.buildkite/commands/restore-cache.sh
./gradlew :libs:editor:lint
plugins: [$CI_TOOLKIT]

- label: "🕵️ Lint libs:login"
command: |
if .buildkite/commands/should-skip-job.sh --job-type lint; then
exit 0
fi

.buildkite/commands/restore-cache.sh
./gradlew :libs:login:lint
plugins: [$CI_TOOLKIT]

- label: "🕵️ Lint libs:image-editor"
command: |
if .buildkite/commands/should-skip-job.sh --job-type lint; then
exit 0
fi

.buildkite/commands/restore-cache.sh
./gradlew :libs:image-editor:lint
plugins: [$CI_TOOLKIT]

#################
# Diff Reports
#################
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ subprojects {
android {
lintOptions {
warningsAsErrors = true
checkDependencies true
checkDependencies false
checkGeneratedSources = true
lintConfig file("${project.rootDir}/config/lint/lint.xml")
baseline file("${project.rootDir}/config/lint/baseline.xml")
Expand Down
8 changes: 8 additions & 0 deletions config/lint/lint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
<!-- EDITOR -->
<ignore path="**/libs/editor/src/main/res/drawable/**" /> <!-- 9 errors -->
<ignore path="**/libs/editor/src/main/res/drawable-hdpi/**" /> <!-- 6 errors -->
<!-- Resources used by editor/login libraries (not visible with checkDependencies=false) -->
<ignore path="**/res/color/aztec_format_button_selector_color.xml" />
<ignore path="**/res/color/primary_on_surface_disabled_selector.xml" />
<ignore path="**/res/values-night/colors_aztec.xml" />
<ignore regexp="R\.style\.FormatBarButton" />
<ignore regexp="R\.style\.DividerSourceView" />
<ignore regexp="R\.style\.Widget_LoginFlow_Toolbar" />
<ignore regexp="R\.dimen\.promo_indicator_bullet_size" />
<!-- GOOGLE SERVICES -->
<ignore path="**/generated/res/google-services/**/values/values.xml" />
<ignore path="**/xml/global_tracker.xml" />
Expand Down
8 changes: 3 additions & 5 deletions fastlane/lanes/localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,9 @@
JETPACK_MAIN_STRINGS_PATH = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'src', 'jetpack', 'res', 'values', 'strings.xml').freeze
JETPACK_FROZEN_STRINGS_DIR_PATH = File.join(FASTLANE_FOLDER, 'jetpack_resources', 'values').freeze
LOCAL_LIBRARIES_STRINGS_PATHS = [
# NOTE: for those we don't set `add_ignore_attr` to true because we currently use `checkDependencies true` in `WordPress/build.gradle`
# Which will correctly detect strings from the app's `strings.xml` being used by one of the module.
{ library: 'Image Editor', strings_path: './libs/image-editor/src/main/res/values/strings.xml', source_id: 'module:image-editor' },
{ library: 'Editor', strings_path: './libs/editor/src/main/res/values/strings.xml', source_id: 'module:editor' },
{ library: 'Login Library', strings_path: './libs/login/src/main/res/values/strings.xml', source_id: 'module:login' }
{ library: 'Image Editor', strings_path: './libs/image-editor/src/main/res/values/strings.xml', source_id: 'module:image-editor', add_ignore_attr: true },
{ library: 'Editor', strings_path: './libs/editor/src/main/res/values/strings.xml', source_id: 'module:editor', add_ignore_attr: true },
{ library: 'Login Library', strings_path: './libs/login/src/main/res/values/strings.xml', source_id: 'module:login', add_ignore_attr: true }
].freeze
REMOTE_LIBRARIES_STRINGS_PATHS = [
{
Expand Down