Skip to content

Commit

Permalink
Add documentation for gradle-wrapper.properties binding (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonydahanne authored Oct 23, 2023
1 parent a7a54dd commit c3c9783
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/java-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ jobs:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('java/gradle/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- run: ./gradlew build
# simulate the bindings
- run: cp bindings/gradle-wrapper/gradle-wrapper.properties gradle/wrapper/gradle-wrapper.properties && ./gradlew build
working-directory: java/gradle
18 changes: 13 additions & 5 deletions java/gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@ See [prerequisites](https://paketo.io/docs/howto/java/#prerequisites) of this sa
## Building

```bash
pack build applications/gradle --env BP_JVM_VERSION=17
pack build applications/gradle
```

Alternatively, if you want to attach a `gradle.properties` file to pass additional configuration to Gradle.
Alternatively, if you want to attach a `gradle.properties` and/or a `gradle-wrapper.properties` file to pass additional configuration to Gradle (Wrapper).

```bash
pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings --env BP_JVM_VERSION=17
pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings
```

The command above will use the sample `gradle.properties` file from this repo. It may be more useful to copy your local `gradle.properties` file first.
The command above will use:

* the sample `gradle.properties` file from this repo. It may be more useful to copy your local `gradle.properties` file first.

```bash
cp ~/.gradle/gradle.properties java/gradle/bindings/gradle/gradle.properties
pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings --env BP_JVM_VERSION=17
pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings
```

* the sample `gradle-wrapper.properties` file from this repo. It may be more useful to copy your local `gradle-wrapper.properties` file first.

```bash
cp ~/gradle/wrapper/gradle-wrapper.properties java/gradle/bindings/gradle-wrapper/gradle-wrapper.properties
pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings

## Running

```bash
Expand Down
2 changes: 2 additions & 0 deletions java/gradle/bindings/gradle-wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=60000
1 change: 1 addition & 0 deletions java/gradle/bindings/gradle-wrapper/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gradle-wrapper
4 changes: 2 additions & 2 deletions java/gradle/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
networkTimeout=10000
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
networkTimeout=1
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 4 additions & 0 deletions java/gradle/smoke_test/gradle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func testGradleWithBuilder(builder string) func(*testing.T, spec.G, spec.S) {
}).
WithBuilder(builder).
WithGID("123").
WithEnv(map[string]string{
"SERVICE_BINDING_ROOT": "/bindings",
}).
WithVolumes(fmt.Sprintf("%s:/bindings/gradle-wrapper", filepath.Join(source, "bindings/gradle-wrapper"))).
Execute(name, source)
Expect(err).ToNot(HaveOccurred(), logs.String)

Expand Down

0 comments on commit c3c9783

Please sign in to comment.