Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let gradle cache some build artifacts #154

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cosven
Copy link

@cosven cosven commented Mar 17, 2025

Try to fix #153 .

Note that I'm not familiar with Gradle and the code is generated by AI. And the code looks good :)

@CLAassistant
Copy link

CLAassistant commented Mar 17, 2025

CLA assistant check
All committers have signed the CLA.

@FeodorFitsner
Copy link
Contributor

Alright, alright, I've done my homework too and used ChatGPT to check your PR! 😈

Got this:

The pull request #154 introduces changes to the src/serious_python_android/android/build.gradle file to enhance Gradle’s caching of build artifacts. This optimization aims to improve build efficiency by leveraging Gradle’s caching mechanisms.

Key Changes in build.gradle:

Enable Gradle Build Cache:

buildCache {
    local {
        enabled = true
    }
}

I don't know if that setting is real or hallucination, but look at your log in #153 (comment) which says Build cache is disabled.

So, I guess in addition to your changes the build cache should be disabled. Right?

@cosven
Copy link
Author

cosven commented Mar 18, 2025

I read the Gradle output carefully and found a way to debug this PR.
I modified the file ~/.pub-cache/hosted/pub.flutter-io.cn/serious_python_android-0.9.2/android/build.gradle and ran flutter run --version again. Unlocky, this PR does not work. The command output looks like the following

[        ]   Gradle does not know how file '/Users/cosven/code/mobile/feeluownx/build/serious_python_android/python-android-arm64-v8a.tar.gz' was created (output property '$1'). Task output caching requires exclusive access to output paths to guarantee correctness (i.e. multiple tasks are not allowed to produce output in the same location).
[        ] Task ':serious_python_android:downloadDistArchive_arm64-v8a' is not up-to-date because:
[        ]   Task.upToDateWhen is false.
[        ] Download https://github.com/flet-dev/python-build/releases/download/v3.12/python-android-dart-3.12-arm64-v8a.tar.gz
[+7549 ms] ensureAnalyticsSent: 252ms
[        ] Running 0 shutdown hooks
[        ] Shutdown hooks complete
[ +108 ms] Running Gradle task 'assembleRelease'... (completed in 12.1s)
[  +31 ms] "flutter apk" took 12,763ms.
[  +93 ms] exiting with code 0

So I spent some time learning the details of the Gradle Download task. There is a parameter named onlyIfModified.

true if the file should only be downloaded if it has been modified on the server since the last download (default: false)

I tried the parameter and it did solve the problem.

[+1989 ms] > Task :serious_python_android:downloadDistArchive_arm64-v8a
[        ] Caching disabled for task ':serious_python_android:downloadDistArchive_arm64-v8a' because:
[        ]   Caching has not been enabled for the task
[        ] Task ':serious_python_android:downloadDistArchive_arm64-v8a' is not up-to-date because:
[        ]   Task.upToDateWhen is false.
[        ] Download https://github.com/flet-dev/python-build/releases/download/v3.12/python-android-dart-3.12-arm64-v8a.tar.gz
[+1004 ms] Not modified. Skipping 'https://github.com/flet-dev/python-build/releases/download/v3.12/python-android-dart-3.12-arm64-v8a.tar.gz'
[        ] > Task :serious_python_android:downloadDistArchive_arm64-v8a UP-TO-DATE

@cosven
Copy link
Author

cosven commented Mar 18, 2025

I guess in addition to your changes the build cache should be disabled. Right?

Before, I did not add any settings to disable the Gradle build cache.

I did not modify any settings related to Gradle because I'm not familiar with it :)


Edit: by the way, I use serious-python in the FeelUOwnX project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flutter rebuild serious-python every time
3 participants