├── 0-base
├── .dockerignore
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── IndexController.java
│ │ │ └── ExampleApplication.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── Tiltfile
├── Dockerfile
├── kubernetes.yaml
├── build.gradle
├── gradlew.bat
└── gradlew
├── 101-jib
├── .dockerignore
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── ExampleApplication.java
│ │ │ └── IndexController.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── record-start-time.sh
├── kubernetes.yaml
├── Tiltfile
├── build.gradle
├── gradlew.bat
└── gradlew
├── 1-measured
├── .dockerignore
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── ExampleApplication.java
│ │ │ └── IndexController.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── Dockerfile
├── kubernetes.yaml
├── Tiltfile
├── record-start-time.py
├── build.gradle
├── gradlew.bat
└── gradlew
├── 102-jib-live-update
├── .dockerignore
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── ExampleApplication.java
│ │ │ └── IndexController.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── Dockerfile.base
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── record-start-time.sh
├── kubernetes.yaml
├── Tiltfile
├── build.gradle
└── gradlew.bat
├── .gitattributes
├── 103-micronaut
├── gradle.properties
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.yml
│ │ │ └── logback.xml
│ │ └── java
│ │ │ └── hello
│ │ │ └── world
│ │ │ ├── Application.java
│ │ │ └── HelloController.java
│ └── test
│ │ └── java
│ │ └── hello
│ │ └── world
│ │ └── HelloWorldTest.java
├── .gitignore
├── micronaut-cli.yml
├── Tiltfile
├── kubernetes.yaml
├── build.gradle
├── gradlew.bat
└── gradlew
├── 2-optimized
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── ExampleApplication.java
│ │ │ └── IndexController.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── Dockerfile
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── kubernetes.yaml
├── record-start-time.py
├── Tiltfile
├── build.gradle
├── gradlew.bat
└── gradlew
├── 3-unpacked
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── ExampleApplication.java
│ │ │ └── IndexController.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── Dockerfile
├── kubernetes.yaml
├── record-start-time.py
├── build.gradle
├── Tiltfile
├── gradlew.bat
└── gradlew
├── 4-recommended
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── ExampleApplication.java
│ │ │ └── IndexController.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── tilt_modules
│ ├── restart_process
│ │ ├── .gitignore
│ │ ├── test
│ │ │ ├── Dockerfile
│ │ │ ├── test.sh
│ │ │ ├── Tiltfile
│ │ │ ├── job.yaml
│ │ │ ├── fail.sh
│ │ │ ├── custom.Tiltfile
│ │ │ ├── test-custom.sh
│ │ │ └── test-docker.sh
│ │ ├── Dockerfile
│ │ ├── release.sh
│ │ ├── tilt-restart-wrapper.go
│ │ └── Tiltfile
│ └── extensions.json
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── Dockerfile
├── kubernetes.yaml
├── record-start-time.py
├── build.gradle
├── Tiltfile
├── gradlew.bat
└── gradlew
├── 401-spring-boot-layertools
├── settings.gradle
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ │ └── pets.png
│ │ │ └── templates
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── dev
│ │ │ └── tilt
│ │ │ └── example
│ │ │ ├── ExampleApplication.java
│ │ │ └── IndexController.java
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ └── ExampleApplicationTests.java
├── tilt_modules
│ ├── restart_process
│ │ ├── .gitignore
│ │ ├── test
│ │ │ ├── Dockerfile
│ │ │ ├── test.sh
│ │ │ ├── Tiltfile
│ │ │ ├── job.yaml
│ │ │ ├── fail.sh
│ │ │ ├── custom.Tiltfile
│ │ │ ├── test-custom.sh
│ │ │ └── test-docker.sh
│ │ ├── Dockerfile
│ │ ├── release.sh
│ │ ├── tilt-restart-wrapper.go
│ │ └── Tiltfile
│ └── extensions.json
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── Dockerfile
├── kubernetes.yaml
├── record-start-time.py
├── build.gradle
├── Tiltfile
└── gradlew.bat
├── 201-quarkus-live-update
├── .gitignore
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ ├── microprofile-config.properties
│ │ │ │ └── resources
│ │ │ │ └── index.html
│ │ ├── docker
│ │ │ └── Dockerfile
│ │ ├── java
│ │ │ └── dev
│ │ │ │ └── tilt
│ │ │ │ └── example
│ │ │ │ └── GreetingResource.java
│ │ └── kubernetes
│ │ │ └── app.yaml
│ └── test
│ │ └── java
│ │ └── dev
│ │ └── tilt
│ │ └── example
│ │ ├── NativeGreetingResourceIT.java
│ │ └── GreetingResourceTest.java
├── poll.sh
├── Tiltfile
├── Tiltfile.buildah
├── README.md
└── pom.xml
├── NOTICE
├── .circleci
└── config.yml
├── .gitignore
├── test
├── test.ps1
└── test.sh
└── README.md
/0-base/.dockerignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build
--------------------------------------------------------------------------------
/101-jib/.dockerignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build
--------------------------------------------------------------------------------
/1-measured/.dockerignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build
--------------------------------------------------------------------------------
/102-jib-live-update/.dockerignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.sh text eol=lf
2 | gradlew text eol=lf
--------------------------------------------------------------------------------
/0-base/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/101-jib/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/103-micronaut/gradle.properties:
--------------------------------------------------------------------------------
1 | micronautVersion=4.2.1
2 |
--------------------------------------------------------------------------------
/1-measured/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/2-optimized/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/3-unpacked/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/4-recommended/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/102-jib-live-update/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/0-base/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/1-measured/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/101-jib/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/3-unpacked/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/103-micronaut/settings.gradle:
--------------------------------------------------------------------------------
1 |
2 | rootProject.name="hello-world"
3 |
4 |
--------------------------------------------------------------------------------
/2-optimized/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/4-recommended/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/.gitignore:
--------------------------------------------------------------------------------
1 | tilt-restart-wrapper
2 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 |
--------------------------------------------------------------------------------
/102-jib-live-update/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=8000
2 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/.gitignore:
--------------------------------------------------------------------------------
1 | tilt-restart-wrapper
2 |
--------------------------------------------------------------------------------
/102-jib-live-update/Dockerfile.base:
--------------------------------------------------------------------------------
1 | FROM eclipse-temurin:17-jre-alpine
2 |
3 | RUN apk add entr
4 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/.gitignore:
--------------------------------------------------------------------------------
1 | .stfolder
2 | .settings
3 | .settings/*
4 | .project
5 | .editorconfig
6 | target
7 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/src/main/resources/META-INF/microprofile-config.properties:
--------------------------------------------------------------------------------
1 | # Configuration file
2 | key = value
3 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM busybox
2 |
3 | COPY fail.sh /
4 |
5 | ENTRYPOINT /fail.sh
6 |
--------------------------------------------------------------------------------
/2-optimized/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM eclipse-temurin:17-jre-alpine
2 |
3 | ADD . .
4 |
5 | ENTRYPOINT java -jar example-0.0.1-SNAPSHOT.jar
6 |
--------------------------------------------------------------------------------
/0-base/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/0-base/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM busybox
2 |
3 | COPY fail.sh /
4 |
5 | ENTRYPOINT /fail.sh
6 |
--------------------------------------------------------------------------------
/0-base/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/0-base/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/101-jib/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/101-jib/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/101-jib/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/101-jib/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/1-measured/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/1-measured/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/1-measured/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/1-measured/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/2-optimized/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/2-optimized/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/3-unpacked/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/3-unpacked/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/3-unpacked/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/3-unpacked/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Tilt Example Java
2 | Copyright 2022 Docker, Inc.
3 |
4 | This product includes software developed at Docker, Inc. (https://www.docker.com).
5 |
--------------------------------------------------------------------------------
/103-micronaut/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/103-micronaut/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/2-optimized/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/2-optimized/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/4-recommended/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/4-recommended/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/4-recommended/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/4-recommended/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | cd $(dirname $0)
6 | ./test-docker.sh
7 | ./test-custom.sh
8 |
--------------------------------------------------------------------------------
/102-jib-live-update/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/102-jib-live-update/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/102-jib-live-update/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/102-jib-live-update/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | cd $(dirname $0)
6 | ./test-docker.sh
7 | ./test-custom.sh
8 |
--------------------------------------------------------------------------------
/0-base/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | docker_build('example-java-image', '.')
4 | k8s_yaml('kubernetes.yaml')
5 | k8s_resource('example-java', port_forwards=8000)
6 |
--------------------------------------------------------------------------------
/103-micronaut/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | micronaut:
2 | application:
3 | name: helloWorld
4 | netty:
5 | default:
6 | allocator:
7 | max-order: 3
8 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/poll.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | url=http://localhost:8080/hello
4 |
5 | while true
6 | do
7 | curl $url
8 | echo " "
9 | sleep 5
10 | done
11 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/src/main/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM maven
2 | WORKDIR /project
3 | ADD src /project/src
4 | ADD pom.xml /project/pom.xml
5 | ENTRYPOINT mvn quarkus:dev
6 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/401-spring-boot-layertools/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/401-spring-boot-layertools/src/main/resources/static/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tilt-dev/tilt-example-java/HEAD/401-spring-boot-layertools/src/main/resources/static/pets.png
--------------------------------------------------------------------------------
/103-micronaut/.gitignore:
--------------------------------------------------------------------------------
1 | Thumbs.db
2 | .DS_Store
3 | .gradle
4 | build/
5 | target/
6 | out/
7 | .micronaut/
8 | .idea
9 | *.iml
10 | *.ipr
11 | *.iws
12 | .project
13 | .settings
14 | .classpath
15 | .factorypath
16 |
--------------------------------------------------------------------------------
/0-base/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM eclipse-temurin:17-jdk-alpine
2 |
3 | ADD . .
4 |
5 | RUN ./gradlew --no-daemon bootJar
6 |
7 | # We could also use ./gradlew bootRun here
8 | ENTRYPOINT java -jar build/libs/example-0.0.1-SNAPSHOT.jar
9 |
--------------------------------------------------------------------------------
/1-measured/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM eclipse-temurin:17-jdk-alpine
2 |
3 | ADD . .
4 |
5 | RUN ./gradlew --no-daemon bootJar
6 |
7 | # We could also use ./gradlew bootRun here
8 | ENTRYPOINT java -jar build/libs/example-0.0.1-SNAPSHOT.jar
9 |
--------------------------------------------------------------------------------
/3-unpacked/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM eclipse-temurin:17-jre-alpine
2 |
3 | WORKDIR /app
4 | ADD BOOT-INF/lib /app/lib
5 | ADD META-INF /app/META-INF
6 | ADD BOOT-INF/classes /app
7 |
8 | ENTRYPOINT java -cp .:./lib/* dev.tilt.example.ExampleApplication
9 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "Extensions": [
3 | {
4 | "Name": "restart_process",
5 | "ExtensionRegistry": "https://github.com/tilt-dev/tilt-extensions",
6 | "TimeFetched": "2021-04-30T16:17:43.124524-04:00"
7 | }
8 | ]
9 | }
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/Tiltfile:
--------------------------------------------------------------------------------
1 | load('../Tiltfile', 'docker_build_with_restart')
2 |
3 | k8s_yaml('job.yaml')
4 | docker_build_with_restart('failing_job', '.', '/fail.sh',
5 | live_update=[sync('./fail.sh', '/fail.sh')])
6 |
--------------------------------------------------------------------------------
/4-recommended/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM eclipse-temurin:17-jre-alpine
2 |
3 | RUN apk add entr
4 |
5 | WORKDIR /app
6 | ADD BOOT-INF/lib /app/lib
7 | ADD META-INF /app/META-INF
8 | ADD BOOT-INF/classes /app
9 |
10 | ENTRYPOINT java -cp .:./lib/* dev.tilt.example.ExampleApplication
11 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "Extensions": [
3 | {
4 | "Name": "restart_process",
5 | "ExtensionRegistry": "https://github.com/tilt-dev/tilt-extensions",
6 | "TimeFetched": "2021-04-30T16:17:43.124524-04:00"
7 | }
8 | ]
9 | }
--------------------------------------------------------------------------------
/103-micronaut/src/main/java/hello/world/Application.java:
--------------------------------------------------------------------------------
1 | package hello.world;
2 |
3 | import io.micronaut.runtime.Micronaut;
4 |
5 | public class Application {
6 |
7 | public static void main(String[] args) {
8 | Micronaut.run(Application.class, args);
9 | }
10 | }
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/Tiltfile:
--------------------------------------------------------------------------------
1 | load('../Tiltfile', 'docker_build_with_restart')
2 |
3 | k8s_yaml('job.yaml')
4 | docker_build_with_restart('failing_job', '.', '/fail.sh',
5 | live_update=[sync('./fail.sh', '/fail.sh')])
6 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM eclipse-temurin:17-jre-alpine
2 |
3 | RUN apk add entr
4 |
5 | WORKDIR /app
6 | ADD dependencies/ ./
7 | ADD spring-boot-loader/ ./
8 | ADD snapshot-dependencies/ ./
9 | ADD application/ ./
10 | ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
11 |
--------------------------------------------------------------------------------
/0-base/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/101-jib/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/job.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: batch/v1
2 | kind: Job
3 | metadata:
4 | name: failing-job
5 | spec:
6 | template:
7 | spec:
8 | containers:
9 | - name: failing-job
10 | image: failing_job
11 | restartPolicy: Never
12 | backoffLimit: 4
13 |
--------------------------------------------------------------------------------
/1-measured/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/103-micronaut/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/2-optimized/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/3-unpacked/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/4-recommended/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/102-jib-live-update/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/103-micronaut/micronaut-cli.yml:
--------------------------------------------------------------------------------
1 | applicationType: default
2 | defaultPackage: hello.world
3 | testFramework: junit
4 | sourceLanguage: java
5 | buildTool: gradle
6 | features: [annotation-api, app-name, gradle, http-client, jackson-databind, java, java-application, junit, logback, micronaut-build, netty-server, readme, shade, yaml]
7 |
--------------------------------------------------------------------------------
/0-base/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/101-jib/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/src/test/java/dev/tilt/example/NativeGreetingResourceIT.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import io.quarkus.test.junit.SubstrateTest;
4 |
5 | @SubstrateTest
6 | public class NativeGreetingResourceIT extends GreetingResourceTest {
7 |
8 | // Execute the same tests but in native mode.
9 | }
10 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/fail.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo "Are you there, pod?"
4 | sleep 1
5 |
6 | # Exit with a non-zero status code; we check that docker_build_with_restart
7 | # surfaces this error code to k8s, so k8s knows that the job failed.
8 | echo "Exiting with status code 123 😱"
9 | exit 123
10 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/job.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: batch/v1
2 | kind: Job
3 | metadata:
4 | name: failing-job
5 | spec:
6 | template:
7 | spec:
8 | containers:
9 | - name: failing-job
10 | image: failing_job
11 | restartPolicy: Never
12 | backoffLimit: 4
13 |
--------------------------------------------------------------------------------
/1-measured/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/2-optimized/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/3-unpacked/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/4-recommended/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/102-jib-live-update/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/fail.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | echo "Are you there, pod?"
4 | sleep 1
5 |
6 | # Exit with a non-zero status code; we check that docker_build_with_restart
7 | # surfaces this error code to k8s, so k8s knows that the job failed.
8 | echo "Exiting with status code 123 😱"
9 | exit 123
10 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/custom.Tiltfile:
--------------------------------------------------------------------------------
1 | load('../Tiltfile', 'custom_build_with_restart')
2 |
3 | k8s_yaml('job.yaml')
4 | custom_build_with_restart(
5 | 'failing_job',
6 | command='docker build -t $EXPECTED_REF .',
7 | deps=['fail.sh'],
8 | entrypoint='/fail.sh',
9 | live_update=[sync('./fail.sh', '/fail.sh')])
10 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/src/test/java/dev/tilt/example/ExampleApplicationTests.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class ExampleApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2.1
2 | jobs:
3 | build:
4 | docker:
5 | - image: docker/tilt:latest
6 |
7 | steps:
8 | - checkout
9 | - setup_remote_docker
10 | - run: apt update && apt install -y openjdk-17-jdk unzip rsync python3
11 | - run: ctlptl create cluster kind --registry=ctlptl-registry && test/test.sh
12 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/custom.Tiltfile:
--------------------------------------------------------------------------------
1 | load('../Tiltfile', 'custom_build_with_restart')
2 |
3 | k8s_yaml('job.yaml')
4 | custom_build_with_restart(
5 | 'failing_job',
6 | command='docker build -t $EXPECTED_REF .',
7 | deps=['fail.sh'],
8 | entrypoint='/fail.sh',
9 | live_update=[sync('./fail.sh', '/fail.sh')])
10 |
--------------------------------------------------------------------------------
/101-jib/record-start-time.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | tmpfile=$(mktemp /tmp/tilt-example-java.XXXXXX)
6 | cat src/main/java/dev/tilt/example/IndexController.java | \
7 | sed -e "s/startTimeSecs = .*;/startTimeSecs = $(date +%-s);/" | \
8 | sed -e "s/startTimeNanos = .*;/startTimeNanos = $(date +%-N);/" > \
9 | $tmpfile
10 | mv $tmpfile src/main/java/dev/tilt/example/IndexController.java
11 |
--------------------------------------------------------------------------------
/102-jib-live-update/record-start-time.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | tmpfile=$(mktemp /tmp/tilt-example-java.XXXXXX)
6 | cat src/main/java/dev/tilt/example/IndexController.java | \
7 | sed -e "s/startTimeSecs = .*;/startTimeSecs = $(date +%-s);/" | \
8 | sed -e "s/startTimeNanos = .*;/startTimeNanos = $(date +%-N);/" > \
9 | $tmpfile
10 | mv $tmpfile src/main/java/dev/tilt/example/IndexController.java
11 |
--------------------------------------------------------------------------------
/103-micronaut/src/main/java/hello/world/HelloController.java:
--------------------------------------------------------------------------------
1 | package hello.world;
2 |
3 | import io.micronaut.http.MediaType;
4 | import io.micronaut.http.annotation.Controller;
5 | import io.micronaut.http.annotation.Get;
6 |
7 | @Controller("/")
8 | public class HelloController {
9 |
10 | @Get(produces = MediaType.TEXT_PLAIN)
11 | public String index() {
12 | return "Hello World";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/src/main/java/dev/tilt/example/GreetingResource.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import javax.ws.rs.GET;
4 | import javax.ws.rs.Path;
5 | import javax.ws.rs.Produces;
6 | import javax.ws.rs.core.MediaType;
7 |
8 | @Path("/hello")
9 | public class GreetingResource {
10 |
11 | @GET
12 | @Produces(MediaType.TEXT_PLAIN)
13 | public String hello() {
14 | return "hello";
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/0-base/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/103-micronaut/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # example-java-image is set in build.gradle.
4 | #
5 | # The gradle docker plugin always builds to the same image name,
6 | # so we need to re-tag.
7 | custom_build(
8 | 'example-java-image',
9 | './gradlew dockerBuild && docker tag example-java-image $EXPECTED_REF',
10 | deps=['src'])
11 | k8s_yaml('kubernetes.yaml')
12 | k8s_resource('example-java', port_forwards=8080)
13 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | docker_build(
4 | 'quarkus-sync-image',
5 | '.',
6 | dockerfile='./src/main/docker/Dockerfile',
7 | live_update=[sync('./src/', '/project/src'),
8 | sync('./src/pom.xml', '/project/pom.xml') ],
9 | entrypoint = 'mvn quarkus:dev')
10 |
11 | k8s_yaml('src/main/kubernetes/app.yaml')
12 | k8s_resource('quarkus-sync-demo', port_forwards=[8080,5005])
13 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/test-custom.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd $(dirname $0)
4 |
5 | set -x
6 | tilt ci -f custom.Tiltfile > tilt.log 2>&1
7 | CI_EXIT=$?
8 |
9 | tilt down
10 |
11 | if [ $CI_EXIT -eq 0 ]; then
12 | echo "Expected 'tilt ci' to fail, but succeeded."
13 | exit 1
14 | fi
15 |
16 | cat tilt.log | grep -q "Are you there, pod?"
17 | GREP_EXIT=$?
18 |
19 | rm tilt.log
20 |
21 | exit $GREP_EXIT
22 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine/git
2 |
3 | RUN apk update && apk add make
4 | RUN apk add build-base
5 |
6 | RUN git clone https://github.com/eradman/entr.git /entr
7 | WORKDIR /entr
8 | RUN git checkout c564e6bdca1dfe2177d1224363cad734158863ad
9 | RUN ./configure; CFLAGS="-static" make install
10 |
11 | FROM scratch
12 |
13 | COPY --from=0 /usr/local/bin/entr /
14 |
15 | ADD tilt-restart-wrapper /
16 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/test-custom.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd $(dirname $0)
4 |
5 | set -x
6 | tilt ci -f custom.Tiltfile > tilt.log 2>&1
7 | CI_EXIT=$?
8 |
9 | tilt down
10 |
11 | if [ $CI_EXIT -eq 0 ]; then
12 | echo "Expected 'tilt ci' to fail, but succeeded."
13 | exit 1
14 | fi
15 |
16 | cat tilt.log | grep -q "Are you there, pod?"
17 | GREP_EXIT=$?
18 |
19 | rm tilt.log
20 |
21 | exit $GREP_EXIT
22 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine/git
2 |
3 | RUN apk update && apk add make
4 | RUN apk add build-base
5 |
6 | RUN git clone https://github.com/eradman/entr.git /entr
7 | WORKDIR /entr
8 | RUN git checkout c564e6bdca1dfe2177d1224363cad734158863ad
9 | RUN ./configure; CFLAGS="-static" make install
10 |
11 | FROM scratch
12 |
13 | COPY --from=0 /usr/local/bin/entr /
14 |
15 | ADD tilt-restart-wrapper /
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 |
25 | */build/
26 | */.gradle/
27 | !*/gradle/wrapper/gradle-wrapper.jar
28 |
--------------------------------------------------------------------------------
/0-base/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/101-jib/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/1-measured/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/2-optimized/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/3-unpacked/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/103-micronaut/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8080
21 |
--------------------------------------------------------------------------------
/4-recommended/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/102-jib-live-update/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: example-java
5 | labels:
6 | app: example-java
7 | spec:
8 | selector:
9 | matchLabels:
10 | app: example-java
11 | template:
12 | metadata:
13 | labels:
14 | app: example-java
15 | spec:
16 | containers:
17 | - name: example-java
18 | image: example-java-image
19 | ports:
20 | - containerPort: 8000
21 |
--------------------------------------------------------------------------------
/1-measured/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # Records the current time, then kicks off a server update.
4 | # Normally, you would let Tilt do deploys automatically, but this
5 | # shows you how to set up a custom workflow that measures it.
6 | local_resource(
7 | 'deploy',
8 | 'python3 record-start-time.py',
9 | )
10 |
11 | docker_build('example-java-image', '.')
12 | k8s_yaml('kubernetes.yaml')
13 | k8s_resource('example-java', port_forwards=8000,
14 | resource_deps=['deploy'])
15 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/Tiltfile.buildah:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | custom_build(
4 | 'quarkus-sync-image',
5 | deps=['.'],
6 | command='buildah bud -t $EXPECTED_REF -f ./src/main/docker/Dockerfile . && buildah push $EXPECTED_REF $EXPECTED_REF',
7 | skips_local_docker = True,
8 | live_update = [
9 | sync('./src/', '/project/src'),
10 | sync('./src/pom.xml', '/project/pom.xml')
11 | ],
12 | entrypoint = 'mvn quarkus:dev')
13 |
14 | k8s_yaml('src/main/kubernetes/app.yaml')
15 | k8s_resource('quarkus-sync-demo', port_forwards=[8080,5005])
16 |
--------------------------------------------------------------------------------
/1-measured/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 | Time from "deploy" button pressed → server up:
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/101-jib/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 | Time from "deploy" button pressed → server up:
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/3-unpacked/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 | Time from "deploy" button pressed → server up:
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/2-optimized/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 | Time from "deploy" button pressed → server up:
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/4-recommended/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 | Time from "deploy" button pressed → server up:
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/0-base/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.Model;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 |
8 | @Controller
9 | public class IndexController {
10 |
11 | @GetMapping("/")
12 | public String index(Model model) {
13 | // Serves the index.html template under
14 | // src/main/resources/templates/index.html
15 | return "index";
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/101-jib/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # Records the current time, then kicks off a server update.
4 | # Normally, you would let Tilt do deploys automatically, but this
5 | # shows you how to set up a custom workflow that measures it.
6 | local_resource(
7 | 'deploy',
8 | './record-start-time.sh',
9 | )
10 |
11 | custom_build(
12 | 'example-java-image',
13 | './gradlew jibDockerBuild --image $EXPECTED_REF',
14 | deps=['src'])
15 | k8s_yaml('kubernetes.yaml')
16 | k8s_resource('example-java', port_forwards=8000,
17 | resource_deps=['deploy'])
18 |
--------------------------------------------------------------------------------
/102-jib-live-update/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 | Time from "deploy" button pressed → server up:
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/103-micronaut/src/test/java/hello/world/HelloWorldTest.java:
--------------------------------------------------------------------------------
1 | package hello.world;
2 |
3 | import io.micronaut.runtime.EmbeddedApplication;
4 | import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
5 | import org.junit.jupiter.api.Test;
6 | import org.junit.jupiter.api.Assertions;
7 |
8 | import jakarta.inject.Inject;
9 |
10 | @MicronautTest
11 | class HelloWorldTest {
12 |
13 | @Inject
14 | EmbeddedApplication> application;
15 |
16 | @Test
17 | void testItWorks() {
18 | Assertions.assertTrue(application.isRunning());
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
Hello cats!
7 |
8 | Time from "deploy" button pressed → server up:
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/src/test/java/dev/tilt/example/GreetingResourceTest.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import io.quarkus.test.junit.QuarkusTest;
4 | import org.junit.jupiter.api.Test;
5 |
6 | import static io.restassured.RestAssured.given;
7 | import static org.hamcrest.CoreMatchers.is;
8 |
9 | @QuarkusTest
10 | public class GreetingResourceTest {
11 |
12 | @Test
13 | public void testHelloEndpoint() {
14 | given()
15 | .when().get("/hello")
16 | .then()
17 | .statusCode(200)
18 | .body(is("hello"));
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/0-base/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/1-measured/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/101-jib/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/3-unpacked/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/103-micronaut/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
7 |
8 | %cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/2-optimized/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/4-recommended/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/102-jib-live-update/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/src/main/java/dev/tilt/example/ExampleApplication.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | @SpringBootApplication
10 | public class ExampleApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ExampleApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/1-measured/record-start-time.py:
--------------------------------------------------------------------------------
1 | import re
2 | import time
3 |
4 | filename = "src/main/java/dev/tilt/example/IndexController.java"
5 | f = open(filename, "r")
6 | contents = f.read()
7 | f.close()
8 |
9 | timestamp_sec = int(time.time())
10 | timestamp_nano = (float(time.time()) - timestamp_sec) * 1000 * 1000 * 1000
11 | contents = re.sub(r'startTimeSecs = .*;',
12 | "startTimeSecs = %d;" % timestamp_sec,
13 | contents)
14 | contents = re.sub(r'startTimeNanos = .*;',
15 | "startTimeNanos = %d;" % timestamp_nano,
16 | contents)
17 |
18 | f = open(filename, "w")
19 | f.write(contents)
20 | f.close()
--------------------------------------------------------------------------------
/2-optimized/record-start-time.py:
--------------------------------------------------------------------------------
1 | import re
2 | import time
3 |
4 | filename = "src/main/java/dev/tilt/example/IndexController.java"
5 | f = open(filename, "r")
6 | contents = f.read()
7 | f.close()
8 |
9 | timestamp_sec = int(time.time())
10 | timestamp_nano = (float(time.time()) - timestamp_sec) * 1000 * 1000 * 1000
11 | contents = re.sub(r'startTimeSecs = .*;',
12 | "startTimeSecs = %d;" % timestamp_sec,
13 | contents)
14 | contents = re.sub(r'startTimeNanos = .*;',
15 | "startTimeNanos = %d;" % timestamp_nano,
16 | contents)
17 |
18 | f = open(filename, "w")
19 | f.write(contents)
20 | f.close()
--------------------------------------------------------------------------------
/3-unpacked/record-start-time.py:
--------------------------------------------------------------------------------
1 | import re
2 | import time
3 |
4 | filename = "src/main/java/dev/tilt/example/IndexController.java"
5 | f = open(filename, "r")
6 | contents = f.read()
7 | f.close()
8 |
9 | timestamp_sec = int(time.time())
10 | timestamp_nano = (float(time.time()) - timestamp_sec) * 1000 * 1000 * 1000
11 | contents = re.sub(r'startTimeSecs = .*;',
12 | "startTimeSecs = %d;" % timestamp_sec,
13 | contents)
14 | contents = re.sub(r'startTimeNanos = .*;',
15 | "startTimeNanos = %d;" % timestamp_nano,
16 | contents)
17 |
18 | f = open(filename, "w")
19 | f.write(contents)
20 | f.close()
--------------------------------------------------------------------------------
/4-recommended/record-start-time.py:
--------------------------------------------------------------------------------
1 | import re
2 | import time
3 |
4 | filename = "src/main/java/dev/tilt/example/IndexController.java"
5 | f = open(filename, "r")
6 | contents = f.read()
7 | f.close()
8 |
9 | timestamp_sec = int(time.time())
10 | timestamp_nano = (float(time.time()) - timestamp_sec) * 1000 * 1000 * 1000
11 | contents = re.sub(r'startTimeSecs = .*;',
12 | "startTimeSecs = %d;" % timestamp_sec,
13 | contents)
14 | contents = re.sub(r'startTimeNanos = .*;',
15 | "startTimeNanos = %d;" % timestamp_nano,
16 | contents)
17 |
18 | f = open(filename, "w")
19 | f.write(contents)
20 | f.close()
--------------------------------------------------------------------------------
/401-spring-boot-layertools/record-start-time.py:
--------------------------------------------------------------------------------
1 | import re
2 | import time
3 |
4 | filename = "src/main/java/dev/tilt/example/IndexController.java"
5 | f = open(filename, "r")
6 | contents = f.read()
7 | f.close()
8 |
9 | timestamp_sec = int(time.time())
10 | timestamp_nano = (float(time.time()) - timestamp_sec) * 1000 * 1000 * 1000
11 | contents = re.sub(r'startTimeSecs = .*;',
12 | "startTimeSecs = %d;" % timestamp_sec,
13 | contents)
14 | contents = re.sub(r'startTimeNanos = .*;',
15 | "startTimeNanos = %d;" % timestamp_nano,
16 | contents)
17 |
18 | f = open(filename, "w")
19 | f.write(contents)
20 | f.close()
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | TIMESTAMP=$(date +'%Y-%m-%d')
6 | IMAGE_NAME='tiltdev/restart-helper'
7 | IMAGE_WITH_TAG=$IMAGE_NAME:$TIMESTAMP
8 |
9 | # build binary for tilt-restart-wrapper
10 | env GOOS=linux GOARCH=amd64 go build tilt-restart-wrapper.go
11 |
12 | # build Docker image with static binaries of:
13 | # - tilt-restart-wrapper (compiled above)
14 | # - entr (dependency of tilt-restart-wrapper)
15 | docker build . -t $IMAGE_NAME
16 | docker push $IMAGE_NAME
17 |
18 | docker tag $IMAGE_NAME $IMAGE_WITH_TAG
19 | docker push $IMAGE_WITH_TAG
20 |
21 | echo "Successfully built and pushed $IMAGE_WITH_TAG"
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | TIMESTAMP=$(date +'%Y-%m-%d')
6 | IMAGE_NAME='tiltdev/restart-helper'
7 | IMAGE_WITH_TAG=$IMAGE_NAME:$TIMESTAMP
8 |
9 | # build binary for tilt-restart-wrapper
10 | env GOOS=linux GOARCH=amd64 go build tilt-restart-wrapper.go
11 |
12 | # build Docker image with static binaries of:
13 | # - tilt-restart-wrapper (compiled above)
14 | # - entr (dependency of tilt-restart-wrapper)
15 | docker build . -t $IMAGE_NAME
16 | docker push $IMAGE_NAME
17 |
18 | docker tag $IMAGE_NAME $IMAGE_WITH_TAG
19 | docker push $IMAGE_WITH_TAG
20 |
21 | echo "Successfully built and pushed $IMAGE_WITH_TAG"
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/test/test-docker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Test case for https://github.com/tilt-dev/tilt-extensions/issues/92
4 | #
5 | # This job will always exit with a non-zero status code; make sure
6 | # that docker_build_with_restart surfaces this error code to k8s,
7 | # so k8s knows that the job failed. (Thus, we expect the `tilt ci`
8 | # call to fail.)
9 | cd $(dirname $0)
10 |
11 | set -x
12 | tilt ci > tilt.log 2>&1
13 | CI_EXIT=$?
14 |
15 | tilt down
16 |
17 | if [ $CI_EXIT -eq 0 ]; then
18 | echo "Expected 'tilt ci' to fail, but succeeded."
19 | exit 1
20 | fi
21 |
22 | cat tilt.log | grep -q "Are you there, pod?"
23 | GREP_EXIT=$?
24 |
25 | rm tilt.log
26 |
27 | exit $GREP_EXIT
28 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/test/test-docker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Test case for https://github.com/tilt-dev/tilt-extensions/issues/92
4 | #
5 | # This job will always exit with a non-zero status code; make sure
6 | # that docker_build_with_restart surfaces this error code to k8s,
7 | # so k8s knows that the job failed. (Thus, we expect the `tilt ci`
8 | # call to fail.)
9 | cd $(dirname $0)
10 |
11 | set -x
12 | tilt ci > tilt.log 2>&1
13 | CI_EXIT=$?
14 |
15 | tilt down
16 |
17 | if [ $CI_EXIT -eq 0 ]; then
18 | echo "Expected 'tilt ci' to fail, but succeeded."
19 | exit 1
20 | fi
21 |
22 | cat tilt.log | grep -q "Are you there, pod?"
23 | GREP_EXIT=$?
24 |
25 | rm tilt.log
26 |
27 | exit $GREP_EXIT
28 |
--------------------------------------------------------------------------------
/test/test.ps1:
--------------------------------------------------------------------------------
1 |
2 | echo "Testing 0-base"
3 | tilt ci --file 0-base/Tiltfile
4 | if (!$?) {
5 | throw "failed"
6 | }
7 | tilt down --file 0-base/Tiltfile
8 |
9 | echo "Testing 1-measured"
10 | tilt ci --file 1-measured/Tiltfile
11 | if (!$?) {
12 | throw "failed"
13 | }
14 | tilt down --file 1-measured/Tiltfile
15 |
16 | echo "Testing 2-optimized"
17 | tilt ci --file 2-optimized/Tiltfile
18 | if (!$?) {
19 | throw "failed"
20 | }
21 | tilt down --file 2-optimized/Tiltfile
22 |
23 | echo "Testing 3-unpacked"
24 | tilt ci --file 3-unpacked/Tiltfile
25 | if (!$?) {
26 | throw "failed"
27 | }
28 | tilt down --file 3-unpacked/Tiltfile
29 |
30 | echo "Testing 4-recommended"
31 | tilt ci --file 4-recommended/Tiltfile
32 | if (!$?) {
33 | throw "failed"
34 | }
35 | tilt down --file 4-recommended/Tiltfile
36 |
37 |
--------------------------------------------------------------------------------
/2-optimized/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # Records the current time, then kicks off a server update.
4 | # Normally, you would let Tilt do deploys automatically, but this
5 | # shows you how to set up a custom workflow that measures it.
6 | local_resource(
7 | 'deploy',
8 | 'python3 record-start-time.py',
9 | )
10 |
11 | gradlew = "./gradlew"
12 | if os.name == "nt":
13 | gradlew = "gradlew.bat"
14 |
15 | local_resource(
16 | 'example-java-compile',
17 | gradlew + ' bootJar',
18 | deps=['src', 'build.gradle'],
19 | resource_deps = ['deploy'])
20 |
21 | docker_build(
22 | 'example-java-image',
23 | './build/libs',
24 | dockerfile='./Dockerfile')
25 |
26 | k8s_yaml('kubernetes.yaml')
27 | k8s_resource('example-java', port_forwards=8000,
28 | resource_deps=['deploy', 'example-java-compile'])
29 |
--------------------------------------------------------------------------------
/0-base/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'org.springframework.boot' version '3.2.1'
3 | id 'io.spring.dependency-management' version '1.1.4'
4 | id 'java'
5 | }
6 |
7 | group = 'dev.tilt'
8 | version = '0.0.1-SNAPSHOT'
9 | sourceCompatibility = '1.17'
10 |
11 | configurations {
12 | developmentOnly
13 | runtimeClasspath {
14 | extendsFrom developmentOnly
15 | }
16 | }
17 |
18 |
19 | repositories {
20 | mavenCentral()
21 | }
22 |
23 | dependencies {
24 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
25 | implementation 'org.springframework.boot:spring-boot-starter-web'
26 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
27 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
28 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
29 | }
30 | }
31 |
32 | test {
33 | useJUnitPlatform()
34 | }
35 |
--------------------------------------------------------------------------------
/4-recommended/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'org.springframework.boot' version '3.2.1'
3 | id 'io.spring.dependency-management' version '1.1.4'
4 | id 'java'
5 | }
6 |
7 | group = 'dev.tilt'
8 | version = '0.0.1-SNAPSHOT'
9 | sourceCompatibility = '1.17'
10 |
11 | configurations {
12 | developmentOnly
13 | runtimeClasspath {
14 | extendsFrom developmentOnly
15 | }
16 | }
17 |
18 | repositories {
19 | mavenCentral()
20 | }
21 |
22 | dependencies {
23 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
24 | implementation 'org.springframework.boot:spring-boot-starter-web'
25 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
26 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
27 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
28 | }
29 | }
30 |
31 | test {
32 | useJUnitPlatform()
33 | }
34 |
--------------------------------------------------------------------------------
/1-measured/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'org.springframework.boot' version '3.2.1'
3 | id 'io.spring.dependency-management' version '1.1.4'
4 | id 'java'
5 | }
6 |
7 | group = 'dev.tilt'
8 | version = '0.0.1-SNAPSHOT'
9 | sourceCompatibility = '1.17'
10 |
11 | configurations {
12 | developmentOnly
13 | runtimeClasspath {
14 | extendsFrom developmentOnly
15 | }
16 | }
17 |
18 |
19 | repositories {
20 | mavenCentral()
21 | }
22 |
23 | dependencies {
24 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
25 | implementation 'org.springframework.boot:spring-boot-starter-web'
26 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
27 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
28 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
29 | }
30 | }
31 |
32 | test {
33 | useJUnitPlatform()
34 | }
35 |
--------------------------------------------------------------------------------
/2-optimized/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'org.springframework.boot' version '3.2.1'
3 | id 'io.spring.dependency-management' version '1.1.4'
4 | id 'java'
5 | }
6 |
7 | group = 'dev.tilt'
8 | version = '0.0.1-SNAPSHOT'
9 | sourceCompatibility = '1.17'
10 |
11 | configurations {
12 | developmentOnly
13 | runtimeClasspath {
14 | extendsFrom developmentOnly
15 | }
16 | }
17 |
18 |
19 | repositories {
20 | mavenCentral()
21 | }
22 |
23 | dependencies {
24 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
25 | implementation 'org.springframework.boot:spring-boot-starter-web'
26 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
27 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
28 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
29 | }
30 | }
31 |
32 | test {
33 | useJUnitPlatform()
34 | }
35 |
--------------------------------------------------------------------------------
/3-unpacked/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'org.springframework.boot' version '3.2.1'
3 | id 'io.spring.dependency-management' version '1.1.4'
4 | id 'java'
5 | }
6 |
7 | group = 'dev.tilt'
8 | version = '0.0.1-SNAPSHOT'
9 | sourceCompatibility = '1.17'
10 |
11 | configurations {
12 | developmentOnly
13 | runtimeClasspath {
14 | extendsFrom developmentOnly
15 | }
16 | }
17 |
18 |
19 | repositories {
20 | mavenCentral()
21 | }
22 |
23 | dependencies {
24 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
25 | implementation 'org.springframework.boot:spring-boot-starter-web'
26 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
27 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
28 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
29 | }
30 | }
31 |
32 | test {
33 | useJUnitPlatform()
34 | }
35 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'org.springframework.boot' version '3.2.1'
3 | id 'io.spring.dependency-management' version '1.1.4'
4 | id 'java'
5 | }
6 |
7 | group = 'dev.tilt'
8 | version = '0.0.1-SNAPSHOT'
9 | sourceCompatibility = '1.17'
10 |
11 | configurations {
12 | developmentOnly
13 | runtimeClasspath {
14 | extendsFrom developmentOnly
15 | }
16 | }
17 |
18 | repositories {
19 | mavenCentral()
20 | }
21 |
22 | dependencies {
23 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
24 | implementation 'org.springframework.boot:spring-boot-starter-web'
25 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
26 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
27 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
28 | }
29 | }
30 |
31 | test {
32 | useJUnitPlatform()
33 | }
34 |
--------------------------------------------------------------------------------
/3-unpacked/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # Records the current time, then kicks off a server update.
4 | # Normally, you would let Tilt do deploys automatically, but this
5 | # shows you how to set up a custom workflow that measures it.
6 | local_resource(
7 | 'deploy',
8 | 'python3 record-start-time.py',
9 | )
10 |
11 | gradlew = "./gradlew"
12 | if os.name == "nt":
13 | gradlew = "gradlew.bat"
14 |
15 | local_resource(
16 | 'example-java-compile',
17 | gradlew + ' bootJar && ' +
18 | 'unzip -o build/libs/example-0.0.1-SNAPSHOT.jar -d build/jar',
19 | deps=['src', 'build.gradle'],
20 | resource_deps = ['deploy'])
21 |
22 | docker_build(
23 | 'example-java-image',
24 | './build/jar',
25 | dockerfile='./Dockerfile')
26 |
27 | k8s_yaml('kubernetes.yaml')
28 | k8s_resource('example-java', port_forwards=8000,
29 | resource_deps=['deploy', 'example-java-compile'])
30 |
--------------------------------------------------------------------------------
/101-jib/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.google.cloud.tools.jib' version '2.1.0'
3 | id 'org.springframework.boot' version '3.2.1'
4 | id 'io.spring.dependency-management' version '1.1.4'
5 | id 'java'
6 | }
7 |
8 | group = 'dev.tilt'
9 | version = '0.0.1-SNAPSHOT'
10 | sourceCompatibility = '1.17'
11 |
12 | configurations {
13 | developmentOnly
14 | runtimeClasspath {
15 | extendsFrom developmentOnly
16 | }
17 | }
18 |
19 |
20 | repositories {
21 | mavenCentral()
22 | }
23 |
24 | dependencies {
25 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
26 | implementation 'org.springframework.boot:spring-boot-starter-web'
27 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
28 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
29 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
30 | }
31 | }
32 |
33 | test {
34 | useJUnitPlatform()
35 | }
36 |
--------------------------------------------------------------------------------
/test/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -ex
4 |
5 | # cd to the root of the repo.
6 | cd $(dirname $(dirname $0))
7 |
8 | echo "Testing 0-base"
9 | tilt ci --file 0-base/Tiltfile
10 | tilt down --file 0-base/Tiltfile
11 |
12 | echo "Testing 1-measured"
13 | tilt ci --file 1-measured/Tiltfile
14 | tilt down --file 1-measured/Tiltfile
15 |
16 | echo "Testing 2-optimized"
17 | tilt ci --file 2-optimized/Tiltfile
18 | tilt down --file 2-optimized/Tiltfile
19 |
20 | echo "Testing 3-unpacked"
21 | tilt ci --file 3-unpacked/Tiltfile
22 | tilt down --file 3-unpacked/Tiltfile
23 |
24 | echo "Testing 4-recommended"
25 | tilt ci --file 4-recommended/Tiltfile
26 | tilt down --file 4-recommended/Tiltfile
27 |
28 | echo "Testing 103-micronaut"
29 | tilt ci --file 103-micronaut/Tiltfile
30 | tilt down --file 103-micronaut/Tiltfile
31 |
32 | echo "Testing 401-spring-boot-layertools"
33 | tilt ci --file 401-spring-boot-layertools/Tiltfile
34 | tilt down --file 401-spring-boot-layertools/Tiltfile
35 |
--------------------------------------------------------------------------------
/102-jib-live-update/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # Records the current time, then kicks off a server update.
4 | # Normally, you would let Tilt do deploys automatically, but this
5 | # shows you how to set up a custom workflow that measures it.
6 | local_resource(
7 | 'deploy',
8 | './record-start-time.sh',
9 | )
10 |
11 | custom_build(
12 | 'example-java-image',
13 | './gradlew jibDockerBuild --image $EXPECTED_REF',
14 | live_update = [
15 | sync('./build/classes/java/main', '/app/classes'),
16 | ],
17 | deps=['./build/classes', 'build.gradle'],
18 | entrypoint='find /app | entr -r java -noverify -cp /app/resources:/app/classes:/app/libs/* dev.tilt.example.ExampleApplication')
19 |
20 | local_resource(
21 | 'compile-java',
22 | './gradlew compileJava',
23 | deps=['src', 'build.gradle'])
24 |
25 | k8s_yaml('kubernetes.yaml')
26 | k8s_resource('example-java', port_forwards=8000,
27 | resource_deps=[
28 | 'compile-java',
29 | 'deploy',
30 | ])
31 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/src/main/kubernetes/app.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: m2-cache
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | resources:
9 | requests:
10 | storage: 1Gi
11 | ---
12 | apiVersion: apps/v1
13 | kind: Deployment
14 | metadata:
15 | name: quarkus-sync-demo
16 | spec:
17 | selector:
18 | matchLabels:
19 | app: quarkus-sync-demo
20 | template:
21 | metadata:
22 | labels:
23 | app: quarkus-sync-demo
24 | spec:
25 | containers:
26 | - name: quarkus-sync-demo
27 | image: quarkus-sync-image
28 | imagePullPolicy: IfNotPresent
29 | ports:
30 | - name: http-web
31 | containerPort: 8080
32 | - name: jdwp-debug
33 | containerPort: 5005
34 | volumeMounts:
35 | - mountPath: /root/.m2
36 | name: m2-cache
37 | volumes:
38 | - name: m2-cache
39 | persistentVolumeClaim:
40 | claimName: m2-cache
41 |
--------------------------------------------------------------------------------
/102-jib-live-update/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.google.cloud.tools.jib' version '2.1.0'
3 | id 'org.springframework.boot' version '3.2.1'
4 | id 'io.spring.dependency-management' version '1.1.4'
5 | id 'java'
6 | }
7 |
8 | group = 'dev.tilt'
9 | version = '0.0.1-SNAPSHOT'
10 | sourceCompatibility = '1.17'
11 |
12 | // See Dockerfile.base.
13 | // This is a JRE Docker image with entr installed
14 | jib.from.image = 'gcr.io/windmill-public-containers/example-java-image-base:latest'
15 |
16 | configurations {
17 | developmentOnly
18 | runtimeClasspath {
19 | extendsFrom developmentOnly
20 | }
21 | }
22 |
23 |
24 | repositories {
25 | mavenCentral()
26 | }
27 |
28 | dependencies {
29 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
30 | implementation 'org.springframework.boot:spring-boot-starter-web'
31 | developmentOnly 'org.springframework.boot:spring-boot-devtools'
32 | testImplementation('org.springframework.boot:spring-boot-starter-test') {
33 | exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
34 | }
35 | }
36 |
37 | test {
38 | useJUnitPlatform()
39 | }
40 |
--------------------------------------------------------------------------------
/103-micronaut/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.github.johnrengelman.shadow") version "8.1.1"
3 | id("io.micronaut.application") version "4.2.1"
4 | id("com.diffplug.spotless") version "6.23.3"
5 | id("io.micronaut.aot") version "4.2.1"
6 | }
7 |
8 | version = "0.1"
9 | group = "hello.world"
10 |
11 | repositories {
12 | mavenCentral()
13 | }
14 |
15 | dependencies {
16 | annotationProcessor("io.micronaut:micronaut-http-validation")
17 | annotationProcessor("io.micronaut.serde:micronaut-serde-processor")
18 | implementation("io.micronaut.serde:micronaut-serde-jackson")
19 | compileOnly("io.micronaut:micronaut-http-client")
20 | runtimeOnly("ch.qos.logback:logback-classic")
21 | testImplementation("io.micronaut:micronaut-http-client")
22 | }
23 |
24 |
25 | application {
26 | mainClass.set("hello.world.Application")
27 | }
28 | java {
29 | sourceCompatibility = JavaVersion.toVersion("17")
30 | targetCompatibility = JavaVersion.toVersion("17")
31 | }
32 |
33 | graalvmNative.toolchainDetection = false
34 | micronaut {
35 | runtime("netty")
36 | testRuntime("junit5")
37 | processing {
38 | incremental(true)
39 | annotations("hello.world.*")
40 | }
41 | }
42 |
43 | dockerBuild {
44 | images = ["example-java-image"]
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/1-measured/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import java.time.Duration;
4 | import java.time.Instant;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 |
10 | @Controller
11 | public class IndexController {
12 | private final long startTimeSecs = 1705376187;
13 | private final long startTimeNanos = 201893806;
14 | private final String updateDuration;
15 |
16 | public IndexController() {
17 | if (startTimeSecs == 0) {
18 | updateDuration = "N/A";
19 | return;
20 | }
21 |
22 | Instant now = Instant.now();
23 | Instant startInstant = Instant.ofEpochSecond(startTimeSecs, startTimeNanos);
24 | Duration updateDuration = Duration.between(startInstant, now);
25 |
26 | this.updateDuration = String.format("%.1f", updateDuration.toMillis() / 1000.0) + "s";
27 | System.out.printf("Deploy time: %s\n", this.updateDuration);
28 | }
29 |
30 |
31 | @GetMapping("/")
32 | public String index(Model model) {
33 | // Serves the index.html template under
34 | // src/main/resources/templates/index.html
35 | model.addAttribute("updateDuration", updateDuration);
36 | return "index";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/101-jib/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import java.time.Duration;
4 | import java.time.Instant;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 |
10 | @Controller
11 | public class IndexController {
12 | private final long startTimeSecs = 1584632235;
13 | private final long startTimeNanos = 764427945;
14 | private final String updateDuration;
15 |
16 | public IndexController() {
17 | if (startTimeSecs == 0) {
18 | updateDuration = "N/A";
19 | return;
20 | }
21 |
22 | Instant now = Instant.now();
23 | Instant startInstant = Instant.ofEpochSecond(startTimeSecs, startTimeNanos);
24 | Duration updateDuration = Duration.between(startInstant, now);
25 |
26 | this.updateDuration = String.format("%.1f", updateDuration.toMillis() / 1000.0) + "s";
27 | System.out.printf("Deploy time: %s\n", this.updateDuration);
28 | }
29 |
30 |
31 | @GetMapping("/")
32 | public String index(Model model) {
33 | // Serves the index.html template under
34 | // src/main/resources/templates/index.html
35 | model.addAttribute("updateDuration", updateDuration);
36 | return "index";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/2-optimized/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import java.time.Duration;
4 | import java.time.Instant;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 |
10 | @Controller
11 | public class IndexController {
12 | private final long startTimeSecs = 1705376285;
13 | private final long startTimeNanos = 5347251;
14 | private final String updateDuration;
15 |
16 | public IndexController() {
17 | if (startTimeSecs == 0) {
18 | updateDuration = "N/A";
19 | return;
20 | }
21 |
22 | Instant now = Instant.now();
23 | Instant startInstant = Instant.ofEpochSecond(startTimeSecs, startTimeNanos);
24 | Duration updateDuration = Duration.between(startInstant, now);
25 |
26 | this.updateDuration = String.format("%.1f", updateDuration.toMillis() / 1000.0) + "s";
27 | System.out.printf("Deploy time: %s\n", this.updateDuration);
28 | }
29 |
30 |
31 | @GetMapping("/")
32 | public String index(Model model) {
33 | // Serves the index.html template under
34 | // src/main/resources/templates/index.html
35 | model.addAttribute("updateDuration", updateDuration);
36 | return "index";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/3-unpacked/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import java.time.Duration;
4 | import java.time.Instant;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 |
10 | @Controller
11 | public class IndexController {
12 | private final long startTimeSecs = 1705376297;
13 | private final long startTimeNanos = 11810302;
14 | private final String updateDuration;
15 |
16 | public IndexController() {
17 | if (startTimeSecs == 0) {
18 | updateDuration = "N/A";
19 | return;
20 | }
21 |
22 | Instant now = Instant.now();
23 | Instant startInstant = Instant.ofEpochSecond(startTimeSecs, startTimeNanos);
24 | Duration updateDuration = Duration.between(startInstant, now);
25 |
26 | this.updateDuration = String.format("%.1f", updateDuration.toMillis() / 1000.0) + "s";
27 | System.out.printf("Deploy time: %s\n", this.updateDuration);
28 | }
29 |
30 |
31 | @GetMapping("/")
32 | public String index(Model model) {
33 | // Serves the index.html template under
34 | // src/main/resources/templates/index.html
35 | model.addAttribute("updateDuration", updateDuration);
36 | return "index";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/4-recommended/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import java.time.Duration;
4 | import java.time.Instant;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 |
10 | @Controller
11 | public class IndexController {
12 | private final long startTimeSecs = 1705376308;
13 | private final long startTimeNanos = 589840412;
14 | private final String updateDuration;
15 |
16 | public IndexController() {
17 | if (startTimeSecs == 0) {
18 | updateDuration = "N/A";
19 | return;
20 | }
21 |
22 | Instant now = Instant.now();
23 | Instant startInstant = Instant.ofEpochSecond(startTimeSecs, startTimeNanos);
24 | Duration updateDuration = Duration.between(startInstant, now);
25 |
26 | this.updateDuration = String.format("%.1f", updateDuration.toMillis() / 1000.0) + "s";
27 | System.out.printf("Deploy time: %s\n", this.updateDuration);
28 | }
29 |
30 |
31 | @GetMapping("/")
32 | public String index(Model model) {
33 | // Serves the index.html template under
34 | // src/main/resources/templates/index.html
35 | model.addAttribute("updateDuration", updateDuration);
36 | return "index";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/102-jib-live-update/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import java.time.Duration;
4 | import java.time.Instant;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 |
10 | @Controller
11 | public class IndexController {
12 | private final long startTimeSecs = 1584656549;
13 | private final long startTimeNanos = 760362351;
14 | private final String updateDuration;
15 |
16 | public IndexController() {
17 | if (startTimeSecs == 0) {
18 | updateDuration = "N/A";
19 | return;
20 | }
21 |
22 | Instant now = Instant.now();
23 | Instant startInstant = Instant.ofEpochSecond(startTimeSecs, startTimeNanos);
24 | Duration updateDuration = Duration.between(startInstant, now);
25 |
26 | this.updateDuration = String.format("%.1f", updateDuration.toMillis() / 1000.0) + "s";
27 | System.out.printf("Deploy time: %s\n", this.updateDuration);
28 | }
29 |
30 |
31 | @GetMapping("/")
32 | public String index(Model model) {
33 | // Serves the index.html template under
34 | // src/main/resources/templates/index.html
35 | model.addAttribute("updateDuration", updateDuration);
36 | return "index";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/src/main/java/dev/tilt/example/IndexController.java:
--------------------------------------------------------------------------------
1 | package dev.tilt.example;
2 |
3 | import java.time.Duration;
4 | import java.time.Instant;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.ui.Model;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestParam;
9 |
10 | @Controller
11 | public class IndexController {
12 | private final long startTimeSecs = 1626983348;
13 | private final long startTimeNanos = 474149942;
14 | private final String updateDuration;
15 |
16 | public IndexController() {
17 | if (startTimeSecs == 0) {
18 | updateDuration = "N/A";
19 | return;
20 | }
21 |
22 | Instant now = Instant.now();
23 | Instant startInstant = Instant.ofEpochSecond(startTimeSecs, startTimeNanos);
24 | Duration updateDuration = Duration.between(startInstant, now);
25 |
26 | this.updateDuration = String.format("%.1f", updateDuration.toMillis() / 1000.0) + "s";
27 | System.out.printf("Deploy time: %s\n", this.updateDuration);
28 | }
29 |
30 |
31 | @GetMapping("/")
32 | public String index(Model model) {
33 | // Serves the index.html template under
34 | // src/main/resources/templates/index.html
35 | model.addAttribute("updateDuration", updateDuration);
36 | return "index";
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/4-recommended/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # For more on Extensions, see: https://docs.tilt.dev/extensions.html
4 | load('ext://restart_process', 'docker_build_with_restart')
5 |
6 | # Records the current time, then kicks off a server update.
7 | # Normally, you would let Tilt do deploys automatically, but this
8 | # shows you how to set up a custom workflow that measures it.
9 | local_resource(
10 | 'deploy',
11 | 'python3 record-start-time.py',
12 | )
13 |
14 | gradlew = "./gradlew"
15 | if os.name == "nt":
16 | gradlew = "gradlew.bat"
17 |
18 | local_resource(
19 | 'example-java-compile',
20 | gradlew + ' bootJar && ' +
21 | 'rm -rf build/jar-staging && ' +
22 | 'unzip -o build/libs/example-0.0.1-SNAPSHOT.jar -d build/jar-staging && ' +
23 | 'rsync --delete --inplace --checksum -r build/jar-staging/ build/jar',
24 | deps=['src', 'build.gradle'],
25 | resource_deps = ['deploy'])
26 |
27 | docker_build_with_restart(
28 | 'example-java-image',
29 | './build/jar',
30 | entrypoint=['java', '-noverify', '-cp', '.:./lib/*', 'dev.tilt.example.ExampleApplication'],
31 | dockerfile='./Dockerfile',
32 | live_update=[
33 | sync('./build/jar/BOOT-INF/lib', '/app/lib'),
34 | sync('./build/jar/META-INF', '/app/META-INF'),
35 | sync('./build/jar/BOOT-INF/classes', '/app'),
36 | ],
37 | )
38 |
39 | k8s_yaml('kubernetes.yaml')
40 | k8s_resource('example-java', port_forwards=8000,
41 | resource_deps=['deploy', 'example-java-compile'])
42 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/Tiltfile:
--------------------------------------------------------------------------------
1 | # -*- mode: Python -*-
2 |
3 | # For more on Extensions, see: https://docs.tilt.dev/extensions.html
4 | load('ext://restart_process', 'docker_build_with_restart')
5 |
6 | # Records the current time, then kicks off a server update.
7 | # Normally, you would let Tilt do deploys automatically, but this
8 | # shows you how to set up a custom workflow that measures it.
9 | local_resource(
10 | 'deploy',
11 | 'python3 record-start-time.py',
12 | )
13 |
14 | gradlew = "./gradlew"
15 | if os.name == "nt":
16 | gradlew = "gradlew.bat"
17 |
18 | local_resource(
19 | 'example-java-compile',
20 | gradlew + ' bootJar && ' +
21 | 'rm -rf build/jar-staging && ' +
22 | 'java -Djarmode=layertools -jar build/libs/example-0.0.1-SNAPSHOT.jar extract --destination build/jar-extracted && ' +
23 | 'rsync --delete --inplace --checksum -r build/jar-extracted/ build/jar',
24 | deps=['src', 'build.gradle'],
25 | resource_deps = ['deploy'])
26 |
27 | docker_build_with_restart(
28 | 'example-java-image',
29 | './build/jar',
30 | entrypoint=['java', 'org.springframework.boot.loader.JarLauncher'],
31 | dockerfile='./Dockerfile',
32 | live_update=[
33 | sync('./build/jar/dependencies', '/app'),
34 | sync('./build/jar/spring-boot-loader', '/app'),
35 | sync('./build/jar/snapshot-dependencies', '/app'),
36 | sync('./build/jar/application', '/app'),
37 | ],
38 | )
39 |
40 | k8s_yaml('kubernetes.yaml')
41 | k8s_resource('example-java', port_forwards=8000,
42 | resource_deps=['deploy', 'example-java-compile'])
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # tilt-example-java
2 |
3 | [](https://circleci.com/gh/tilt-dev/tilt-example-java)
4 |
5 | An example project that demonstrates a live-updating Java server in Kubernetes. Read [doc](https://docs.tilt.dev/example_java.html).
6 |
7 | We used [Spring Initializr](https://start.spring.io/) to bootstrap the project,
8 | then added Docker & Kubernetes configs for running it in Kubernetes.
9 |
10 | To run these examples, you should also have:
11 | - javac (a JDK)
12 | - unzip
13 | - rsync
14 | - python3
15 |
16 | ## Fastest Deployment
17 |
18 | This progression of examples shows how to start, and incrementally update
19 | your project for live updates.
20 |
21 | - [0-base](0-base): The simplest way to start
22 | - [1-measured](1-measured): Use `local_resource` to measure your deployment time
23 | - [2-optimized](2-optimized): Compile executable Jars and copy them into Docker
24 | - [3-unpacked](3-unpacked): Unpack the executable Jar into Docker layers
25 | - [4-recommended](4-recommended): Live update executable Jars
26 |
27 | ## Other Configurations
28 |
29 | - [101-jib](101-jib): An example of how to integrate Tilt with the [Jib Java
30 | image builder](https://github.com/GoogleContainerTools/jib)
31 | - [102-jib-live-update](102-jib-live-update): An example of how to use
32 | live_update with Jib. It requires a lot of knowledge of Jib internals, but you
33 | can make it work!
34 | - [103-micronaut](103-micronaut): An example of how to integrate Tilt with the
35 | [Micronaut framework](https://micronaut.io/).
36 | - [201-quarkus-live-update](201-quarkus-live-update): An example of how to use
37 | live_update with [Quarkus](https://quarkus.io/), a container-first, hot-reloading framework for writing
38 | Java applications.
39 | - [401-spring-boot-layertools](401-spring-boot-layertools): An example of how to
40 | further optimize the Spring Boot image with the latest recommendations from
41 | [the Spring Boot Docker
42 | guide](https://github.com/spring-guides/top-spring-boot-docker#spring-boot-layer-index).
43 |
44 | ## License
45 |
46 | Copyright 2022 Docker, Inc.
47 |
48 | Licensed under [the Apache License, Version 2.0](LICENSE)
49 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/README.md:
--------------------------------------------------------------------------------
1 | # Quarkus Live Update with Tilt
2 |
3 | A demo to show how sync local [Quarkus](https://quarkus.io/) sources with pod running in kubernetes and use the `quarkus:dev` mode to hot reload the changes.
4 |
5 | ## Important
6 |
7 | This Dockerfile is used for development purposes, in order to have a production image, you may consider to use [Native builds](https://quarkus.io/guides/building-native-image)
8 |
9 | ## Pre-requiste
10 |
11 | - Have [tilt](https://docs.tilt.dev/install.html) properly installed and a kubernetes environment. Ensure that you have `KUBECONFIG` environment var or is in the proper kube context.
12 | - Have Docker or Buildah properly installed.
13 |
14 | ## Running the demo
15 |
16 | Clone the demo sources locally:
17 |
18 | ```
19 | git clone https://github.com/tilt-dev/tilt-example-java.git
20 | cd tilt-example-java/201-quarkus-live-update/
21 | ```
22 |
23 | If it's being used docker as builder, start the environment with:
24 |
25 | ```
26 | tilt up
27 | ```
28 |
29 | If it's being used buildah as builder, start the environment with:
30 |
31 | ```
32 | tilt up -f Tiltfile.buildah
33 | ```
34 |
35 | The command creates the following resources:
36 |
37 | - a kubernetes deployment called **quarkus-sync-demo**
38 | - a persistence volume claim called `m2-cache` to cache the maven artifacts for faster builds
39 |
40 | Check the stats of the application:
41 |
42 | ```
43 | kubectl get pods -w ##(1)
44 | ```
45 |
46 | 1. A successful start will have **quarkus-sync-demo** in **Running** status
47 |
48 | | Note | You can terminate the `kubectl get pods -w` using the command CTRL+C |
49 | | ---- | ------------------------------------------------------------ |
50 | | | |
51 |
52 | Lets see the sync in action, open a new terminal and navigate to `$PROJECT_HOME`. Run the following command:
53 |
54 | ```
55 | ./poll.sh ##(1)
56 | ```
57 |
58 | 1. this will keep calling the kubernetes service once in every 5 seconds
59 |
60 | Without any change you should be seeing response as `hello` getting printed every 5 seconds.
61 |
62 | You can now make changes to the sources e.g change `hello` in GreetingResource.java to `namaste`
63 |
64 | After few seconds you will see your polling window sending the new response `namaste`
65 |
66 | ## Cleanup
67 |
68 | ```
69 | tilt down -f
70 | ```
71 |
--------------------------------------------------------------------------------
/0-base/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/101-jib/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/1-measured/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/2-optimized/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/3-unpacked/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/103-micronaut/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/4-recommended/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/102-jib-live-update/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/tilt-restart-wrapper.go:
--------------------------------------------------------------------------------
1 | // `tilt-restart-wrapper` wraps `entr` (http://eradman.com/entrproject/) to easily
2 | // rerun a user-specified command when a given file changes.
3 | //
4 | // This is Tilt's recommended way of restarting a process as part of a live_update:
5 | // if your container invokes your app via the restart wrapper (e.g. `tilt-restart-wrapper /bin/my-app`),
6 | // you can trigger re-execution of your app with a live_update `run` step that makes
7 | // a trivial change to the file watched by `entr` (e.g. `run('date > /.restart-proc')`)
8 | //
9 | // This script exists (i.e. we're wrapping `entr` in a binary instead of invoking
10 | // it directly) because in its canonical invocation, `entr` requires that the
11 | // file(s) to watch be piped via stdin, i.e. it is invoked like:
12 | // echo "/.restart-proc" | entr -rz /bin/my-app
13 | //
14 | // When specified as a `command` in Kubernetes or Docker Compose YAML (this is how
15 | // Tilt overrides entrypoints), the above would therefore need to be executed as shell:
16 | // /bin/sh -c 'echo "/.restart-proc" | entr -rz /bin/my-app'
17 |
18 | // Any args specified in Kubernetes or Docker Compose YAML are attached to the end
19 | // of this call, and therefore in this case apply TO THE `/bin/sh -c` CALL, rather
20 | // than to the actual command run by `entr`; that is, any `args` specified by the
21 | // user would be effectively ignored.
22 | //
23 | // In order to make `entr` executable as ARGV rather than as shell, we have wrapped it
24 | // in a binary that can be called directly and takes care of the piping under the hood.
25 | //
26 | // Note: ideally `entr` could accept files-to-watch via flag instead of stdin,
27 | // but (for a number of good reasons) this feature isn't likely to be added any
28 | // time soon (see https://github.com/eradman/entr/issues/33).
29 |
30 | package main
31 |
32 | import (
33 | "flag"
34 | "fmt"
35 | "log"
36 | "os"
37 | "os/exec"
38 | "strings"
39 | "syscall"
40 | )
41 |
42 | var watchFile = flag.String("watch_file", "/.restart-proc", "File that entr will watch for changes; changes to this file trigger `entr` to rerun the command(s) passed")
43 | var entrPath = flag.String("entr_path", "/entr", "Path to `entr` executable")
44 |
45 | func main() {
46 | flag.Parse()
47 |
48 | cmd := exec.Command(*entrPath, "-rz")
49 | cmd.Stdin = strings.NewReader(fmt.Sprintf("%s\n", *watchFile))
50 | cmd.Args = append(cmd.Args, flag.Args()...)
51 | cmd.Stdout = os.Stdout
52 | cmd.Stderr = os.Stderr
53 |
54 | if err := cmd.Run(); err != nil {
55 | if exiterr, ok := err.(*exec.ExitError); ok {
56 | // The program has exited with an exit code != 0
57 | if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
58 | if len(flag.Args()) == 0 {
59 | log.Println("`tilt-restart-wrapper` requires at least one positional arg " +
60 | "(a command or set of args to be executed / rerun whenever `watch_file` changes)")
61 | }
62 | os.Exit(status.ExitStatus())
63 | }
64 | } else {
65 | log.Fatalf("error running command: %v", err)
66 | }
67 | }
68 |
69 | if len(flag.Args()) == 0 {
70 | log.Fatal("`tilt-restart-wrapper` requires at least one positional arg "+
71 | "(will be passed to `entr` and executed / rerun whenever `watch_file` changes)")
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/tilt-restart-wrapper.go:
--------------------------------------------------------------------------------
1 | // `tilt-restart-wrapper` wraps `entr` (http://eradman.com/entrproject/) to easily
2 | // rerun a user-specified command when a given file changes.
3 | //
4 | // This is Tilt's recommended way of restarting a process as part of a live_update:
5 | // if your container invokes your app via the restart wrapper (e.g. `tilt-restart-wrapper /bin/my-app`),
6 | // you can trigger re-execution of your app with a live_update `run` step that makes
7 | // a trivial change to the file watched by `entr` (e.g. `run('date > /.restart-proc')`)
8 | //
9 | // This script exists (i.e. we're wrapping `entr` in a binary instead of invoking
10 | // it directly) because in its canonical invocation, `entr` requires that the
11 | // file(s) to watch be piped via stdin, i.e. it is invoked like:
12 | // echo "/.restart-proc" | entr -rz /bin/my-app
13 | //
14 | // When specified as a `command` in Kubernetes or Docker Compose YAML (this is how
15 | // Tilt overrides entrypoints), the above would therefore need to be executed as shell:
16 | // /bin/sh -c 'echo "/.restart-proc" | entr -rz /bin/my-app'
17 |
18 | // Any args specified in Kubernetes or Docker Compose YAML are attached to the end
19 | // of this call, and therefore in this case apply TO THE `/bin/sh -c` CALL, rather
20 | // than to the actual command run by `entr`; that is, any `args` specified by the
21 | // user would be effectively ignored.
22 | //
23 | // In order to make `entr` executable as ARGV rather than as shell, we have wrapped it
24 | // in a binary that can be called directly and takes care of the piping under the hood.
25 | //
26 | // Note: ideally `entr` could accept files-to-watch via flag instead of stdin,
27 | // but (for a number of good reasons) this feature isn't likely to be added any
28 | // time soon (see https://github.com/eradman/entr/issues/33).
29 |
30 | package main
31 |
32 | import (
33 | "flag"
34 | "fmt"
35 | "log"
36 | "os"
37 | "os/exec"
38 | "strings"
39 | "syscall"
40 | )
41 |
42 | var watchFile = flag.String("watch_file", "/.restart-proc", "File that entr will watch for changes; changes to this file trigger `entr` to rerun the command(s) passed")
43 | var entrPath = flag.String("entr_path", "/entr", "Path to `entr` executable")
44 |
45 | func main() {
46 | flag.Parse()
47 |
48 | cmd := exec.Command(*entrPath, "-rz")
49 | cmd.Stdin = strings.NewReader(fmt.Sprintf("%s\n", *watchFile))
50 | cmd.Args = append(cmd.Args, flag.Args()...)
51 | cmd.Stdout = os.Stdout
52 | cmd.Stderr = os.Stderr
53 |
54 | if err := cmd.Run(); err != nil {
55 | if exiterr, ok := err.(*exec.ExitError); ok {
56 | // The program has exited with an exit code != 0
57 | if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
58 | if len(flag.Args()) == 0 {
59 | log.Println("`tilt-restart-wrapper` requires at least one positional arg " +
60 | "(a command or set of args to be executed / rerun whenever `watch_file` changes)")
61 | }
62 | os.Exit(status.ExitStatus())
63 | }
64 | } else {
65 | log.Fatalf("error running command: %v", err)
66 | }
67 | }
68 |
69 | if len(flag.Args()) == 0 {
70 | log.Fatal("`tilt-restart-wrapper` requires at least one positional arg "+
71 | "(will be passed to `entr` and executed / rerun whenever `watch_file` changes)")
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | dev.tilt
6 | quarkus-sync-example
7 | 1.0.0-SNAPSHOT
8 |
9 | 3.8.1
10 | true
11 | 11
12 | 11
13 | UTF-8
14 | UTF-8
15 | 1.4.2.Final
16 | quarkus-universe-bom
17 | io.quarkus
18 | 1.4.2.Final
19 | 2.22.1
20 |
21 |
22 |
23 |
24 | ${quarkus.platform.group-id}
25 | ${quarkus.platform.artifact-id}
26 | ${quarkus.platform.version}
27 | pom
28 | import
29 |
30 |
31 |
32 |
33 |
34 | io.quarkus
35 | quarkus-resteasy
36 |
37 |
38 | io.quarkus
39 | quarkus-junit5
40 | test
41 |
42 |
43 | io.rest-assured
44 | rest-assured
45 | test
46 |
47 |
48 |
49 |
50 |
51 | io.quarkus
52 | quarkus-maven-plugin
53 | ${quarkus-plugin.version}
54 |
55 |
56 |
57 | build
58 |
59 |
60 |
61 |
62 |
63 | maven-compiler-plugin
64 | ${compiler-plugin.version}
65 |
66 |
67 | maven-surefire-plugin
68 | ${surefire-plugin.version}
69 |
70 |
71 | org.jboss.logmanager.LogManager
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | native
80 |
81 |
82 | native
83 |
84 |
85 |
86 |
87 |
88 | maven-failsafe-plugin
89 | ${surefire-plugin.version}
90 |
91 |
92 |
93 | integration-test
94 | verify
95 |
96 |
97 |
98 | ${project.build.directory}/${project.build.finalName}-runner
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | native
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/201-quarkus-live-update/src/main/resources/META-INF/resources/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | quarkus-sync-demo - 1.0-SNAPSHOT
6 |
99 |
100 |
101 |
102 |
103 | Your new Cloud-Native application is ready!
104 |
105 |
106 |
107 |
108 |
Congratulations, you have created a new Quarkus application.
109 |
110 |
Why do you see this?
111 |
112 |
This page is served by Quarkus. The source is in
113 | src/main/resources/META-INF/resources/index.html.
114 |
115 |
What can I do from here?
116 |
117 |
If not already done, run the application in dev mode using: mvn compile quarkus:dev.
118 |
119 |
120 | - Add REST resources, Servlets, functions and other services in
src/main/java.
121 | - Your static assets are located in
src/main/resources/META-INF/resources.
122 | - Configure your application in
src/main/resources/META-INF/microprofile-config.properties.
123 |
124 |
125 |
126 |
How do I get rid of this page?
127 |
Just delete the src/main/resources/META-INF/resources/index.html file.
128 |
129 |
130 |
131 |
Application
132 |
133 | - GroupId: com.redhat.developers
134 | - ArtifactId: quarkus-sync-demo
135 | - Version: 1.0-SNAPSHOT
136 | - Quarkus Version: 0.11.0
137 |
138 |
139 |
140 |
Next steps
141 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/4-recommended/tilt_modules/restart_process/Tiltfile:
--------------------------------------------------------------------------------
1 | RESTART_FILE = '/tmp/.restart-proc'
2 | TYPE_RESTART_CONTAINER_STEP = 'live_update_restart_container_step'
3 |
4 | KWARGS_BLACKLIST = [
5 | # since we'll be passing `dockerfile_contents` when building the
6 | # child image, remove any kwargs that might conflict
7 | 'dockerfile', 'dockerfile_contents',
8 |
9 | # 'target' isn't relevant to our child build--if we pass this arg,
10 | # Docker will just fail to find the specified stage and error out
11 | 'target',
12 | ]
13 |
14 | # Arguments to custom_build that don't apply to the docker_build.
15 | _CUSTOM_BUILD_KWARGS_BLACKLIST = [
16 | 'tag',
17 | 'command_bat',
18 | 'outputs_image_ref_to',
19 | 'disable_push',
20 | ]
21 |
22 | _ext_dir = os.getcwd()
23 |
24 | # shared code between the two restart functions
25 | def _helper(base_ref, ref, entrypoint, live_update, restart_file=RESTART_FILE, trigger=None, **kwargs):
26 | if not trigger:
27 | trigger = []
28 |
29 | # declare a new docker build that adds a static binary of tilt-restart-wrapper
30 | # (which makes use of `entr` to watch files and restart processes) to the user's image
31 | df = '''
32 | FROM tiltdev/restart-helper:2020-10-16 as restart-helper
33 |
34 | FROM {}
35 | RUN ["touch", "{}"]
36 | COPY --from=restart-helper /tilt-restart-wrapper /
37 | COPY --from=restart-helper /entr /
38 | '''.format(base_ref, restart_file)
39 |
40 | # Change the entrypoint to use `tilt-restart-wrapper`.
41 | # `tilt-restart-wrapper` makes use of `entr` (https://github.com/eradman/entr/) to
42 | # re-execute $entrypoint whenever $restart_file changes
43 | if type(entrypoint) == type(""):
44 | entrypoint_with_entr = ["/tilt-restart-wrapper", "--watch_file={}".format(restart_file), "sh", "-c", entrypoint]
45 | elif type(entrypoint) == type([]):
46 | entrypoint_with_entr = ["/tilt-restart-wrapper", "--watch_file={}".format(restart_file)] + entrypoint
47 | else:
48 | fail("`entrypoint` must be a string or list of strings: got {}".format(type(entrypoint)))
49 |
50 | # last live_update step should always be to modify $restart_file, which
51 | # triggers the process wrapper to rerun $entrypoint
52 | # NB: write `date` instead of just `touch`ing because `entr` doesn't respond
53 | # to timestamp changes, only writes (see https://github.com/eradman/entr/issues/32)
54 | live_update = live_update + [run('date > {}'.format(restart_file), trigger=trigger)]
55 |
56 | # We don't need a real context. See:
57 | # https://github.com/tilt-dev/tilt/issues/3897
58 | context = _ext_dir
59 |
60 | docker_build(ref, context, entrypoint=entrypoint_with_entr, dockerfile_contents=df,
61 | live_update=live_update, **kwargs)
62 |
63 | def docker_build_with_restart(ref, context, entrypoint, live_update,
64 | base_suffix='-tilt_docker_build_with_restart_base', restart_file=RESTART_FILE,
65 | trigger=None, **kwargs):
66 | """Wrap a docker_build call and its associated live_update steps so that the last step
67 | of any live update is to rerun the given entrypoint.
68 |
69 | Args:
70 | ref: name for this image (e.g. 'myproj/backend' or 'myregistry/myproj/backend'); as the parameter of the same name in docker_build
71 | context: path to use as the Docker build context; as the parameter of the same name in docker_build
72 | entrypoint: the command to be (re-)executed when the container starts or when a live_update is run
73 | live_update: set of steps for updating a running container; as the parameter of the same name in docker_build
74 | base_suffix: suffix for naming the base image, applied as {ref}{base_suffix}
75 | restart_file: file that Tilt will update during a live_update to signal the entrypoint to rerun
76 | trigger: (optional) list of local paths. If specified, the process will ONLY be restarted when there are changes
77 | to the given file(s); as the parameter of the same name in the LiveUpdate `run` step.
78 | **kwargs: will be passed to the underlying `docker_build` call
79 | """
80 |
81 | # first, validate the given live_update steps
82 | if len(live_update) == 0:
83 | fail("`docker_build_with_restart` requires at least one live_update step")
84 | for step in live_update:
85 | if type(step) == TYPE_RESTART_CONTAINER_STEP:
86 | fail("`docker_build_with_restart` is not compatible with live_update step: " +
87 | "`restart_container()` (this extension is meant to REPLACE restart_container() )")
88 |
89 | # rename the original image to make it a base image and declare a docker_build for it
90 | base_ref = '{}{}'.format(ref, base_suffix)
91 | docker_build(base_ref, context, **kwargs)
92 |
93 | # Clean kwargs for building the child image (which builds on user's specified
94 | # image and copies in Tilt's restart wrapper). In practice, this means removing
95 | # kwargs that were relevant to building the user's specified image but are NOT
96 | # relevant to building the child image / may conflict with args we specifically
97 | # pass for the child image.
98 | cleaned_kwargs = {k: v for k, v in kwargs.items() if k not in KWARGS_BLACKLIST}
99 | _helper(base_ref, ref, entrypoint, live_update, restart_file, trigger, **cleaned_kwargs)
100 |
101 |
102 | def custom_build_with_restart(ref, command, deps, entrypoint, live_update,
103 | base_suffix='-tilt_docker_build_with_restart_base', restart_file=RESTART_FILE,
104 | trigger=None, **kwargs):
105 | """Wrap a custom_build call and its associated live_update steps so that the last step
106 | of any live update is to rerun the given entrypoint.
107 |
108 | Args:
109 | ref: name for this image (e.g. 'myproj/backend' or 'myregistry/myproj/backend'); as the parameter of the same name in custom_build
110 | command: build command for building your image
111 | deps: source dependencies of the custom build
112 | entrypoint: the command to be (re-)executed when the container starts or when a live_update is run
113 | live_update: set of steps for updating a running container; as the parameter of the same name in custom_build
114 | base_suffix: suffix for naming the base image, applied as {ref}{base_suffix}
115 | restart_file: file that Tilt will update during a live_update to signal the entrypoint to rerun
116 | trigger: (optional) list of local paths. If specified, the process will ONLY be restarted when there are changes
117 | to the given file(s); as the parameter of the same name in the LiveUpdate `run` step.
118 | **kwargs: will be passed to the underlying `custom_build` call
119 | """
120 |
121 | # first, validate the given live_update steps
122 | if len(live_update) == 0:
123 | fail("`custom_build_with_restart` requires at least one live_update step")
124 | for step in live_update:
125 | if type(step) == TYPE_RESTART_CONTAINER_STEP:
126 | fail("`custom_build_with_restart` is not compatible with live_update step: "+
127 | "`restart_container()` (this extension is meant to REPLACE restart_container() )")
128 |
129 | for k, v in kwargs.items():
130 | if k == 'skips_local_docker':
131 | fail("`custom_build_with_restart` is not compatible with `skips_local_docker`, because it needs access to the image")
132 | if k == 'disable_push':
133 | fail("`custom_build_with_restart` is not compatible with `disable_push`")
134 | if k == 'tag':
135 | fail("`custom_build_with_restart` renames your base image, so is not compatible with `tag`")
136 |
137 | # rename the original image to make it a base image and declare a custom_build for it
138 | base_ref = '{}{}'.format(ref, base_suffix)
139 | custom_build(base_ref, command=command, deps=deps, **kwargs)
140 |
141 | # A few arguments aren't applicable to the docker_build, so remove them.
142 | cleaned_kwargs = {k: v for k, v in kwargs.items() if k not in _CUSTOM_BUILD_KWARGS_BLACKLIST}
143 | _helper(base_ref, ref, entrypoint, live_update, restart_file, trigger, **cleaned_kwargs)
144 |
--------------------------------------------------------------------------------
/401-spring-boot-layertools/tilt_modules/restart_process/Tiltfile:
--------------------------------------------------------------------------------
1 | RESTART_FILE = '/tmp/.restart-proc'
2 | TYPE_RESTART_CONTAINER_STEP = 'live_update_restart_container_step'
3 |
4 | KWARGS_BLACKLIST = [
5 | # since we'll be passing `dockerfile_contents` when building the
6 | # child image, remove any kwargs that might conflict
7 | 'dockerfile', 'dockerfile_contents',
8 |
9 | # 'target' isn't relevant to our child build--if we pass this arg,
10 | # Docker will just fail to find the specified stage and error out
11 | 'target',
12 | ]
13 |
14 | # Arguments to custom_build that don't apply to the docker_build.
15 | _CUSTOM_BUILD_KWARGS_BLACKLIST = [
16 | 'tag',
17 | 'command_bat',
18 | 'outputs_image_ref_to',
19 | 'disable_push',
20 | ]
21 |
22 | _ext_dir = os.getcwd()
23 |
24 | # shared code between the two restart functions
25 | def _helper(base_ref, ref, entrypoint, live_update, restart_file=RESTART_FILE, trigger=None, **kwargs):
26 | if not trigger:
27 | trigger = []
28 |
29 | # declare a new docker build that adds a static binary of tilt-restart-wrapper
30 | # (which makes use of `entr` to watch files and restart processes) to the user's image
31 | df = '''
32 | FROM tiltdev/restart-helper:2020-10-16 as restart-helper
33 |
34 | FROM {}
35 | RUN ["touch", "{}"]
36 | COPY --from=restart-helper /tilt-restart-wrapper /
37 | COPY --from=restart-helper /entr /
38 | '''.format(base_ref, restart_file)
39 |
40 | # Change the entrypoint to use `tilt-restart-wrapper`.
41 | # `tilt-restart-wrapper` makes use of `entr` (https://github.com/eradman/entr/) to
42 | # re-execute $entrypoint whenever $restart_file changes
43 | if type(entrypoint) == type(""):
44 | entrypoint_with_entr = ["/tilt-restart-wrapper", "--watch_file={}".format(restart_file), "sh", "-c", entrypoint]
45 | elif type(entrypoint) == type([]):
46 | entrypoint_with_entr = ["/tilt-restart-wrapper", "--watch_file={}".format(restart_file)] + entrypoint
47 | else:
48 | fail("`entrypoint` must be a string or list of strings: got {}".format(type(entrypoint)))
49 |
50 | # last live_update step should always be to modify $restart_file, which
51 | # triggers the process wrapper to rerun $entrypoint
52 | # NB: write `date` instead of just `touch`ing because `entr` doesn't respond
53 | # to timestamp changes, only writes (see https://github.com/eradman/entr/issues/32)
54 | live_update = live_update + [run('date > {}'.format(restart_file), trigger=trigger)]
55 |
56 | # We don't need a real context. See:
57 | # https://github.com/tilt-dev/tilt/issues/3897
58 | context = _ext_dir
59 |
60 | docker_build(ref, context, entrypoint=entrypoint_with_entr, dockerfile_contents=df,
61 | live_update=live_update, **kwargs)
62 |
63 | def docker_build_with_restart(ref, context, entrypoint, live_update,
64 | base_suffix='-tilt_docker_build_with_restart_base', restart_file=RESTART_FILE,
65 | trigger=None, **kwargs):
66 | """Wrap a docker_build call and its associated live_update steps so that the last step
67 | of any live update is to rerun the given entrypoint.
68 |
69 | Args:
70 | ref: name for this image (e.g. 'myproj/backend' or 'myregistry/myproj/backend'); as the parameter of the same name in docker_build
71 | context: path to use as the Docker build context; as the parameter of the same name in docker_build
72 | entrypoint: the command to be (re-)executed when the container starts or when a live_update is run
73 | live_update: set of steps for updating a running container; as the parameter of the same name in docker_build
74 | base_suffix: suffix for naming the base image, applied as {ref}{base_suffix}
75 | restart_file: file that Tilt will update during a live_update to signal the entrypoint to rerun
76 | trigger: (optional) list of local paths. If specified, the process will ONLY be restarted when there are changes
77 | to the given file(s); as the parameter of the same name in the LiveUpdate `run` step.
78 | **kwargs: will be passed to the underlying `docker_build` call
79 | """
80 |
81 | # first, validate the given live_update steps
82 | if len(live_update) == 0:
83 | fail("`docker_build_with_restart` requires at least one live_update step")
84 | for step in live_update:
85 | if type(step) == TYPE_RESTART_CONTAINER_STEP:
86 | fail("`docker_build_with_restart` is not compatible with live_update step: " +
87 | "`restart_container()` (this extension is meant to REPLACE restart_container() )")
88 |
89 | # rename the original image to make it a base image and declare a docker_build for it
90 | base_ref = '{}{}'.format(ref, base_suffix)
91 | docker_build(base_ref, context, **kwargs)
92 |
93 | # Clean kwargs for building the child image (which builds on user's specified
94 | # image and copies in Tilt's restart wrapper). In practice, this means removing
95 | # kwargs that were relevant to building the user's specified image but are NOT
96 | # relevant to building the child image / may conflict with args we specifically
97 | # pass for the child image.
98 | cleaned_kwargs = {k: v for k, v in kwargs.items() if k not in KWARGS_BLACKLIST}
99 | _helper(base_ref, ref, entrypoint, live_update, restart_file, trigger, **cleaned_kwargs)
100 |
101 |
102 | def custom_build_with_restart(ref, command, deps, entrypoint, live_update,
103 | base_suffix='-tilt_docker_build_with_restart_base', restart_file=RESTART_FILE,
104 | trigger=None, **kwargs):
105 | """Wrap a custom_build call and its associated live_update steps so that the last step
106 | of any live update is to rerun the given entrypoint.
107 |
108 | Args:
109 | ref: name for this image (e.g. 'myproj/backend' or 'myregistry/myproj/backend'); as the parameter of the same name in custom_build
110 | command: build command for building your image
111 | deps: source dependencies of the custom build
112 | entrypoint: the command to be (re-)executed when the container starts or when a live_update is run
113 | live_update: set of steps for updating a running container; as the parameter of the same name in custom_build
114 | base_suffix: suffix for naming the base image, applied as {ref}{base_suffix}
115 | restart_file: file that Tilt will update during a live_update to signal the entrypoint to rerun
116 | trigger: (optional) list of local paths. If specified, the process will ONLY be restarted when there are changes
117 | to the given file(s); as the parameter of the same name in the LiveUpdate `run` step.
118 | **kwargs: will be passed to the underlying `custom_build` call
119 | """
120 |
121 | # first, validate the given live_update steps
122 | if len(live_update) == 0:
123 | fail("`custom_build_with_restart` requires at least one live_update step")
124 | for step in live_update:
125 | if type(step) == TYPE_RESTART_CONTAINER_STEP:
126 | fail("`custom_build_with_restart` is not compatible with live_update step: "+
127 | "`restart_container()` (this extension is meant to REPLACE restart_container() )")
128 |
129 | for k, v in kwargs.items():
130 | if k == 'skips_local_docker':
131 | fail("`custom_build_with_restart` is not compatible with `skips_local_docker`, because it needs access to the image")
132 | if k == 'disable_push':
133 | fail("`custom_build_with_restart` is not compatible with `disable_push`")
134 | if k == 'tag':
135 | fail("`custom_build_with_restart` renames your base image, so is not compatible with `tag`")
136 |
137 | # rename the original image to make it a base image and declare a custom_build for it
138 | base_ref = '{}{}'.format(ref, base_suffix)
139 | custom_build(base_ref, command=command, deps=deps, **kwargs)
140 |
141 | # A few arguments aren't applicable to the docker_build, so remove them.
142 | cleaned_kwargs = {k: v for k, v in kwargs.items() if k not in _CUSTOM_BUILD_KWARGS_BLACKLIST}
143 | _helper(base_ref, ref, entrypoint, live_update, restart_file, trigger, **cleaned_kwargs)
144 |
--------------------------------------------------------------------------------
/0-base/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/1-measured/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/101-jib/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/3-unpacked/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/103-micronaut/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/2-optimized/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------
/4-recommended/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88 |
89 | # Use the maximum available, or set MAX_FD != -1 to use that value.
90 | MAX_FD=maximum
91 |
92 | warn () {
93 | echo "$*"
94 | } >&2
95 |
96 | die () {
97 | echo
98 | echo "$*"
99 | echo
100 | exit 1
101 | } >&2
102 |
103 | # OS specific support (must be 'true' or 'false').
104 | cygwin=false
105 | msys=false
106 | darwin=false
107 | nonstop=false
108 | case "$( uname )" in #(
109 | CYGWIN* ) cygwin=true ;; #(
110 | Darwin* ) darwin=true ;; #(
111 | MSYS* | MINGW* ) msys=true ;; #(
112 | NONSTOP* ) nonstop=true ;;
113 | esac
114 |
115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116 |
117 |
118 | # Determine the Java command to use to start the JVM.
119 | if [ -n "$JAVA_HOME" ] ; then
120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 | # IBM's JDK on AIX uses strange locations for the executables
122 | JAVACMD=$JAVA_HOME/jre/sh/java
123 | else
124 | JAVACMD=$JAVA_HOME/bin/java
125 | fi
126 | if [ ! -x "$JAVACMD" ] ; then
127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 |
129 | Please set the JAVA_HOME variable in your environment to match the
130 | location of your Java installation."
131 | fi
132 | else
133 | JAVACMD=java
134 | if ! command -v java >/dev/null 2>&1
135 | then
136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 | fi
142 |
143 | # Increase the maximum file descriptors if we can.
144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 | case $MAX_FD in #(
146 | max*)
147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 | # shellcheck disable=SC2039,SC3045
149 | MAX_FD=$( ulimit -H -n ) ||
150 | warn "Could not query maximum file descriptor limit"
151 | esac
152 | case $MAX_FD in #(
153 | '' | soft) :;; #(
154 | *)
155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 | # shellcheck disable=SC2039,SC3045
157 | ulimit -n "$MAX_FD" ||
158 | warn "Could not set maximum file descriptor limit to $MAX_FD"
159 | esac
160 | fi
161 |
162 | # Collect all arguments for the java command, stacking in reverse order:
163 | # * args from the command line
164 | # * the main class name
165 | # * -classpath
166 | # * -D...appname settings
167 | # * --module-path (only if needed)
168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169 |
170 | # For Cygwin or MSYS, switch paths to Windows format before running java
171 | if "$cygwin" || "$msys" ; then
172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174 |
175 | JAVACMD=$( cygpath --unix "$JAVACMD" )
176 |
177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 | for arg do
179 | if
180 | case $arg in #(
181 | -*) false ;; # don't mess with options #(
182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 | [ -e "$t" ] ;; #(
184 | *) false ;;
185 | esac
186 | then
187 | arg=$( cygpath --path --ignore --mixed "$arg" )
188 | fi
189 | # Roll the args list around exactly as many times as the number of
190 | # args, so each arg winds up back in the position where it started, but
191 | # possibly modified.
192 | #
193 | # NB: a `for` loop captures its iteration list before it begins, so
194 | # changing the positional parameters here affects neither the number of
195 | # iterations, nor the values presented in `arg`.
196 | shift # remove old arg
197 | set -- "$@" "$arg" # push replacement arg
198 | done
199 | fi
200 |
201 |
202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204 |
205 | # Collect all arguments for the java command:
206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 | # and any embedded shellness will be escaped.
208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 | # treated as '${Hostname}' itself on the command line.
210 |
211 | set -- \
212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 | -classpath "$CLASSPATH" \
214 | org.gradle.wrapper.GradleWrapperMain \
215 | "$@"
216 |
217 | # Stop when "xargs" is not available.
218 | if ! command -v xargs >/dev/null 2>&1
219 | then
220 | die "xargs is not available"
221 | fi
222 |
223 | # Use "xargs" to parse quoted args.
224 | #
225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226 | #
227 | # In Bash we could simply go:
228 | #
229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230 | # set -- "${ARGS[@]}" "$@"
231 | #
232 | # but POSIX shell has neither arrays nor command substitution, so instead we
233 | # post-process each arg (as a line of input to sed) to backslash-escape any
234 | # character that might be a shell metacharacter, then use eval to reverse
235 | # that process (while maintaining the separation between arguments), and wrap
236 | # the whole thing up as a single "set" statement.
237 | #
238 | # This will of course break if any of these variables contains a newline or
239 | # an unmatched quote.
240 | #
241 |
242 | eval "set -- $(
243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 | xargs -n1 |
245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 | tr '\n' ' '
247 | )" '"$@"'
248 |
249 | exec "$JAVACMD" "$@"
250 |
--------------------------------------------------------------------------------