Skip to content

Commit

Permalink
3.x example removal (#8437)
Browse files Browse the repository at this point in the history
Delete examples from Helidon 3
Update the examples top level README to direct users to helidon-examples
Update the examples profile to include a module called helidon-examples (instead of examples)
Add a build-examples script that clones the helidon-examples repository into the helidon-examples directory (if it doesn't already exist) and builds the examples.
  • Loading branch information
barchetta authored Feb 29, 2024
1 parent 3de3a80 commit 4a017fb
Show file tree
Hide file tree
Showing 1,355 changed files with 52 additions and 86,067 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ jobs:
- name: Maven build
run: |
mvn -B -e "-Dmaven.test.skip=true" $MAVEN_HTTP_ARGS -DskipTests -Ppipeline install
cd examples
mvn -B verify
echo "TBD: validate examples from external repository"
archetypes:
timeout-minutes: 30
strategy:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ node/
# Helidon CLI
.helidon

# Helidon examples repository
helidon-examples

# Other
*~
user.txt
Expand Down
44 changes: 44 additions & 0 deletions etc/scripts/build-examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash -e
#
# Copyright (c) 2024 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Build helidon examples, cloning the examples repository if needed

# Path to this script
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"

# Load pipeline environment setup and define WS_DIR
. $(dirname -- "${SCRIPT_PATH}")/includes/pipeline-env.sh "${SCRIPT_PATH}" '../..'

# Setup error handling using default settings (defined in includes/error_handlers.sh)
error_trap_setup

# If needed we clone the helidon-examples repo into a subdirectory of the helidon repository
readonly HELIDON_EXAMPLES_PATH=${WS_DIR}/helidon-examples
if [ ! -d "${HELIDON_EXAMPLES_PATH}" ]; then
echo "Cloning examples repository into ${HELIDON_EXAMPLES_PATH}"
git clone --branch dev-3.x --single-branch [email protected]:helidon-io/helidon-examples.git "${HELIDON_EXAMPLES_PATH}"
fi

# Make sure the helidon version from the example repo aligns with this repository
readonly HELIDON_VERSION_IN_THIS_REPO=$(mvn --non-recursive -f ${WS_DIR}/pom.xml help:evaluate -Dexpression=helidon.version | grep -v '\[INFO\]')
readonly HELIDON_VERSION_IN_EXAMPLES=$(mvn --non-recursive -f ${HELIDON_EXAMPLES_PATH}/pom.xml help:evaluate -Dexpression=helidon.version | grep -v '\[INFO\]')
if [ ${HELIDON_VERSION_IN_THIS_REPO} != ${HELIDON_VERSION_IN_EXAMPLES} ]; then
echo "The Helidon version in this repository (${HELIDON_VERSION_IN_THIS_REPO}) does not match the Helidon version in ${HELIDON_EXAMPLES_PATH} (${HELIDON_VERSION_IN_EXAMPLES})"
exit 78
fi

mvn ${MAVEN_ARGS} -f ${HELIDON_EXAMPLES_PATH}/pom.xml clean install
4 changes: 2 additions & 2 deletions etc/scripts/checkstyle.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e
#
# Copyright (c) 2018, 2022 Oracle and/or its affiliates.
# Copyright (c) 2018, 2024 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,7 @@ mvn ${MAVEN_ARGS} checkstyle:checkstyle-aggregate \
-f ${WS_DIR}/pom.xml \
-Dcheckstyle.output.format="plain" \
-Dcheckstyle.output.file="${RESULT_FILE}" \
-Pexamples,ossrh-releases > ${LOG_FILE} 2>&1 || (cat ${LOG_FILE} ; exit 1)
-Possrh-releases > ${LOG_FILE} 2>&1 || (cat ${LOG_FILE} ; exit 1)

grep "^\[ERROR\]" ${RESULT_FILE} \
&& die "CHECKSTYLE ERROR" || echo "CHECKSTYLE OK"
39 changes: 1 addition & 38 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,5 @@

# Helidon Examples

Welcome to the Helidon Examples! If this is your first experience with
Helidon we recommend you start with our
[quickstart](https://helidon.io/docs/v2/#/about/03_prerequisites)
That will quickly get you going with your first Helidon application.
Helidon 3 examples have been moved to the [helidon-examples](https://github.com/helidon-io/helidon-examples/tree/helidon-3.x) repository.

After that you can come back here and dig into the examples. To access
these examples we recommend checking out from a released tag. For example:

```
git clone [email protected]:oracle/helidon.git
cd helidon
git checkout tags/2.0.0
```

Our examples are Maven projects and can be built and run with
Java 11 or newer -- so make sure you have those:

```
java -version
mvn -version
```

# Building an Example

Each example has a `README` that you will follow. To build most examples
just `cd` to the directory and run `mvn package`:

```
cd examples/microprofile/hello-world-explicit
mvn package
```

Usually the example will produce an application jar file that you can run:

```
java -jar target/example-name.jar
```

But always see the example's `README` for details.
5 changes: 0 additions & 5 deletions examples/config/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions examples/config/basics/README.md

This file was deleted.

65 changes: 0 additions & 65 deletions examples/config/basics/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

69 changes: 0 additions & 69 deletions examples/config/basics/src/main/resources/application.conf

This file was deleted.

26 changes: 0 additions & 26 deletions examples/config/basics/src/main/resources/logging.properties

This file was deleted.

Loading

0 comments on commit 4a017fb

Please sign in to comment.