Scaffold Gradle Wrapper differenly
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 28/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- android, react-native, typescript
- Ambito
- build-system, cli, developer-experience
Direzione di ricerca
Inizia con l’helper di aggiornamento della CLI e i file di template dell’app Android: android/gradle/wrapper/gradle-wrapper.properties, gradle-wrapper.jar, gradlew e gradlew.bat. Esamina gli entry point run-android e build-android, quindi esegui il comando wrapper documentato per comprendere il workflow attuale. Il lavoro è completato quando è stato concordato un approccio che mantenga gestibili per gli utenti gli aggiornamenti di wrapper senza creare rumore da upgrade-helper.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the Feature
I'm not sure how to name this feature, but I just wanted to share my thoughts on a problem which is affecting the CLI and can improve the developer experience somehow. Happy to collect opinion.
The current situation is that we have the following files committed in the new app template and in every project of users:
android/gradle/wrapper/gradle-wrapper.jar
android/gradle/wrapper/gradle-wrapper.properties
android/gradlew
android/gradlew.bat
Those files are The Gradle Wrapper, essentially scripts that download and execute the correct Gradle version.
The problem is that those files are committed in the repo of users, and create noise in the upgrade helper. For example: https://react-native-community.github.io/upgrade-helper/?from=0.67.5&to=0.68.6
With the upcoming version of React Native, we'll be having similar problems as the version of Gradle got updated and the Gradle Wrapper was also updated.
Binary files 0.71.1/RNDiffProj/android/gradle/wrapper/gradle-wrapper.jar and nightly/RNDiffProj/android/gradle/wrapper/gradle-wrapper.jar differ
diff --color -r 0.71.1/RNDiffProj/android/gradle/wrapper/gradle-wrapper.properties nightly/RNDiffProj/android/gradle/wrapper/gradle-wrapper.properties
3c3
< distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
---
> distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
diff --color -r 0.71.1/RNDiffProj/android/gradlew nightly/RNDiffProj/android/gradlew
207a208,213
> # Stop when "xargs" is not available.
> if ! command -v xargs >/dev/null 2>&1
> then
> die "xargs is not available"
> fi
>
diff --color -r 0.71.1/RNDiffProj/android/gradlew.bat nightly/RNDiffProj/android/gradlew.bat
17c17
< @if "%DEBUG%" == "" @echo off
---
> @if "%DEBUG%"=="" @echo off
28c28
< if "%DIRNAME%" == "" set DIRNAME=.
---
> if "%DIRNAME%"=="" set DIRNAME=.
43c43
< if "%ERRORLEVEL%" == "0" goto execute
---
> if %ERRORLEVEL% equ 0 goto execute
78c78
< if "%ERRORLEVEL%"=="0" goto mainEnd
---
> if %ERRORLEVEL% equ 0 goto mainEnd
83,84c83,86
< 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%
The problem is that we can't expect users to go inside the ./gradlew.bat (which is a Windows only file) to replicate the changes that the Gradle Wrapper brings over.
The problems are the following:
android/gradle/wrapper/gradle-wrapper.propertiesthis is probably the only file we want to commit (if any) as it contains the Gradle version.android/gradle/wrapper/gradle-wrapper.jarthis is a binary file. We can't expect users to go to the react-native repo to download the corresponding binaryandroid/gradlewthis is a bash script that has to be updated.android/gradlew.batthis is a windows bat script that has to be updated.
Simple Implementation
The updates to those mentioned files can be achieved easily by the user if they run
cd android && ./gradlew wrapper --gradle-version=<VERSION> --distribution-type=all
So we could simply update the upgrade helper to:
- Hide all the changes to the aformentioned files
- Show a popup to run the command mentioned above (or have some sort of util inside the CLI that runs that).
Still users could miss the popup on top and never update their Gradle Wrapper version (which could cause build failures).
More complicated implementation
Potentially we can:
- Ask the user to update only the
android/gradle/wrapper/gradle-wrapper.properties - Hide the changes to
gradlew,gradlew.bat, andgradle/wrapper/gradle-wrapper.jarfrom the upgrade helper. - Have checks on the
run-androidandbuild-androidcommands that check if the wrapper is up to date (i.e. by diffing the files against local versions of the wrapper), if not, run the command above that updates the wrapper for the user.
- Lingua principale
- TypeScript
- Stelle
- 2.9k
- Fork
- 949
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di react-native-community/cli
-
bug report
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
react-native-community/cli#2826 ·
-
bug report
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
react-native-community/cli#2825 ·
-
run-ios: "Unable to boot device in current state: Booted" alert when the simulator is already booted Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
react-native-community/cli#2820 ·
-
feature request
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
react-native-community/cli#2856 ·
-
FASOCARD Apertabug report
Difficoltà 5/5 Più di una settimana Idoneità per principianti 5/100
react-native-community/cli#2855 ·
Tutte le issue di react-native-community/cli
Issue simili
-
Browser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-javascript#24577 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agilepathway/label-checker#640 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
copse-dev/agent-pane#2953 ·
-
[aw] Upgrade available Apertaagentic-workflows
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
anomalyco/models.dev#7701 ·