From d129a3a9786fd3d382f4461a52eaf6629146cfa9 Mon Sep 17 00:00:00 2001 From: Hur Ali Date: Tue, 2 Dec 2025 21:04:32 +0500 Subject: [PATCH 1/4] chore: add CI for running ktlint and detekt for brownfield-gradle-plugin --- .github/workflows/gradle-plugin-lint.yml | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/gradle-plugin-lint.yml diff --git a/.github/workflows/gradle-plugin-lint.yml b/.github/workflows/gradle-plugin-lint.yml new file mode 100644 index 00000000..2c17d7e9 --- /dev/null +++ b/.github/workflows/gradle-plugin-lint.yml @@ -0,0 +1,46 @@ +name: ktlint and detekt + +on: + push: + branches: [ "main" ] + paths: + - "gradle-plugins/react/**" + pull_request: + paths: + - "gradle-plugins/react/**" + +jobs: + lint: + name: Run Detekt & KtLint + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v2 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Run Detekt + working-directory: gradle-plugins/react + run: ./gradlew :brownfield:detekt --no-daemon --stacktrace + + - name: Run KtLint + working-directory: gradle-plugins/react + run: ./gradlew :brownfield:ktlintCheck --no-daemon --stacktrace From edd5f6f2a6e6cecac12243f6d00460113038f224 Mon Sep 17 00:00:00 2001 From: Hur Ali Date: Tue, 2 Dec 2025 21:09:55 +0500 Subject: [PATCH 2/4] chore: update path --- .github/workflows/gradle-plugin-lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle-plugin-lint.yml b/.github/workflows/gradle-plugin-lint.yml index 2c17d7e9..6aa28978 100644 --- a/.github/workflows/gradle-plugin-lint.yml +++ b/.github/workflows/gradle-plugin-lint.yml @@ -4,10 +4,10 @@ on: push: branches: [ "main" ] paths: - - "gradle-plugins/react/**" + - "react-native-brownfield/gradle-plugins/react/**" pull_request: paths: - - "gradle-plugins/react/**" + - "react-native-brownfield/gradle-plugins/react/**" jobs: lint: From 0550d1159a88919fae501de7af2823ddb5bda18b Mon Sep 17 00:00:00 2001 From: Hur Ali Date: Tue, 2 Dec 2025 21:10:44 +0500 Subject: [PATCH 3/4] chore: update path --- .github/workflows/gradle-plugin-lint.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/gradle-plugin-lint.yml b/.github/workflows/gradle-plugin-lint.yml index 6aa28978..d7cf46d9 100644 --- a/.github/workflows/gradle-plugin-lint.yml +++ b/.github/workflows/gradle-plugin-lint.yml @@ -3,11 +3,8 @@ name: ktlint and detekt on: push: branches: [ "main" ] - paths: - - "react-native-brownfield/gradle-plugins/react/**" pull_request: - paths: - - "react-native-brownfield/gradle-plugins/react/**" + branches: [main] jobs: lint: From a9988147113d81675099ed018c74660f840ef495 Mon Sep 17 00:00:00 2001 From: Hur Ali Date: Tue, 2 Dec 2025 21:15:28 +0500 Subject: [PATCH 4/4] fix: ktlint check feedback --- .../com/callstack/react/brownfield/plugin/RNSourceSets.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt b/gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt index 6f5ed274..69ca5c67 100644 --- a/gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt +++ b/gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield/plugin/RNSourceSets.kt @@ -46,10 +46,12 @@ object RNSourceSets { private fun configureSourceSets() { androidExtension.sourceSets.getByName("main") { sourceSet -> for (bundlePathSegment in listOf( - "createBundleReleaseJsAndAssets", // outputs for RN <= 0.81 - "react/release" // outputs for RN >= 0.82 + // outputs for RN <= 0.81 + "createBundleReleaseJsAndAssets", + // outputs for RN >= 0.82 + "react/release", )) { - sourceSet.assets.srcDirs("${appBuildDir}/generated/assets/$bundlePathSegment") + sourceSet.assets.srcDirs("$appBuildDir/generated/assets/$bundlePathSegment") sourceSet.res.srcDirs("$appBuildDir/generated/res/$bundlePathSegment") }