diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 4a170910..bb8e3b8a 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,7 +1,7 @@ --- name: Bug Report about: Report any issues regarding the project and help us identify bugs quicker - +labels: ["bug"] --- # Issue Guidelines @@ -11,41 +11,11 @@ Before opening a new issue, please take a moment to review our [**community guid **You may find an answer in already closed issues**: https://github.com/AniTrend/retrofit-graphql/issues?q=is%3Aissue+is%3Aclosed - ## Description Of Bug - - -__Requests__ not working when using `.gql` files. - -**Steps To Reproduce** -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - - -## Expected Behavior - - -Perhaps it would be best if anime/manga titles are not truncated - - -## Screenshots/Videos - - - -## Device & Build Information - - -* OS Version: Lollipop 5.0.1 -* App Version: 1.2.0 -* Phone Model: Xperia SP -* Phone Brand: Sony + +## Expected Behaviour + ## Additional Context - -I have tested with multiple devices and the issue doesn't seem to be bound to any specific device, OS version or form factor. - -I have tested with ...... diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 00000000..c6dbe014 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: 🗣 Ask a Question, Discuss + url: https://github.com/anitrend/retrofit-graphql/discussions + about: General discussion, suggest ideas, share concepts or resources or ask questions, like "How does this work 🤔?" + - name: 🤗 Support the Project + url: https://patreon.com/wax911 + about: Support the AniTrend financially. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index bbe04ddb..92296a22 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -1,7 +1,7 @@ --- name: Feature Request about: Got a suggestion? Then this is what you should use - +labels: ["feature request"] --- # Issue Guidelines @@ -11,21 +11,8 @@ Before opening a new issue, please take a moment to review our [**community guid **You may find an answer in already closed issues**: https://github.com/AniTrend/retrofit-graphql/issues?q=is%3Aissue+is%3Aclosed - ## Feature Information -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - - ## Solution Information - -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - - -## Additional context -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 01cc56b0..209b01d7 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,7 +1,7 @@ --- name: Question about: Ask any general question regarding the project, also if you use this if you don't know what category to use - +labels: ["question"] --- # Issue Guidelines @@ -13,9 +13,6 @@ https://github.com/AniTrend/retrofit-graphql/issues?q=is%3Aissue+is%3Aclosed ## Question -I would like to know if... I have also searched in the closed issues and... ## Additional Context - -I am currently using... diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 351ab34d..aeee8447 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ # Pull Request Template -Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/AniTrend/retrofit-graphql/blob/master/CONTRIBUTING.md) +Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/AniTrend/retrofit-graphql/blob/develop/CONTRIBUTING.md) to make the process easy and effective for everyone involved. **Please open an issue** before embarking on any significant pull request, especially those that @@ -11,36 +11,25 @@ Before opening a pull request, please ensure: -- [ ] You have followed our [**contributing guidelines**](https://github.com/AniTrend/retrofit-graphql/blob/master/CONTRIBUTING.md) -- [ ] double-check your branch is based on `develop` and targets `develop` -- [ ] Pull request has tests -- [ ] Code is well-commented, linted and follows project conventions -- [ ] Documentation is updated (if necessary) -- [ ] Description explains the issue/use-case resolved -- [ ] I did not commit files that are excluded in the .gitignore file (Happens if you stage files with Android Studio) +- You have followed our [**contributing guidelines**](https://github.com/AniTrend/retrofit-graphql/blob/develop/CONTRIBUTING.md) +- Double-check your branch is based on `develop` and targets `develop` (where applicable) +- Pull request has tests (If applicable) +- Code is well-commented, linted and follows project conventions +- Documentation is updated (if necessary) +- Description explains the issue/use-case resolved ## Description -## Motivation and Context - - - -## How Has This Been Tested? - - - - -## Screenshots (if appropriate): ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Enhancement (Improve existing functionality) **IMPORTANT**: By submitting a patch, you agree to allow the project -owners to license your work under the terms of the [Apache License](https://github.com/AniTrend/retrofit-graphql/blob/master/LICENSE.md). +owners to license your work under the terms of the [Apache License](https://github.com/AniTrend/retrofit-graphql/blob/develop/LICENSE). diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 543663d3..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: 2 -updates: -- package-ecosystem: gradle - directory: "/" - schedule: - interval: monthly - time: "03:00" - timezone: Africa/Johannesburg - open-pull-requests-limit: 12 - target-branch: develop - reviewers: - - wax911 - ignore: - - dependency-name: com.squareup.okhttp3:logging-interceptor - versions: - - "> 3.12.1" - - dependency-name: com.squareup.okhttp3:logging-interceptor - versions: - - ">= 3.12.3.a, < 3.12.4" - - dependency-name: com.squareup.okhttp3:logging-interceptor - versions: - - ">= 3.13.a, < 3.14" - - dependency-name: com.squareup.okhttp3:logging-interceptor - versions: - - ">= 3.14.a, < 3.15" - - dependency-name: com.squareup.okhttp3:logging-interceptor - versions: - - ">= 4.a, < 5" - - dependency-name: com.squareup.retrofit2:converter-gson - versions: - - "> 2.6.2, < 3" - - dependency-name: com.squareup.retrofit2:retrofit - versions: - - "> 2.6.2, < 3" diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml new file mode 100644 index 00000000..a197d694 --- /dev/null +++ b/.github/release-drafter-config.yml @@ -0,0 +1,71 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: '$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + collapse-after: 5 + - title: '✨ Improvements' + labels: + - 'enhancement' + collapse-after: 5 + - title: '🛠️ Bug Fixes' + labels: + - 'bug fix' + collapse-after: 5 + - title: '🧰 Maintenance' + labels: + - 'refactor' + collapse-after: 5 + - title: '📦 Dependencies' + labels: + - 'dependencies' + collapse-after: 5 + - title: '🔖 Other changes' +autolabeler: + - label: 'docs' + files: + - '*.md' + branch: + - '/docs{0,1}\/.+/' + - label: 'bug fix' + branch: + - '/bugfix\/.+/' + - '/hotfix\/.+/' + - label: 'feature' + branch: + - '/feature\/.+/' + - label: 'enhancement' + branch: + - '/enhancement\/.+/' + - label: 'refactor' + branch: + - '/refactor\/.+/' + - label: 'dependencies' + branch: + - '/dependencies\/.+/' + - '/renovate\/.+/' +change-template: '- $TITLE by @$AUTHOR in #$NUMBER' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'breaking' + minor: + labels: + - 'enhancement' + - 'feature' + patch: + labels: + - 'bug fix' + - 'dependencies' + - 'refactor' + default: patch +exclude-labels: + - 'skip-changelog' +template: | + # What's Changed + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 00000000..7a1cd0bc --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,85 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ], + "branchPrefix": "dependencies/", + "reviewers": ["wax911"], + "baseBranches": [ + "develop" + ], + "packageRules": [ + { + "groupName": "Sample Module Dependencies", + "packagePatterns": [ + "^androidx\\.activity", + "^androidx\\.fragment", + "^androidx\\.core", + "^androidx\\.constraintlayout", + "^androidx\\.swiperefreshlayout", + "^androidx\\.preference", + "^androidx\\.recyclerview", + "^com\\.google\\.android\\.material", + "^io\\.coil-kt", + "^com\\.github\\.anitrend\\.support-arch", + "^com\\.jakewharton\\.threetenabp", + "^com\\.jakewharton\\.timber" + ], + "matchPaths": [ + "sample/**" + ] + }, + { + "groupName": "Room Dependencies", + "packagePatterns": [ + "^androidx\\.room" + ], + "matchPaths": [ + "sample/**" + ] + }, + { + "groupName": "Paging Dependencies", + "packagePatterns": [ + "^androidx\\.paging" + ], + "matchPaths": [ + "sample/**" + ] + }, + { + "groupName": "Kotlinx Serialization", + "packagePatterns": [ + "^org\\.jetbrains\\.kotlinx\\.serialization" + ], + "matchPaths": [ + "sample/**" + ] + }, + { + "groupName": "Koin Dependencies", + "packagePatterns": [ + "^org\\.koin" + ], + "matchPaths": [ + "sample/**" + ] + }, + { + "groupName": "Testing Dependencies", + "packagePatterns": [ + "^junit", + "^io\\.mockk", + "^androidx\\.test", + "^androidx\\.test\\.espresso", + "^androidx\\.test\\.ext" + ] + }, + { + "groupName": "Jetbrains Dependencies", + "packagePatterns": [ + "^org\\.jetbrains\\.kotlin" + ] + } + ] +} diff --git a/.github/workflows/android-spotless.yml b/.github/workflows/android-spotless.yml index 93a50da0..eb30b54a 100644 --- a/.github/workflows/android-spotless.yml +++ b/.github/workflows/android-spotless.yml @@ -1,26 +1,25 @@ -name: Run spotless check +name: android-spotless -on: +on: push: branches: [ develop ] pull_request: branches: - - develop + - '*' jobs: - build: - + android-spotless: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Run spotless check - run: ./gradlew library:spotlessCheck + - uses: actions/checkout@v4 + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'adopt' + - name: Setup Gradle + uses: gradle/gradle-build-action@v3 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Run spotless check + run: ./gradlew spotlessCheck diff --git a/.github/workflows/android-test.yml b/.github/workflows/android-test.yml index 72646ae0..03ea2e6f 100644 --- a/.github/workflows/android-test.yml +++ b/.github/workflows/android-test.yml @@ -1,6 +1,6 @@ -name: Run unit tests +name: android-unit-test -on: +on: push: branches: [ develop ] pull_request: @@ -8,19 +8,23 @@ on: - develop jobs: - build: - + android-unit-test: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Run tests - run: ./gradlew library:test + - uses: actions/checkout@v4 + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'adopt' + - name: Setup Gradle + uses: gradle/gradle-build-action@v3 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Run tests + run: ./gradlew test + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: always() # always run even if the previous step fails + with: + report_paths: '**/build/test-results/**/TEST-*.xml' diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml new file mode 100644 index 00000000..7d9888a4 --- /dev/null +++ b/.github/workflows/auto-approve.yml @@ -0,0 +1,10 @@ +name: auto-approve +on: pull_request_target + +jobs: + build: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: hmarr/auto-approve-action@v3 diff --git a/.github/workflows/first-contribution-greeting.yaml b/.github/workflows/first-contribution-greeting.yaml new file mode 100644 index 00000000..5dc50c92 --- /dev/null +++ b/.github/workflows/first-contribution-greeting.yaml @@ -0,0 +1,16 @@ +name: first-contribution-greeting + +on: [pull_request_target, issues] + +jobs: + first-contribution-greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Hey there! Thank you for creating an issue :) Please take a moment to review our [**community guidelines**](https://github.com/AniTrend/retrofit-graphql/blob/develop/CONTRIBUTING.md) to make the contribution process easy and effective for everyone involved." + pr-message: "Hey there! Thank you for this PR :) Please take a moment to review our [**community guidelines**](https://github.com/AniTrend/retrofit-graphql/blob/develop/CONTRIBUTING.md) to make the contribution process easy and effective for everyone involved." \ No newline at end of file diff --git a/.github/workflows/gradle-dokka.yml b/.github/workflows/gradle-dokka.yml index 664abe7d..6bcf0539 100644 --- a/.github/workflows/gradle-dokka.yml +++ b/.github/workflows/gradle-dokka.yml @@ -1,29 +1,28 @@ -name: dokka-html +name: gradle-dokka on: push: branches: [ develop ] jobs: - build: - + gradle-dokka: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: set up JDK 11 - uses: actions/setup-java@v2 + - uses: actions/checkout@v4 + - name: set up JDK 17 + uses: actions/setup-java@v4 with: - java-version: '11' + java-version: 17 distribution: 'adopt' - + - name: Setup Gradle + uses: gradle/gradle-build-action@v3 - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Generate docs with dokka - run: ./gradlew dokkaHtml + run: ./gradlew dokkaHtmlMultiModule - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@4.1.5 + uses: JamesIves/github-pages-deploy-action@v4.6.0 with: branch: docs # The branch the action should deploy to. folder: library/build/docs/dokka # The folder the action should deploy. diff --git a/.github/workflows/gradle-wrapper-validation.yaml b/.github/workflows/gradle-wrapper-validation.yaml new file mode 100644 index 00000000..5aa11e92 --- /dev/null +++ b/.github/workflows/gradle-wrapper-validation.yaml @@ -0,0 +1,10 @@ +name: gradle-wrapper-validation +on: [push, pull_request] + +jobs: + gradle-wrapper-validation: + name: "Validation" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v3 \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..2bd1e18c --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,34 @@ +name: release-drafter + +on: + push: + branches: + - 'develop' + pull_request_target: + # Only following types are handled by the action, but one can default to all as well + types: [ opened, reopened, synchronize ] + +permissions: + contents: read + +jobs: + update-draft-release: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v6 + id: release_drafter + with: + config-name: release-drafter-config.yml + disable-autolabeler: false + commitish: develop + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + event-type: version-update-and-push + client-payload: '{"version": "${{ steps.release_drafter.outputs.resolved_version }}"}' diff --git a/.github/workflows/version-updater.yaml b/.github/workflows/version-updater.yaml new file mode 100644 index 00000000..f0baafbb --- /dev/null +++ b/.github/workflows/version-updater.yaml @@ -0,0 +1,56 @@ +name: version-update + +on: + repository_dispatch: + types: [version-update-and-push] + +permissions: + contents: read + +jobs: + version-update: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: develop + + - name: Extract version information to file + run: echo "${{ github.event.client_payload.version }}" > VERSION + + - name: Create version.properties using extracted version + run: | + IFS='.' read -ra VER <<< "$(cat VERSION)" + MAJOR=$((VER[0] * 1000000000)) + MINOR=$((VER[1] * 1000000)) + PATCH=$((VER[2] * 1000)) + CODE=$((MAJOR + MINOR + PATCH)) + echo "version=$(cat VERSION)" > gradle/version.properties + echo "code=$CODE" >> gradle/version.properties + echo "name=v$(cat VERSION)" >> gradle/version.properties + + - name: Clean up version information file + run: rm VERSION + + - name: Preview created version.properties + run: cat gradle/version.properties + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + signoff: true + delete-branch: true + commit-message: "automation: update version.properties" + author: "Author " + title: "platform: automated version update" + body: | + This PR was automatically generated to update `version.properties` + branch: platform/update-version-meta-data + labels: "skip-changelog" + assignees: "wax911" + reviewers: "wax911" diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 95520fd2..0c0c3383 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -1,17 +1,10 @@ - - - - - - - - - - - - + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 00000000..b268ef36 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 20baa98f..cb2afa06 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,20 +4,29 @@ + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 00000000..fe63bb67 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 00000000..f8051a6f --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 9ffcaa9b..d18963a7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ - + diff --git a/.idea/modules.xml b/.idea/modules.xml index 99fcbd82..7b13c3df 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,10 +2,14 @@ - - - + + + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d53d651..dd4e4a04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,7 +56,7 @@ Version 0.11.0-alpha01 *(2020-06-28)* - **Update**: Rewrite sample app, migrate to github api [8ce9257](https://github.com/AniTrend/retrofit-graphql/commit/8ce9257fa1379b03df8b4483c5e6a58c3a7104c2) -- **New**: Migrate to buildSrc and bump retofit to 2.9.0 [cff0fd8](https://github.com/AniTrend/retrofit-graphql/commit/cff0fd8a90e58164264a395b22d0f9f8cf6a4a1f) +- **New**: Migrate to buildSrc and bump retrofit to 2.9.0 [cff0fd8](https://github.com/AniTrend/retrofit-graphql/commit/cff0fd8a90e58164264a395b22d0f9f8cf6a4a1f) - **Update**: Bump gradle from 3.6.3 to 4.0.0 [#104](https://github.com/AniTrend/retrofit-graphql/pull/104) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index fec141be..308061d0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,10 +1,8 @@ -import co.anitrend.retrofit.graphql.buildSrc.Libraries import java.net.URI plugins { id("co.anitrend.retrofit.graphql") id("kotlinx-serialization") - id("koin") } repositories { @@ -13,50 +11,55 @@ repositories { } } +android { + namespace = "co.anitrend.retrofit.graphql.sample" + buildFeatures { + buildConfig = true + } +} + dependencies { implementation(project(":library")) - implementation(Libraries.JetBrains.KotlinX.Serialization.runtime) - - implementation(Libraries.Google.Material.material) - implementation(Libraries.threeTenBp) - - implementation(Libraries.AndroidX.Core.coreKtx) - implementation(Libraries.AndroidX.StartUp.startUpRuntime) - implementation(Libraries.AndroidX.Collection.collectionKtx) - implementation(Libraries.AndroidX.Fragment.fragmentKtx) - implementation(Libraries.AndroidX.Activity.activityKtx) - implementation(Libraries.AndroidX.Emoji.appCompat) - implementation(Libraries.AndroidX.ConstraintLayout.constraintLayout) - implementation(Libraries.AndroidX.SwipeRefresh.swipeRefreshLayout) - implementation(Libraries.AndroidX.Preference.preferenceKtx) - implementation(Libraries.AndroidX.Recycler.recyclerView) - implementation(Libraries.AndroidX.Work.runtimeKtx) - - implementation(Libraries.AndroidX.Paging.common) - implementation(Libraries.AndroidX.Paging.runtime) - implementation(Libraries.AndroidX.Paging.runtimeKtx) - - implementation(Libraries.AndroidX.Room.ktx) - implementation(Libraries.AndroidX.Room.runtime) - kapt(Libraries.AndroidX.Room.compiler) - - implementation(Libraries.AniTrend.Arch.ui) - implementation(Libraries.AniTrend.Arch.ext) - implementation(Libraries.AniTrend.Arch.core) - implementation(Libraries.AniTrend.Arch.data) - implementation(Libraries.AniTrend.Arch.theme) - implementation(Libraries.AniTrend.Arch.domain) - implementation(Libraries.AniTrend.Arch.recycler) - implementation(Libraries.AniTrend.Emojify.emojify) - - implementation(Libraries.Coil.coil) - implementation(Libraries.Coil.gif) - - implementation(Libraries.timber) - implementation(Libraries.debugDb) - implementation(Libraries.treessence) - - releaseImplementation(Libraries.Chuncker.release) - debugImplementation(Libraries.Chuncker.debug) + implementation(libs.jetbrains.kotlinx.serialization.json) + + implementation(libs.google.material) + implementation(libs.threeTenBp) + + implementation(libs.androidx.core) + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.startup.runtime) + implementation(libs.androidx.fragment) + implementation(libs.androidx.fragment.ktx) + implementation(libs.androidx.activity) + implementation(libs.androidx.activity.ktx) + implementation(libs.androidx.constraintlayout) + implementation(libs.androidx.swiperefreshlayout) + implementation(libs.androidx.preference.ktx) + implementation(libs.androidx.recycler.view) + + implementation(libs.androidx.paging.common) + implementation(libs.androidx.paging.runtime) + implementation(libs.androidx.paging.runtime.ktx) + + implementation(libs.androidx.room.ktx) + implementation(libs.androidx.room.runtime) + kapt(libs.androidx.room.compiler) + + implementation(libs.anitrend.arch.ui) + implementation(libs.anitrend.arch.ext) + implementation(libs.anitrend.arch.core) + implementation(libs.anitrend.arch.data) + implementation(libs.anitrend.arch.theme) + implementation(libs.anitrend.arch.domain) + implementation(libs.anitrend.arch.recycler) + implementation(libs.anitrend.emojify) + + implementation(libs.coil) + implementation(libs.coil.gif) + + implementation(libs.timber) + + releaseImplementation(libs.chuncker.release) + debugImplementation(libs.chuncker.debug) } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4d959d55..d7f84553 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> @@ -20,7 +19,8 @@ android:networkSecurityConfig="@xml/network_security_config" tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"> - + diff --git a/build.gradle.kts b/build.gradle.kts index a096b57e..0360fbc7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,22 +1,12 @@ -import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask - -plugins { - id("com.github.ben-manes.versions") -} - buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath(co.anitrend.retrofit.graphql.buildSrc.Libraries.Android.Tools.buildGradle) - classpath(co.anitrend.retrofit.graphql.buildSrc.Libraries.JetBrains.Kotlin.Gradle.plugin) - classpath(co.anitrend.retrofit.graphql.buildSrc.Libraries.JetBrains.Kotlin.Gradle.serialization) - classpath(co.anitrend.retrofit.graphql.buildSrc.Libraries.Koin.Gradle.plugin) - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath(libs.android.gradle.plugin) + classpath(libs.jetbrains.kotlin.gradle) + classpath(libs.jetbrains.kotlin.serialization) } } @@ -24,35 +14,10 @@ allprojects { repositories { google() jcenter() + mavenCentral() } } -tasks { - val clean by registering(Delete::class) { - delete(rootProject.buildDir) - } -} - -tasks.named( - "dependencyUpdates", - DependencyUpdatesTask::class.java -).configure { - checkForGradleUpdate = false - outputFormatter = "json" - outputDir = "build/dependencyUpdates" - reportfileName = "report" - resolutionStrategy { - componentSelection { - all { - val reject = listOf("preview", "alpha", "m") - .map { qualifier -> - val pattern = "(?i).*[.-]$qualifier[.\\d-]*" - Regex(pattern, RegexOption.IGNORE_CASE) - } - .any { it.matches(candidate.version) } - if (reject) - reject("Preview releases not wanted") - } - } - } -} +tasks.create("clean", Delete::class) { + delete(rootProject.layout.buildDirectory) +} \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3ec45483..55111660 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,13 +1,11 @@ -import java.net.URI - plugins { `kotlin-dsl` `maven-publish` + `version-catalog` } repositories { google() - jcenter() mavenCentral() gradlePluginPortal() maven { @@ -15,29 +13,23 @@ repositories { } } -val buildToolsVersion = "7.0.3" -val kotlinVersion = "1.4.32" -val dokkaVersion = "1.4.32" -val manesVersion = "0.38.0" -val spotlessVersion = "6.12.0" - dependencies { - /* Depend on the android gradle plugin, since we want to access it in our plugin */ - implementation("com.android.tools.build:gradle:$buildToolsVersion") + /** Depend on the android gradle plugin, since we want to access it in our plugin */ + implementation(libs.android.gradle.plugin) - /* Depend on the kotlin plugin, since we want to access it in our plugin */ - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + /** Depend on the kotlin plugin, since we want to access it in our plugin */ + implementation(libs.jetbrains.kotlin.gradle) - /* Depend on the dokka plugin, since we want to access it in our plugin */ - implementation("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion") - - /** Dependency management */ - implementation("com.github.ben-manes:gradle-versions-plugin:$manesVersion") + /** Depend on the dokka plugin, since we want to access it in our plugin */ + implementation(libs.jetbrains.dokka.gradle) /** Spotless */ - implementation("com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion") + implementation(libs.spotless.gradle) - /* Depend on the default Gradle API's since we want to build a custom plugin */ + /** Depend on the default Gradle API's since we want to build a custom plugin */ implementation(gradleApi()) implementation(localGroovy()) + + /** Work around to include ../.gradle/LibrariesForLibs generated file for version catalog */ + implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) } \ No newline at end of file diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 00000000..4d2de53c --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,9 @@ +@file:Suppress("UnstableApiUsage") + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/Libraries.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/Libraries.kt deleted file mode 100644 index 503ab5b8..00000000 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/Libraries.kt +++ /dev/null @@ -1,276 +0,0 @@ -package co.anitrend.retrofit.graphql.buildSrc - -import co.anitrend.retrofit.graphql.buildSrc.common.Versions - -object Libraries { - const val threeTenBp = "com.jakewharton.threetenabp:threetenabp:${Versions.threeTenBp}" - const val timber = "com.jakewharton.timber:timber:${Versions.timber}" - - const val treessence = "fr.bipi.treessence:treessence:${Versions.treesSence}" - const val debugDb = "com.amitshekhar.android:debug-db:${Versions.debugDB}" - - const val junit = "junit:junit:${Versions.junit}" - const val mockk = "io.mockk:mockk:${Versions.mockk}" - - object Android { - - object Tools { - private const val version = "7.0.3" - const val buildGradle = "com.android.tools.build:gradle:$version" - } - } - - object AndroidX { - - object Activity { - private const val version = "1.2.0" - const val activity = "androidx.activity:activity:$version" - const val activityKtx = "androidx.activity:activity-ktx:$version" - } - - object Annotation { - private const val version = "1.2.0" - const val annotation = "androidx.annotation:annotation:$version" - } - - object Collection { - private const val version = "1.1.0" - const val collection = "androidx.collection:collection:$version" - const val collectionKtx = "androidx.collection:collection-ktx:$version" - } - - object Core { - private const val version = "1.5.0" - const val core = "androidx.core:core:$version" - const val coreKtx = "androidx.core:core-ktx:$version" - } - - object ConstraintLayout { - private const val version = "2.0.0" - const val constraintLayout = "androidx.constraintlayout:constraintlayout:$version" - const val constraintLayoutSolver = "androidx.constraintlayout:constraintlayout-solver:$version" - } - - object Emoji { - private const val version = "1.1.0" - const val appCompat = "androidx.emoji:emoji-appcompat:$version" - } - - object Fragment { - private const val version = "1.3.0" - const val fragment = "androidx.fragment:fragment:$version" - const val fragmentKtx = "androidx.fragment:fragment-ktx:$version" - const val test = "androidx.fragment:fragment-ktx:fragment-testing$version" - } - - object Lifecycle { - private const val version = "2.2.0" - const val extensions = "androidx.lifecycle:lifecycle-extensions:$version" - const val runTimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version" - const val liveDataKtx = "androidx.lifecycle:lifecycle-livedata-ktx:$version" - const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" - const val liveDataCoreKtx = "androidx.lifecycle:lifecycle-livedata-core-ktx:$version" - } - - object Paging { - private const val version = "2.1.2" - const val common = "androidx.paging:paging-common-ktx:$version" - const val runtime = "androidx.paging:paging-runtime:$version" - const val runtimeKtx = "androidx.paging:paging-runtime-ktx:$version" - } - - object Preference { - private const val version = "1.1.0" - const val preference = "androidx.preference:preference:$version" - const val preferenceKtx = "androidx.preference:preference-ktx:$version" - } - - object Recycler { - private const val version = "1.2.0" - const val recyclerView = "androidx.recyclerview:recyclerview:$version" - const val recyclerViewSelection = "androidx.recyclerview:recyclerview-selection:$version" - } - - object Room { - private const val version = "2.2.6" - const val compiler = "androidx.room:room-compiler:$version" - const val runtime = "androidx.room:room-runtime:$version" - const val test = "androidx.room:room-testing:$version" - const val ktx = "androidx.room:room-ktx:$version" - } - - object StartUp { - private const val version = "1.1.0" - const val startUpRuntime = "androidx.startup:startup-runtime:$version" - } - - object SwipeRefresh { - private const val version = "1.1.0" - const val swipeRefreshLayout = "androidx.swiperefreshlayout:swiperefreshlayout:$version" - } - - object Test { - private const val version = "1.3.0" - const val core = "androidx.test:core:$version" - const val coreKtx = "androidx.test:core-ktx:$version" - const val runner = "androidx.test:runner:$version" - const val rules = "androidx.test:rules:$version" - - object Espresso { - private const val version = "3.3.0" - const val core = "androidx.test.espresso:espresso-core:$version" - } - - object Extension { - private const val version = "1.1.2" - const val junit = "androidx.test.ext:junit:$version" - const val junitKtx = "androidx.test.ext:junit-ktx:$version" - } - } - - object Work { - private const val version = "2.4.0" - const val runtimeKtx = "androidx.work:work-runtime-ktx:$version" - const val runtime = "androidx.work:work-runtime:$version" - const val test = "androidx.work:work-test:$version" - } - } - - object AniTrend { - - object Arch { - private const val version = "1.3.0-beta14" - const val ui = "com.github.anitrend.support-arch:support-ui:${version}" - const val ext = "com.github.anitrend.support-arch:support-ext:${version}" - const val core = "com.github.anitrend.support-arch:support-core:${version}" - const val data = "com.github.anitrend.support-arch:support-data:${version}" - const val theme = "com.github.anitrend.support-arch:support-theme:${version}" - const val domain = "com.github.anitrend.support-arch:support-domain:${version}" - const val recycler = "com.github.anitrend.support-arch:support-recycler:${version}" - } - - object Emojify { - private const val version = "1.6.0-alpha01" - const val emojify = "com.github.anitrend:android-emojify:$version" - } - } - - object Chuncker { - private const val version = "3.2.0" - - const val debug = "com.github.ChuckerTeam.Chucker:library:$version" - const val release = "com.github.ChuckerTeam.Chucker:library-no-op:$version" - } - - object Coil { - private const val version = "1.2.1" - const val coil = "io.coil-kt:coil:$version" - const val base = "io.coil-kt:coil-base:$version" - const val gif = "io.coil-kt:coil-gif:$version" - const val svg = "io.coil-kt:coil-svg:$version" - const val video = "io.coil-kt:coil-video:$version" - } - - object Google { - - object Material { - private const val version = "1.3.0" - const val material = "com.google.android.material:material:$version" - } - } - - object JetBrains { - - object Dokka { - private const val version = "1.4.32" - const val gradlePlugin = "org.jetbrains.dokka:dokka-gradle-plugin:$version" - } - - object Kotlin { - private const val version = "1.4.32" - const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version" - const val reflect = "org.jetbrains.kotlin:kotlin-reflect:$version" - - object Gradle { - const val plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version" - const val serialization = "org.jetbrains.kotlin:kotlin-serialization:$version" - } - - object Android { - const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version" - } - } - - object KotlinX { - object Coroutines { - private const val version = "1.4.3" - const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version" - const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version" - const val test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$version" - } - - object Serialization { - private const val version = "0.20.0" - const val runtime = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$version" - } - } - } - - object Koin { - private const val version = "2.1.6" - const val core = "org.koin:koin-core:$version" - const val extension = "org.koin:koin-core-ext:$version" - const val test = "org.koin:koin-test:$version" - - object AndroidX { - const val scope = "org.koin:koin-androidx-scope:$version" - const val fragment = "org.koin:koin-androidx-fragment:$version" - const val viewmodel = "org.koin:koin-androidx-viewmodel:$version" - } - - object Gradle { - const val plugin = "org.koin:koin-gradle-plugin:$version" - } - } - - object Markwon { - private const val version = "4.4.0" - const val core = "io.noties.markwon:core:$version" - const val html = "io.noties.markwon:html:$version" - const val image = "io.noties.markwon:image:$version" - const val glide = "io.noties.markwon:image-glide:$version" - const val coil = "io.noties.markwon:image-coil:$version" - const val parser = "io.noties.markwon:inline-parser:$version" - const val linkify = "io.noties.markwon:linkify:$version" - const val simpleExt = "io.noties.markwon:simple-ext:$version" - const val syntaxHighlight = "io.noties.markwon:syntax-highlight:$version" - - object Extension { - const val taskList = "io.noties.markwon:ext-tasklist:$version" - const val strikeThrough = "io.noties.markwon:ext-strikethrough:$version" - const val tables = "io.noties.markwon:ext-tables:$version" - const val latex = "io.noties.markwon:ext-latex:$version" - } - } - - object Square { - - object LeakCanary { - private const val version = "2.3" - const val leakCanary = "com.squareup.leakcanary:leakcanary-android:$version" - } - - object Retrofit { - private const val version = "2.9.0" - const val retrofit = "com.squareup.retrofit2:retrofit:$version" - const val gsonConverter = "com.squareup.retrofit2:converter-gson:$version" - } - - object OkHttp { - private const val version = "4.7.2" - const val okhttp = "com.squareup.okhttp3:okhttp:$version" - const val logging = "com.squareup.okhttp3:logging-interceptor:$version" - const val mockServer = "com.squareup.okhttp3:mockwebserver:$version" - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/common/Versions.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/common/Versions.kt deleted file mode 100644 index 2e1ce17a..00000000 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/common/Versions.kt +++ /dev/null @@ -1,34 +0,0 @@ -package co.anitrend.retrofit.graphql.buildSrc.common - -object Versions { - - private fun Int.toVersion(): String { - return if (this < 9) "0$this" else "$this" - } - - const val compileSdk = 30 - const val targetSdk = 30 - const val minSdk = 17 - - private const val major = 0 - private const val minor = 11 - private const val patch = 0 - private const val revision = 2 - - private const val channel = "beta" - - const val versionCode = major * 100_000 + minor * 10_000 + patch * 1_000 + revision * 100 - val versionName = if (revision > 0) - "$major.$minor.$patch-$channel${revision.toVersion()}" - else "$major.$minor.$patch" - - const val mockk = "1.12.0" - const val junit = "4.13.2" - - const val timber = "5.0.1" - const val threeTenBp = "1.3.1" - const val ktlint = "0.43.0" - - const val debugDB = "1.0.6" - const val treesSence = "0.3.2" -} diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/CorePlugin.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/CorePlugin.kt index 41ea33c0..f0a179a6 100644 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/CorePlugin.kt +++ b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/CorePlugin.kt @@ -13,22 +13,20 @@ open class CorePlugin : Plugin { /** * Inspecting available extensions */ - @Suppress("UnstableApiUsage") - internal fun Project.availableExtensions() { + private fun Project.availableExtensions() { val extensionSchema = project.extensions.extensionsSchema extensionSchema.forEach { - println("Available extension for module ${project.path}: ${it.name} -> ${it.publicType}") + logger.lifecycle("Available extension for module ${project.path}: ${it.name} -> ${it.publicType}") } } /** * Inspecting available components */ - @Suppress("UnstableApiUsage") - internal fun Project.availableComponents() { + private fun Project.availableComponents() { val collectionSchema = project.components.asMap collectionSchema.forEach { - println("Available component for module ${project.path}: ${it.key} -> ${it.value}") + logger.lifecycle("Available component for module ${project.path}: ${it.key} -> ${it.value}") } } diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidConfiguration.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidConfiguration.kt index 5026f925..8dec4d26 100644 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidConfiguration.kt +++ b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidConfiguration.kt @@ -1,62 +1,67 @@ package co.anitrend.retrofit.graphql.buildSrc.plugin.components import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.baseExtension -import co.anitrend.retrofit.graphql.buildSrc.common.Versions -import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.isLibraryModule import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.isSampleModule +import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.libraryExtension import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.spotlessExtension import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.baseAppExtension -import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.libraryExtension -import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.libraryExtension +import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.kotlinAndroidProjectExtension +import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.libs +import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.props import com.android.build.gradle.internal.dsl.DefaultConfig import org.gradle.api.JavaVersion import org.gradle.api.Project import org.jetbrains.kotlin.gradle.dsl.KotlinCompile -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile import java.io.File -internal fun Project.configureSpotless(): Unit { + +private fun Project.configureLint() = libraryExtension().run { + lint { + abortOnError = false + ignoreWarnings = false + ignoreTestSources = true + } +} + +internal fun Project.configureSpotless() { if (!isSampleModule()) spotlessExtension().run { kotlin { target("**/*.kt") - targetExclude("$buildDir/**/*.kt", "bin/**/*.kt", "**/test/**") - ktlint(Versions.ktlint).userData( - mapOf( - "android" to "true", - "max_line_length" to "120" - ) + targetExclude( + "${layout.buildDirectory.get()}/**/*.kt", + "**/androidTest/**/*.kt", + "**/test/**/*.kt", + "bin/**/*.kt" ) + ktlint(libs.pintrest.ktlint.get().version) licenseHeaderFile(rootProject.file("spotless/copyright.kt")) } } } -@Suppress("UnstableApiUsage") private fun DefaultConfig.applyAdditionalConfiguration(project: Project) { if (project.isSampleModule()) { applicationId = "co.anitrend.retrofit.graphql.sample" project.baseAppExtension().buildFeatures { viewBinding = true } + project.logger.lifecycle("Applying vector drawables configuration for module -> ${project.path}") + vectorDrawables.useSupportLibrary = true } - else + else { + project.configureLint() consumerProguardFiles.add(File("consumer-rules.pro")) - - println("Applying vector drawables configuration for module -> ${project.path}") - vectorDrawables.useSupportLibrary = true + } } internal fun Project.configureAndroid(): Unit = baseExtension().run { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(34) defaultConfig { - if (isSampleModule()) - minSdk = 21 - else - minSdk = Versions.minSdk - targetSdk = Versions.targetSdk - versionCode = Versions.versionCode - versionName = Versions.versionName + minSdk = if (isSampleModule()) 21 else 17 + targetSdk = 34 + versionCode = props[PropertyTypes.CODE].toInt() + versionName = props[PropertyTypes.VERSION] testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" applyAdditionalConfiguration(project) } @@ -75,9 +80,8 @@ internal fun Project.configureAndroid(): Unit = baseExtension().run { } packagingOptions { - excludes.add("META-INF/NOTICE.txt") - excludes.add("META-INF/LICENSE") - excludes.add("META-INF/LICENSE.txt") + resources.excludes.add("META-INF/NOTICE.*") + resources.excludes.add("META-INF/LICENSE*") } sourceSets { @@ -98,15 +102,9 @@ internal fun Project.configureAndroid(): Unit = baseExtension().run { unitTests.isReturnDefaultValues = true } - lintOptions { - isAbortOnError = false - isIgnoreWarnings = false - isIgnoreTestSources = true - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } tasks.withType(KotlinCompile::class.java) { @@ -116,17 +114,14 @@ internal fun Project.configureAndroid(): Unit = baseExtension().run { allWarningsAsErrors = false // Filter out modules that won't be using coroutines freeCompilerArgs = if (isSampleModule()) listOf( - "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", - "-Xopt-in=kotlinx.coroutines.FlowPreview", - "-Xopt-in=kotlin.Experimental" - ) else listOf("-Xopt-in=kotlin.Experimental") + "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", + "-opt-in=kotlin.Experimental" + ) else listOf("-opt-in=kotlin.Experimental") } } } - tasks.withType(KotlinJvmCompile::class.java) { - kotlinOptions { - jvmTarget = "1.8" - } + kotlinAndroidProjectExtension().run { + jvmToolchain(17) } } \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidOptions.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidOptions.kt index 867d8f22..a436ae0f 100644 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidOptions.kt +++ b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidOptions.kt @@ -1,9 +1,9 @@ package co.anitrend.retrofit.graphql.buildSrc.plugin.components -import co.anitrend.retrofit.graphql.buildSrc.common.Versions import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.baseAppExtension import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.baseExtension import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.isLibraryModule +import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.props import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.publishingExtension import com.android.build.api.dsl.ApplicationBuildType import com.android.build.api.dsl.ApplicationDefaultConfig @@ -19,25 +19,27 @@ import org.jetbrains.dokka.gradle.DokkaTask import java.net.URL import java.util.* -private fun Properties.applyToBuildConfigForBuild(buildType: ApplicationBuildType) { +@Suppress("UnstableApiUsage") +private fun Properties.applyToBuildConfigForBuild(project: Project, buildType: ApplicationBuildType) { forEach { propEntry -> val key = propEntry.key as String val value = propEntry.value as String - println("Adding build config field property -> key: $key value: $value") + project.logger.lifecycle("Adding build config field property -> key: $key value: $value") buildType.buildConfigField("String", key, value) } } +@Suppress("UnstableApiUsage") private fun NamedDomainObjectContainer.applyConfiguration(project: Project) { asMap.forEach { buildTypeEntry -> - println("Configuring build type -> ${buildTypeEntry.key}") + project.logger.lifecycle("Configuring build type -> ${buildTypeEntry.key}") val buildType = buildTypeEntry.value val secretsFile = project.file(".config/secrets.properties") if (secretsFile.exists()) secretsFile.inputStream().use { fis -> Properties().run { - load(fis); applyToBuildConfigForBuild(buildType) + load(fis); applyToBuildConfigForBuild(project, buildType) } } @@ -45,14 +47,15 @@ private fun NamedDomainObjectContainer.applyConfiguration( if (configurationFile.exists()) configurationFile.inputStream().use { fis -> Properties().run { - load(fis); applyToBuildConfigForBuild(buildType) + load(fis); applyToBuildConfigForBuild(project, buildType) } } } } +@Suppress("UnstableApiUsage") private fun ApplicationDefaultConfig.applyRoomCompilerOptions(project: Project) { - println("Adding java compiler options for room on module-> ${project.path}") + project.logger.lifecycle("Adding java compiler options for room on module-> ${project.path}") javaCompileOptions { annotationProcessorOptions { arguments( @@ -67,18 +70,18 @@ private fun ApplicationDefaultConfig.applyRoomCompilerOptions(project: Project) } private fun Project.createMavenPublicationUsing(sourcesJar: Jar) { - println("Applying publication configuration on ${project.path}") + logger.lifecycle("Applying publication configuration on ${project.path}") publishingExtension().publications { val component = components.findByName("android") - println("Configuring maven publication options for ${project.path}:maven with component-> ${component?.name}") + logger.lifecycle("Configuring maven publication options for ${project.path}:maven with component-> ${component?.name}") create("maven", MavenPublication::class.java) { groupId = "co.anitrend" artifactId = "retrofit-graphql" - version = Versions.versionName + version = props[PropertyTypes.NAME] artifact(sourcesJar) - artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") + artifact("${project.layout.buildDirectory.get()}/outputs/aar/${project.name}-release.aar") from(component) pom { @@ -107,7 +110,7 @@ private fun Project.createDokkaTaskProvider() = tasks.named("dokkaHtm outputDirectory.set(buildDir.resolve("docs/dokka")) // Set module name displayed in the final output - moduleName.set(project.name) + moduleName.set(this@createDokkaTaskProvider.name) // Use default or set to custom path to cache directory // to enable package-list caching @@ -159,7 +162,7 @@ private fun Project.createDokkaTaskProvider() = tasks.named("dokkaHtm sourceRoot(file("src")) // Used for linking to JDK documentation - jdkVersion.set(8) + jdkVersion.set(17) // Disable linking to online kotlin-stdlib documentation noStdlibLink.set(false) @@ -199,13 +202,12 @@ private fun Project.createDokkaTaskProvider() = tasks.named("dokkaHtm } } -@Suppress("UnstableApiUsage") internal fun Project.configureOptions() { - println("Applying extension options for ${project.path}") + logger.lifecycle("Applying extension options for ${project.path}") if (isLibraryModule()) { val baseExt = baseExtension() - println("Applying additional tasks options for dokka and javadoc on ${project.path}") + logger.lifecycle("Applying additional tasks options for dokka and javadoc on ${project.path}") createDokkaTaskProvider() @@ -215,7 +217,7 @@ internal fun Project.configureOptions() { } val classesJar by tasks.register("classesJar", Jar::class.java) { - from("${project.buildDir}/intermediates/classes/release") + from("${project.layout.buildDirectory.get()}/intermediates/classes/release") } artifacts { diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidPlugins.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidPlugins.kt index c6ffb854..9177ce1d 100644 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidPlugins.kt +++ b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/AndroidPlugins.kt @@ -18,7 +18,6 @@ private fun Project.applyModulePlugin() { internal fun Project.configurePlugins() { applyModulePlugin() plugins.apply("kotlin-android") - plugins.apply("kotlin-parcelize") if (isSampleModule()) plugins.apply("kotlin-kapt") } \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/PropertiesComponent.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/PropertiesComponent.kt new file mode 100644 index 00000000..6db32ff7 --- /dev/null +++ b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/components/PropertiesComponent.kt @@ -0,0 +1,32 @@ +package co.anitrend.retrofit.graphql.buildSrc.plugin.components + +import org.gradle.api.Project +import java.io.File +import java.util.* + + +enum class PropertyTypes(val key: String) { + CODE("code"), + VERSION("version"), + NAME("name"), +} + +class PropertiesReader(project: Project) { + private val properties = Properties(2) + + init { + val releaseFile = File(project.rootDir, "gradle/version.properties") + if (!releaseFile.exists()) { + project.logger.error("Release file cannot be found in path: $releaseFile") + } + + properties.apply { + load(releaseFile.inputStream()) + } + } + + operator fun get(type: PropertyTypes): String { + return properties.getProperty(type.key) + ?: throw IllegalStateException("$type properties were not initialized") + } +} \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/extensions/ProjectExtensions.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/extensions/ProjectExtensions.kt index c4394727..a6607222 100644 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/extensions/ProjectExtensions.kt +++ b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/extensions/ProjectExtensions.kt @@ -4,6 +4,8 @@ import com.android.build.gradle.* import org.gradle.api.Project import com.android.build.gradle.api.AndroidBasePlugin import com.diffplug.gradle.spotless.SpotlessExtension +import org.gradle.accessors.dm.LibrariesForLibs +import co.anitrend.retrofit.graphql.buildSrc.plugin.components.PropertiesReader import com.android.build.gradle.internal.dsl.BaseAppModuleExtension import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet import org.gradle.api.plugins.ExtraPropertiesExtension @@ -19,6 +21,12 @@ import co.anitrend.retrofit.graphql.buildSrc.module.Modules fun Project.isSampleModule() = name == Modules.Components.App.id fun Project.isLibraryModule() = name == Modules.Components.Library.id +internal val Project.props: PropertiesReader + get() = PropertiesReader(this) + +internal val Project.libs: LibrariesForLibs + get() = extensions.getByType() + internal fun Project.baseExtension() = extensions.getByType() @@ -28,9 +36,6 @@ internal fun Project.baseAppExtension() = internal fun Project.libraryExtension() = extensions.getByType() -internal fun Project.dynamicFeatureExtension() = - extensions.getByType() - internal fun Project.extraPropertiesExtension() = extensions.getByType() diff --git a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/strategy/DependencyStrategy.kt b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/strategy/DependencyStrategy.kt index 67e2f3e3..36bfa782 100644 --- a/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/strategy/DependencyStrategy.kt +++ b/buildSrc/src/main/java/co/anitrend/retrofit/graphql/buildSrc/plugin/strategy/DependencyStrategy.kt @@ -1,10 +1,10 @@ package co.anitrend.retrofit.graphql.buildSrc.plugin.strategy import org.gradle.api.Project -import co.anitrend.retrofit.graphql.buildSrc.Libraries import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.isSampleModule import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.implementation import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.androidTest +import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.libs import co.anitrend.retrofit.graphql.buildSrc.plugin.extensions.test import org.gradle.api.artifacts.dsl.DependencyHandler @@ -13,43 +13,37 @@ internal class DependencyStrategy( ) { private fun DependencyHandler.applyDefaultDependencies() { - implementation(Libraries.JetBrains.Kotlin.stdlib) + implementation(project.libs.jetbrains.kotlin.stdlib) if (project.isSampleModule()) { - implementation(Libraries.JetBrains.Kotlin.reflect) - implementation(Libraries.Koin.AndroidX.fragment) - implementation(Libraries.Koin.AndroidX.viewmodel) - implementation(Libraries.Koin.AndroidX.scope) - implementation(Libraries.Koin.extension) - implementation(Libraries.Koin.core) + implementation(project.libs.jetbrains.kotlin.reflect) + implementation(project.libs.koin.core) + implementation(project.libs.koin.android) } // Testing libraries - test(Libraries.junit) - test(Libraries.mockk) + test(project.libs.junit) + test(project.libs.mockk) } private fun DependencyHandler.applyTestDependencies() { - if (project.isSampleModule()) - test(Libraries.Koin.test) - androidTest(Libraries.AndroidX.Test.core) - androidTest(Libraries.AndroidX.Test.runner) - androidTest(Libraries.AndroidX.Test.Espresso.core) + androidTest(project.libs.mockk.android) + androidTest(project.libs.androidx.test.core) + androidTest(project.libs.androidx.test.core.ktx) + androidTest(project.libs.androidx.test.runner) } private fun DependencyHandler.applyLifeCycleDependencies() { - implementation(Libraries.AndroidX.Lifecycle.liveDataCoreKtx) - implementation(Libraries.AndroidX.Lifecycle.viewModelKtx) - implementation(Libraries.AndroidX.Lifecycle.liveDataKtx) - implementation(Libraries.AndroidX.Lifecycle.runTimeKtx) - implementation(Libraries.AndroidX.Lifecycle.extensions) + implementation(project.libs.androidx.lifecycle.livedata.core) + implementation(project.libs.androidx.lifecycle.livedata.ktx) + implementation(project.libs.androidx.lifecycle.viewmodel.ktx) + implementation(project.libs.androidx.lifecycle.extensions) + implementation(project.libs.androidx.lifecycle.runtime.ktx) } private fun DependencyHandler.applyNetworkingDependencies() { - implementation(Libraries.Square.Retrofit.retrofit) - implementation(Libraries.Square.Retrofit.gsonConverter) - if (project.isSampleModule()) - implementation(Libraries.Square.OkHttp.logging) + implementation(project.libs.square.retrofit) + implementation(project.libs.square.retrofit.gson.converter) } fun applyDependenciesOn(handler: DependencyHandler) { diff --git a/gradle.properties b/gradle.properties index 15bfa0f5..21250cde 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m +org.gradle.jvmargs=-Xmx2048m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects @@ -16,4 +16,4 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..d6ac8149 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,132 @@ +[versions] +ktlint = "1.0.1" +threeTenBp = "1.4.7" +timber = "5.0.1" +junit = "4.13.2" +mockk = "1.13.10" + +android-tools-build = "8.4.0" + +androidx-activity = "1.9.0" +androidx-annotation = "1.8.0" +androidx-core = "1.13.1" +androidx-constraintLayout = "2.1.4" +androidx-collection = "1.4.0" +androidx-emoji = "1.1.0" +androidx-fragment = "1.7.1" +androidx-lifecycle = "2.8.0" +androidx-lifecycle-extensions = "2.2.0" +androidx-paging = "2.1.2" +androidx-preference = "1.2.1" +androidx-recycler = "1.3.2" +androidx-room = "2.6.1" +androidx-startup = "1.1.1" +androidx-swiperefresh = "1.1.0" +androidx-test-core = "1.5.2" + +anitrend-arch = "1.3.0-beta14" +anitrend-emojify = "1.9.1" + +chuncker = "3.5.2" + +coil = "2.6.0" + +google-material = "1.12.0" + +jetbrains-dokka = "1.9.20" +jetbrains-kotlin = "1.9.23" +jetbrains-kotlinx-coroutines = "1.8.1" +jetbrains-kotlinx-serialization = "1.6.3" + +koin-core = "3.5.6" +koin-android = "3.5.6" + +markwon = "4.6.2" + +square-retrofit = "2.11.0" +square-okhttp = "4.12.0" + +[libraries] +threeTenBp = { module = "com.jakewharton.threetenabp:threetenabp", version.ref = "threeTenBp" } +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } +junit = { module = "junit:junit", version.ref = "junit" } + +android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "android-tools-build" } + +androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-activity" } +androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "androidx-activity" } +androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" } +androidx-collection = { module = "androidx.collection:collection", version.ref = "androidx-collection" } +androidx-collection-ktx = { module = "androidx.collection:collection-ktx", version.ref = "androidx-collection" } +androidx-core = { module = "androidx.core:core", version.ref = "androidx-core" } +androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } +androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintLayout" } +androidx-emoji-appcompat = { module = "androidx.emoji:emoji-appcompat", version.ref = "androidx-emoji" } +androidx-fragment = { module = "androidx.fragment:fragment", version.ref = "androidx-fragment" } +androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "androidx-fragment" } +androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "androidx-lifecycle-extensions" } +androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-livedata-core-ktx = { module = "androidx.lifecycle:lifecycle-livedata-core-ktx", version.ref = "androidx-lifecycle" } +androidx-paging-common = { module = "androidx.paging:paging-common-ktx", version.ref = "androidx-paging" } +androidx-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "androidx-paging" } +androidx-paging-runtime-ktx = { module = "androidx.paging:paging-runtime-ktx", version.ref = "androidx-paging" } +androidx-preference = { module = "androidx.preference:preference", version.ref = "androidx-preference" } +androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "androidx-preference" } +androidx-recycler-view = { module = "androidx.recyclerview:recyclerview", version.ref = "androidx-recycler" } +androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidx-room" } +androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "androidx-room" } +androidx-room-test = { module = "androidx.room:room-testing", version.ref = "androidx-room" } +androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "androidx-room" } +androidx-startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "androidx-startup" } +androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "androidx-swiperefresh" } +androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" } +androidx-test-core-ktx = { module = "androidx.test:core-ktx", version.ref = "androidx-test-core" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-core" } + +anitrend-arch-ui = { module = "com.github.anitrend.support-arch:support-ui", version.ref = "anitrend-arch" } +anitrend-arch-ext = { module = "com.github.anitrend.support-arch:support-ext", version.ref = "anitrend-arch" } +anitrend-arch-core = { module = "com.github.anitrend.support-arch:support-core", version.ref = "anitrend-arch" } +anitrend-arch-data = { module = "com.github.anitrend.support-arch:support-data", version.ref = "anitrend-arch" } +anitrend-arch-theme = { module = "com.github.anitrend.support-arch:support-theme", version.ref = "anitrend-arch" } +anitrend-arch-domain = { module = "com.github.anitrend.support-arch:support-domain", version.ref = "anitrend-arch" } +anitrend-arch-recycler = { module = "com.github.anitrend.support-arch:support-recycler", version.ref = "anitrend-arch" } + +anitrend-emojify = { module = "com.github.anitrend:android-emojify", version.ref = "anitrend-emojify" } + +chuncker-debug = { module = "com.github.ChuckerTeam.Chucker:library", version.ref = "chuncker" } +chuncker-release = { module = "com.github.ChuckerTeam.Chucker:library-no-op", version.ref = "chuncker" } + +coil = { module = "io.coil-kt:coil", version.ref = "coil" } +coil-gif = { module = "io.coil-kt:coil-gif", version.ref = "coil" } + +google-material = { module = "com.google.android.material:material", version.ref = "google-material" } + +jetbrains-dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "jetbrains-dokka" } + +jetbrains-kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "jetbrains-kotlin" } +jetbrains-kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "jetbrains-kotlin" } +jetbrains-kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "jetbrains-kotlin" } +jetbrains-kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "jetbrains-kotlin" } +jetbrains-kotlin-android-extensions = { module = "org.jetbrains.kotlin:kotlin-android-extensions", version.ref = "jetbrains-kotlin" } + +jetbrains-kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "jetbrains-kotlinx-coroutines" } +jetbrains-kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "jetbrains-kotlinx-coroutines" } +jetbrains-kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "jetbrains-kotlinx-coroutines" } +jetbrains-kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "jetbrains-kotlinx-serialization" } + +koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin-core" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin-android" } + +square-retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "square-retrofit" } +square-retrofit-gson-converter = { module = "com.squareup.retrofit2:converter-gson", version.ref = "square-retrofit" } +square-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "square-okhttp" } + + +mockk = { module = "io.mockk:mockk", version.ref = "mockk" } +mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" } + +spotless-gradle = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.25.0" } + +pintrest-ktlint = { module = "com.pinterest:ktlint", version.ref = "ktlint" } \ No newline at end of file diff --git a/gradle/version.properties b/gradle/version.properties new file mode 100644 index 00000000..0652e87c --- /dev/null +++ b/gradle/version.properties @@ -0,0 +1,3 @@ +version=0.11.0 +code=11000000 +name=v0.11.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c053..e6441136 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 29e41345..e7646dea 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c515..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,99 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index a9f778a7..7101f8e4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -54,31 +55,16 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,17 +72,19 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/library/build.gradle.kts b/library/build.gradle.kts index c2c7782a..bccd5fb6 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -1,14 +1,14 @@ -import co.anitrend.retrofit.graphql.buildSrc.Libraries - plugins { id("co.anitrend.retrofit.graphql") } +android { + namespace = "io.github.wax911.library" +} + dependencies { - implementation(Libraries.AndroidX.Annotation.annotation) + implementation(libs.androidx.annotation) - testImplementation(Libraries.JetBrains.Kotlin.reflect) - testImplementation(Libraries.AndroidX.Test.coreKtx) - testImplementation(Libraries.AndroidX.Test.Extension.junit) - testImplementation(Libraries.AndroidX.Test.Extension.junitKtx) + testImplementation(libs.jetbrains.kotlin.reflect) + testImplementation(libs.androidx.test.core.ktx) } \ No newline at end of file diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index e6968db4..cc947c56 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1 +1 @@ - + diff --git a/library/src/main/kotlin/io/github/wax911/library/annotation/processor/GraphProcessor.kt b/library/src/main/kotlin/io/github/wax911/library/annotation/processor/GraphProcessor.kt index cf710430..b1f6234e 100644 --- a/library/src/main/kotlin/io/github/wax911/library/annotation/processor/GraphProcessor.kt +++ b/library/src/main/kotlin/io/github/wax911/library/annotation/processor/GraphProcessor.kt @@ -146,7 +146,8 @@ class GraphProcessor( replaceWith = ReplaceWith( "GraphProcessor(assetManager)", "io.github.wax911.library.annotation.processor.GraphProcessor" - ) + ), + level = DeprecationLevel.ERROR ) @JvmOverloads fun getInstance( diff --git a/library/src/main/kotlin/io/github/wax911/library/converter/GraphConverter.kt b/library/src/main/kotlin/io/github/wax911/library/converter/GraphConverter.kt index 22fbf8a2..64a44baf 100644 --- a/library/src/main/kotlin/io/github/wax911/library/converter/GraphConverter.kt +++ b/library/src/main/kotlin/io/github/wax911/library/converter/GraphConverter.kt @@ -21,6 +21,7 @@ import com.google.gson.Gson import com.google.gson.GsonBuilder import io.github.wax911.library.annotation.processor.GraphProcessor import io.github.wax911.library.annotation.processor.contract.AbstractGraphProcessor +import io.github.wax911.library.annotation.processor.plugin.AssetManagerDiscoveryPlugin import io.github.wax911.library.converter.request.GraphRequestConverter import io.github.wax911.library.converter.response.GraphResponseConverter import io.github.wax911.library.logger.DefaultGraphLogger @@ -97,7 +98,8 @@ open class GraphConverter( ReplaceWith( "setMinimumLogLevel(ILogger.Level)", "io.github.wax911.library.logger.contract.ILogger.Level" - ) + ), + level = DeprecationLevel.ERROR ) fun setLogLevel(logLevel: LogLevel) { val level = when (logLevel) { @@ -133,8 +135,8 @@ open class GraphConverter( @JvmOverloads fun create(context: Context, level: ILogger.Level = ILogger.Level.INFO): GraphConverter = GraphConverter( - graphProcessor = GraphProcessor.getInstance( - context.assets, + graphProcessor = GraphProcessor( + AssetManagerDiscoveryPlugin(context.assets), DefaultGraphLogger(level) ), gson = GsonBuilder() @@ -155,8 +157,8 @@ open class GraphConverter( @JvmOverloads fun create(context: Context, gson: Gson, level: ILogger.Level = ILogger.Level.INFO): GraphConverter = GraphConverter( - graphProcessor = GraphProcessor.getInstance( - context.assets, + graphProcessor = GraphProcessor( + AssetManagerDiscoveryPlugin(context.assets), DefaultGraphLogger(level) ), gson = gson diff --git a/library/src/main/kotlin/io/github/wax911/library/persisted/query/AutomaticPersistedQueryCalculator.kt b/library/src/main/kotlin/io/github/wax911/library/persisted/query/AutomaticPersistedQueryCalculator.kt index cda1eef6..a249966c 100644 --- a/library/src/main/kotlin/io/github/wax911/library/persisted/query/AutomaticPersistedQueryCalculator.kt +++ b/library/src/main/kotlin/io/github/wax911/library/persisted/query/AutomaticPersistedQueryCalculator.kt @@ -17,6 +17,7 @@ package io.github.wax911.library.persisted.query import io.github.wax911.library.annotation.processor.contract.AbstractGraphProcessor +import io.github.wax911.library.logger.core.AbstractLogger import io.github.wax911.library.persisted.contract.IAutomaticPersistedQuery import java.math.BigInteger import java.security.MessageDigest @@ -30,7 +31,8 @@ import java.security.MessageDigest * @author Krillsson */ class AutomaticPersistedQueryCalculator( - private val processor: AbstractGraphProcessor + private val processor: AbstractGraphProcessor, + private val logger: AbstractLogger = processor.logger ) : IAutomaticPersistedQuery { private val apqHashes: MutableMap = HashMap() @@ -43,7 +45,6 @@ class AutomaticPersistedQueryCalculator( } private fun createAndStoreHash(queryName: String, fileKey: String): String? { - val logger = processor.logger logger.d(TAG, "Creating APQ hash for $queryName") return if (processor.graphFiles.containsKey(fileKey)) { val hashOfQuery = hashOfQuery(processor.graphFiles.getValue(fileKey)) diff --git a/library/src/main/kotlin/io/github/wax911/library/persistedquery/PersistedQueryHashCalculator.kt b/library/src/main/kotlin/io/github/wax911/library/persistedquery/PersistedQueryHashCalculator.kt index 925aa267..a0087155 100644 --- a/library/src/main/kotlin/io/github/wax911/library/persistedquery/PersistedQueryHashCalculator.kt +++ b/library/src/main/kotlin/io/github/wax911/library/persistedquery/PersistedQueryHashCalculator.kt @@ -19,6 +19,7 @@ package io.github.wax911.library.persistedquery import android.content.Context import io.github.wax911.library.annotation.processor.GraphProcessor import io.github.wax911.library.annotation.processor.contract.AbstractGraphProcessor +import io.github.wax911.library.annotation.processor.plugin.AssetManagerDiscoveryPlugin import java.math.BigInteger import java.security.MessageDigest @@ -42,7 +43,7 @@ class PersistedQueryHashCalculator(context: Context) { } private val graphProcessor: AbstractGraphProcessor by lazy { - GraphProcessor.getInstance(context.assets) + GraphProcessor(AssetManagerDiscoveryPlugin(context.assets)) } fun getOrCreateAPQHash(queryName: String): String? { diff --git a/library/src/test/kotlin/io/github/wax911/library/helpers/ResourcesDiscoveryPlugin.kt b/library/src/test/kotlin/io/github/wax911/library/helpers/ResourcesDiscoveryPlugin.kt index b7ad3079..a6316e49 100644 --- a/library/src/test/kotlin/io/github/wax911/library/helpers/ResourcesDiscoveryPlugin.kt +++ b/library/src/test/kotlin/io/github/wax911/library/helpers/ResourcesDiscoveryPlugin.kt @@ -14,7 +14,7 @@ class ResourcesDiscoveryPlugin( private val temporaryMap = HashMap() - private fun getResourceFolderFiles(url: URL): List? { + private fun getResourceFolderFiles(url: URL): List { val path = url.path val sequenceFiles = File(path).walk() return sequenceFiles.filter { @@ -42,7 +42,7 @@ class ResourcesDiscoveryPlugin( val urlPath = source.getResource(targetPath) if (urlPath != null) { val files = getResourceFolderFiles(urlPath) - files?.forEach { file -> + files.forEach { file -> val contents = resolveContents(file.inputStream(), logger) assert(contents.isNotEmpty()) { "Contents of a file that needs to be read should never be empty" diff --git a/settings.gradle.kts b/settings.gradle.kts index 074319b7..376f817b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,6 @@ rootProject.name= "retrofit-graphql" include(":library") -if (!System.getenv().containsKey("CI")) - include(":app") \ No newline at end of file +if (!System.getenv().containsKey("CI")) { + include(":app") +} \ No newline at end of file