diff --git a/.github/workflows/gradle-plugin-lint.yml b/.github/workflows/gradle-plugin-lint.yml new file mode 100644 index 00000000..d7cf46d9 --- /dev/null +++ b/.github/workflows/gradle-plugin-lint.yml @@ -0,0 +1,43 @@ +name: ktlint and detekt + +on: + push: + branches: [ "main" ] + pull_request: + branches: [main] + +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 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") }