Skip to content

Commit 9eb5979

Browse files
committed
Setup framework folder before running pip. Improved naming and documentation.
1 parent 9c37597 commit 9eb5979

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

build.gradle

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
// This file controls gradle, which we are using to install and update the RLBot framework used by this example bot.
2+
3+
// There's no java in this example, but we still need the plugin to make our strategy work for downloading
4+
// the framework zip.
15
apply plugin: 'java'
26

37
repositories {
4-
jcenter()
58
maven { url 'https://jitpack.io' }
69
}
710

811
dependencies {
9-
compile 'com.github.RLBot:RLBot:v4-SNAPSHOT:python@zip' // Fetch the python zip
12+
// Fetch the framework zip file. This will automatically stay up-to-date with the latest changes in the v4 branch.
13+
// This is useful for automatically getting fixes when the framework breaks due to Rocket League patches.
14+
// For different behavior, e.g. freezing at a specific version of the framework, see https://jitpack.io/docs/
15+
compile 'com.github.RLBot:RLBot:v4-SNAPSHOT:python@zip'
1016
}
1117

18+
// Handy helper method for finding the actual files involved with a compile dependency.
1219
def findFile(suffix) {
1320
configurations.compile.filter { it.name.endsWith(suffix) }
1421
}
1522

16-
task assemblePython(type: Copy) {
23+
// Extracts the RLBot framework zip into a directory in ./build/framework so it can be used by the bot.
24+
task prepareFrameworkDirectory(type: Copy) {
1725
from zipTree(findFile('python.zip').singleFile)
1826
into 'build/framework'
1927
}
2028

29+
// Uses pip (the python package manager) to install all the python packages needed for this bot, as defined
30+
// in requirements.txt.
2131
task pipInstallRequirements(type: Exec) {
2232
commandLine "pip", "install", "-r", "requirements.txt"
2333
}
@@ -26,6 +36,11 @@ task tournamentZip(type: Zip) {
2636
from fileTree(dir: 'python_example', exclude: '**/__pycache__')
2737
}
2838

29-
processResources.dependsOn assemblePython
30-
assemblePython.dependsOn pipInstallRequirements
39+
// Installs or updates RLBot. Empty task for now. It still does stuff because it "dependsOn" tasks that do things.
40+
task updateRLBot
41+
updateRLBot.dependsOn pipInstallRequirements
42+
updateRLBot.dependsOn prepareFrameworkDirectory
3143

44+
// Must prepare the framework directory before running pip because the requirements.txt file references another one
45+
// inside the framework directory.
46+
pipInstallRequirements.dependsOn prepareFrameworkDirectory

run.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@rem Change the working directory to the location of this file so that relative paths will work
22
cd /D "%~dp0"
33

4-
call ./gradlew.bat --no-daemon assemblePython
4+
call ./gradlew.bat --no-daemon updateRLBot
55

66
python ./build/framework/runner.py

0 commit comments

Comments
 (0)