Skip to content

Commit 478794d

Browse files
hohwilleAmueller36alfeilex
authored
devonfw#878: default version from mirrors devonfw#893: version prefix devonfw#940: generic doInstall (devonfw#934)
* devonfw#878: insteall latest version if unspecified * devonfw#933: fixed typo * devonfw#878: insteall latest version if unspecified also for docker * devonfw#878: added to CHANGELOG * devonfw#826: excuse rule for cobigen added * devonfw#878: fixed stupid bug * devonfw#847: fix for global tools and cobigen * devonfw#878: devonfw#933: fixes and improvements * devonfw#893: ability to configure version prefix * devonfw#940: handle silent mode in doInstall and simplify doSetup * devonfw#934: shellcheck fix * devonfw#934: CHANGELOG * devonfw#940: generalize macos workarounds * devonfw#940: generalize macos workarounds * devonfw#940: generalize macos workarounds * devonfw#940: need to implement on mac, small improvements for debugging * devonfw#940: generalize macos workarounds * devonfw#940: generalize macos workarounds * devonfw#940: fix - thanks shellcheck * devonfw#940: fixed doInstall java extra arg order * devonfw#940: OMG: fixed custom tools bug * devonfw#893: extended test and fixed doVersionCompare * devonfw#934: removed code entirely * devonfw#934: removed TODO * devonfw#934: simplified * devonfw#934: fixed download caching * devonfw#934: fixed aws * devonfw#934: keep code to remove aws installer * devonfw#934: fixed typos * devonfw#957: symlink fix * devonfw#957: symlink fix * devonfw#934: fixed gcviewer * devonfw#934: shellcheck fix * devonfw#934: shellcheck war starts * devonfw#934: improve DEVON_SOFTWARE_PATH on win * devonfw#934: shellcheck fix * devonfw#958: make symlinks work on windows * devonfw#958: updated documentation * devonfw#934: improved DoD from review comment * devonfw#934: define HOME always on top * devonfw#960: prevent "oc version" error * devonfw#940: improve MacOS workaround * devonfw#934: fixed doMavenArchetype * devonfw#934: fixed aws * devonfw#934: aligned and simplified * devonfw#940: fixes for MacOS workaround * devonfw#940: MacOS quickfix for eclipse * devonfw#911: further improvements for eclipse * devonfw#934: shellcheck fix * devonfw#934: nasty shellcheck * devonfw#960: added to CHANGELOG * devonfw#961: split functions, fixed intellij version command on mac * devonfw#961: fixed function doc * Fix Add-plugin and custom start parameter I fixxed the add plugin function which forgot to call vscode with "--install-extension". And I changed the run command so it passes the arguments given to the run method, so you can run vscode with custom start parameters aswell now. For example: devon vscode run --list-extension * devonfw#934: removed debug output * devonfw#961: fixed function doc * devonfw#934: devonfw#943: improve vscode plugin installation * rename pip-latest-windows to pip-latest-pip There was in an error installing pip on Windows because the installation file was renamed from pip-latest-windows-py to pip-latest-pip.py * use cg --version * devonfw#934: added missing X flags * devonfw#940: fixed MacOS Workaround * devonfw#934: python fix due to doInstall installer missuse * devonfw#934: improved doc for shared software * devonfw#934: rancher fix due to doInstall installer missuse * devonfw#934: kubectl shall not have knowledge about docker installation Co-authored-by: Genetics <[email protected]> Co-authored-by: alfeilex <[email protected]>
1 parent ce93904 commit 478794d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+805
-856
lines changed

CHANGELOG.asciidoc

+5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ This file documents all notable changes to https://github.com/devonfw/ide[devonf
77
New release with various improvements and bugfixes:
88

99
* https://github.com/devonfw/ide/issues/826[#826]: List available versions for a tool
10+
* https://github.com/devonfw/ide/issues/878[#878]: Use default tool version from `available-versions`
11+
* https://github.com/devonfw/ide/issues/893[#893]: Ability to configure version prefix
12+
* https://github.com/devonfw/ide/issues/908[#908]: AWS CLI integration for MacOS and bugfix for win/linux
13+
* https://github.com/devonfw/ide/issues/940[#940]: Make doInstall even more generic
1014
* https://github.com/devonfw/ide/issues/935[#935]: doDevonCommand should use doFail instead of doAskToContinue
1115
* https://github.com/devonfw/ide/issues/905[#905]: Better error handling when installing Eclipse plugins
16+
* https://github.com/devonfw/ide/issues/960[#960]: openshift version check fails
1217
* https://github.com/devonfw/ide/issues/929[#929]: Ensure function documentation is in sync
1318

1419
The full list of changes for this release can be found in https://github.com/devonfw/ide/milestone/34?closed=1[milestone 2022.08.004].

documentation/DoD.asciidoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ However, chances to get your change merged quickly are higher if you address all
2222
* [ ] You followed all coding conventions (indent with 2 spaces, no tabs, functions start with `do` prefix, variables are enclosed with curly braces, variables in functions are declared with `local`, etc.)
2323
* [ ] You have already added the issue implemented by your PR in https://github.com/devonfw/ide/blob/master/CHANGELOG.asciidoc[CHANGELOG.asciidoc] to the next open release (see milestones or https://github.com/devonfw/ide/blob/master/.mvn/maven.config[maven.config]). If there is no issue for your PR consider creating it or directly link the PR itself. Please note that the CHANGELOG shall only reflect public changes relevant for end-users. So e.g. if we implement a story and then add another PR as bugfix or improvement to the same story, we do not need to document this in the CHANGELOG to avoid spam and confusion.
2424
* [ ] In case your PR adds a new tool `«tool»` as commandlet there are the following additional checks:
25-
** [ ] The tool is already available as folder `«tool»` in https://github.com/devonfw/ide-mirrors[ide-mirrors]
25+
** [ ] The tool is already available as folder `«tool»` in https://github.com/devonfw/ide-mirrors[ide-mirrors] including `available-versions`.
2626
** [ ] A new commandlet named `«tool»` has been added to https://github.com/devonfw/ide/tree/master/scripts/src/main/resources/scripts/command[command] that allows to install and launch the given software.
2727
** [ ] The tool can be installed automatically (during setup via settings) or via the commandlet call.
2828
** [ ] During the installation process (`devon «tool» setup`) reasonable progress and status information are displayed.
@@ -36,6 +36,8 @@ However, chances to get your change merged quickly are higher if you address all
3636
** [ ] The new tool is added to the table of tools in https://github.com/devonfw/ide/blob/master/documentation/LICENSE.asciidoc#license[LICENSE.asciidoc] with its according licesne. If that license is not yet included, the full license text needs to be added.
3737
** [ ] The new commandlet is a https://github.com/devonfw/ide/blob/master/documentation/cli.asciidoc#command-wrapper[command-wrapper] for `«tool»`.
3838
** [ ] The new commandlet installs potential dependencies automatically (e.g. `doDevonCommand «required-other-tool» setup silent`).
39+
** [ ] The new commandlet defines the variable `TOOL_VERSION_COMMAND` before sourcing the `functions`. If no version check is supported by the tool itself set the value to `-`. In case your commandlet is not about a tool that can be setup, simply set the value as empty to make this explicit.
40+
** [ ] If the new commandlet is about a tool that can be setup, then test that also `devon «tool» version list`, `devon «tool» version get`, and `devon «tool» version set` are all working.
3941
** [ ] The variable `«TOOL»_VERSION` is honored by your commandlet so if present that version will be downloaded and installed.
4042
** [ ] The new commandlet is tested on all plattforms it is availible for. Assuming you are using Windows, testing for Linux can be done with the Windows Subsystem for Linux and for MacOS we have a virtual cloud instance.
4143
* [ ] In case your PR adds, changes, or removes a function (in `functions` or `environment-project`) you need to update `functions.asciidoc` accordingly. There is an automated test that will fail otherwise.

documentation/functions.asciidoc

+44-33
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,10 @@ If the URL is not provided as first argument, it will use the `mirrors` config t
192192
|`$3` |name |The name of the software to download.
193193
|`$4` |version |The version of the software to download. May be omitted to download the latest version.
194194
|`$5` |edition |The optional edition of the software to install (e.g. "enterprise" or "community").
195-
|`$6` |code |The optional technical code used for specific software to compute download URL.
196-
|`$7` |os |The optional OS indicator ('-' if OS independent). If omitted the OS will be determined automatically.
197-
|`$8` |arch |The optional architecture (e.g. x86_64).
198-
|`$9` |ext |The optional extension (e.g. 'tar.gz' or 'zip').
199-
|`$10` |filename|The optional filename to save the downloaded file to.
195+
|`$6` |os |The optional OS indicator ('-' if OS independent). If omitted the OS will be determined automatically.
196+
|`$7` |arch |The optional architecture (e.g. x86_64).
197+
|`$8` |ext |The optional extension (e.g. 'tar.gz' or 'zip').
198+
|`$9` |filename|The optional filename to save the downloaded file to.
200199
|=======================
201200

202201
=== doDownloadInternal
@@ -206,10 +205,34 @@ If this does not happen, the name is determined from the URL.
206205
If the file exists and the force option was not specified, the function ends with a corresponding message and the return value 255.
207206
Otherwise the file is downloaded and, if successful, moved to the target directory.
208207

208+
=== doEnvironmentProject
209+
Loads all `devon.properties` via xref:doLoadProperties[].
210+
If the first argument is not empty (set to `export`) it will export all the properties.
211+
Also it sets the environment variables `DEVON_HOME_DIR`, `WORKSPACE`, and `WORKSPACE_PATH`.
212+
Finally, it updates the `PATH` variable via xref:doUpdatePath[] and exports it.
213+
209214
=== doExtract
210215
Takes the file to be extracted and possibly a path to where it should be extracted.
211216
Then the right tool is selected based on the file extension and the file is unzipped.
212217

218+
=== doResolveDownloadUrl
219+
Function for additional custom logic when resolving the download URL.
220+
The xref:doDownload[] function resolves standard variables like `version`, `os`, `arch`, and `ext` automatically in URLs from `mirrors` repository config.
221+
However, for special cases this is insufficient as some tools do not follow best-pratices for consistent and systematic download URLs.
222+
Therefore xref:doDownload[] will call this function to further resolve the computed download URL.
223+
By default this function does nothing but echoing the given URL (`$1`).
224+
However, a commandlet may override this function after souring `functions` in order to define custom logic for URL resolving.
225+
When required, we typically resolve a `code` variable that can be derived from the arguments given to this function.
226+
227+
|=======================
228+
|*Param*|*Name* |*Description*
229+
|`$1` |URL |The download URL with standard variables resolved.
230+
|`$2` |version |The resolved version to download.
231+
|`$3` |os |The resolved/mapped operating system.
232+
|`$4` |arch |The resolved/mapped architecture (e.g. x86_64).
233+
|`$5` |edition |The optional edition of the software to install (e.g. "enterprise" or "community").
234+
|=======================
235+
213236
=== doGitPullOrClone
214237
Takes the target path and the URL or URL#branch as parameters.
215238
If the directory is a Git repository, it is tested whether remote repositories are configured and, if so, a git pull is performed.
@@ -219,37 +242,21 @@ However, if a URL was specified, the specified directory is created, changed to
219242
If the branch was also specified in the URL, a checkout is carried out on this branch.
220243

221244
=== doInstall
222-
The url of the software to be installed, the target directory in which the software is to be stored and the name of the software are given as parameters to the doInstall function.
223-
The function then downloads the software via doDownload into the download directory of the registered user, unpacks the software into the updates/extracted directory and then finally moves the software into the DEVON_IDE_HOME/software/"name of the software" directory.
224-
225-
Additional parameters can also be passed to the function:
226-
227-
* The version parameter ensures that a specific version of the software is installed.
228-
229-
* If a "-" is passed to the function as the url, the settings from the Git repository ide-mirrors are used to download the correct software, e.g.
230-
depending on the operating system.
231-
232-
* You can specify your own repository using the repository parameter or the DEVON_SOFTWARE_REPOSITORY variable.
233-
This ensures that the package to be installed is loaded from there.
234-
235-
* If software is required that needs to be installed instead of just being unpacked and moved to the IDE_DEVON_HOME/software directory, you can set the directory for the installation software to DEVON_IDE_HOME/updates/install as the target directory.
236-
Following the doInstall call in the commandlet, the installation of the software can then be initiated.
237-
238-
* If parameters five through nine (edition, code, os, arch, and ext) are specified, they are passed directly to the doDownload function.
245+
Ensures a specific version of a software is installed.
246+
If no fixed version is given, it resolves the final version (if version is empty use latest, in case of version prefix use latest matching version).
247+
In case the software is already installed in the resolved version, return `1`.
239248

240249
|=======================
241250
|*Param*|*Name* |*Description*
242-
|`$1` |URL |The explicit URL to download from or `-` to compute in xref:doDownload[].
243-
|`$2` |path |The absolute target path where to install the software.
244-
|`$3` |name |The name of the software to install.
245-
|`$4` |version |The version of the software to install. May be omitted to install the latest version.
246-
|`$5` |edition |The optional edition of the software to install (e.g. "enterprise" or "community").
247-
|`$6` |code |The optional technical code used for specific software to compute download URL.
248-
|`$7` |os |The optional OS indicator ('-' if OS independent). If omitted the OS will be determined automatically.
249-
|`$8` |arch |The optional architecture (e.g. x86_64).
250-
|`$9` |ext |The optional extension (e.g. 'tar.gz' or 'zip').
251-
|`$10` |repo |The optional software repository.
252-
|`$11` |noUnpack|The optional argument to ignore extracting downloaded files (if not empty extracting will be skipped)
251+
|`$1` |software|The name of the software to install.
252+
|`$2` |version |The version of the software to install. May be omitted to install the latest version.
253+
|`$3` |silent |The optional silent flag ('silent' to suppress output if already up-to-date or empty for version output).
254+
|`$4` |edition |The optional edition of the software to install (e.g. "enterprise" or "community").
255+
|`$5` |path |The absolute target path where to install the software.
256+
|`$6` |os |The optional OS indicator ('-' if OS independent). If omitted the OS will be determined automatically.
257+
|`$7` |noUnpack|The optional argument to ignore extracting downloaded files (use 'noUnpack' or leave empty to extract)
258+
|`$8` |repo |The optional software repository.
259+
|`$9` |url |The optional download URL.
253260
|=======================
254261

255262
=== doInstallWithPackageManager
@@ -408,6 +415,10 @@ If this is the case, the function ends with the return value 0, otherwise with 1
408415
Checks whether the module passed with the first parameter is contained in the package package.json.
409416
If so, then it ends with the return value 0 otherwise with a message and the return value 255.
410417

418+
=== doIsPrefix
419+
Checks if the first arg is a prefix of the second arg.
420+
E.g. `doIsPrefix "foo/bar" "foo/bar/some"` will be true but `doIsPrefix "/foo/bar" "foo/bar/some"` will be false.
421+
411422
=== doParseOption
412423
Checks whether the parameter passed to it
413424

documentation/software.asciidoc

+7-5
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,24 @@ This subfolder needs to contain the tool in that version for every operating sys
2626
By default, each installation of `devonfw-ide` has its own physical installations of the required tools in the desired versions stored in its local `software` folder.
2727
While this is great for isolation of `devonfw-ide` installations and to prevent side-effects, it can cause a huge waste of disc resources in case you are having many installations of `devonfw-ide`.
2828
If you are a power-user of `devonfw-ide` with more then ten or even up to hundreds of installations on your machine, you might love to share installations of a software tool in a particular version between multiple `devonfw-ide` installations.
29+
In order to do so, you only need to link:configuration.asciidoc[configure] the variable `DEVON_SOFTWARE_PATH` in your `~/devon.properties` pointing to an existing absolute directory on your disc (e.g. `/projects/software` or `C:\projects\software`).
2930

30-
CAUTION: If you use this power-feature you are taking responsibility for side-effects and should not expect support. Also if you are using Windows please read https://www.joshkel.com/2018/01/18/symlinks-in-windows/[Symlinks in Windows] and make your mind if you really want to do so. You might also use this link:advanced-tooling-windows.asciidoc#create-symbolic-links[hint] and maintain it manually without enabling the following feature.
31+
CAUTION: DEVON_SOFTWARE_PATH must be an absolte path that is an existing directory. On windows it has to be on the same drive as your IDE installations. If you use this power-feature you are taking responsibility for side-effects and should not expect support. You might also use this link:advanced-tooling-windows.asciidoc#create-symbolic-links[hint] and maintain it manually without enabling the following feature.
3132

32-
In order to do so, you only need to link:configuration.asciidoc[configure] the variable `DEVON_SOFTWARE_PATH` in your `~/devon.properties` pointing to an existing directory on your disc (e.g. `/projects/software` or `C:\projects\software`).
3333
Then `devonfw-ide` will install required software into `${DEVON_SOFTWARE_PATH}/${software_name}/${software_version}` as needed and create a symbolic link to it in `${DEVON_IDE_HOME}/software/${software_name}`.
3434

35-
As a benefit, another `devonfw-ide` installation will using the same software with the same version can re-use the existing installation and only needs to create the symbolic link. No more waste of having many identical JDK installations on your disc.
35+
As a benefit, another `devonfw-ide` installation will using the same software with the same version can re-use the existing installation and only needs to create the symbolic link.
36+
No more waste of having many identical JDK installations on your disc.
3637

3738
As a drawback, you need to be aware that specific tools may be "manipulated" after installation.
38-
The most common case is that a tool allows to install plugins or extensions such as all IDEs do. Such "manipulations" will cause side-effects between the different `devonfw-ide` installations sharing the same version of that tool.
39+
The most common case is that a tool allows to install plugins or extensions such as all IDEs do.
40+
Such "manipulations" will cause side-effects between the different `devonfw-ide` installations sharing the same version of that tool.
3941
While this can also be a benefit it may also cause trouble.
4042
If you have a sensitive project that should not be affected by such side-effects, you may again override the `DEVON_SOFTWARE_PATH` variable to the empty value in your `${DEVON_IDE_HOME}/conf/devon.properties` of that sensitive installation:
4143
```
4244
DEVON_SOFTWARE_PATH=
4345
```
44-
This will disable this feature particularly for that specific sensitive `devonfw-ide` installation but let you use it for all other ones.
46+
This will disable this feature particularly for that specific sensitive `devonfw-ide` installation but let you use it for other ones.
4547

4648
== Custom
4749

scripts/src/main/resources/scripts/command/aws

100644100755
+32-36
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,9 @@ then
1010
exit
1111
fi
1212

13-
if [ -n "${DEVON_IDE_TRACE}" ]; then set -vx; fi
14-
TOOL_VERSION_COMMAND="aws --version"
1513
# shellcheck source=scripts/functions
1614
source "$(dirname "${0}")"/../functions
1715

18-
# Call aws with specified arguments.
19-
function doRun() {
20-
doSetup silent
21-
findAws
22-
doRunCommand "'${AWS}' ${*}"
23-
}
24-
25-
2616
# OS independent check if aws is installed.
2717
function findAws() {
2818
AWS="aws"
@@ -38,23 +28,32 @@ function findAws() {
3828
aws_win="${aws_win}/Amazon/AWSCLIV2/aws"
3929
if [ -f "${aws_win}" ]
4030
then
41-
AWS="${aws_win}"
4231
AWS_INSTALLED="yes"
4332
fi
33+
AWS="${aws_win}"
4434
fi
35+
TOOL_VERSION_COMMAND="'${AWS}' --version"
36+
}
37+
38+
findAws
39+
# shellcheck source=scripts/commandlet-cli
40+
source "$(dirname "${0}")"/../commandlet-cli
41+
42+
# Call aws with specified arguments.
43+
function doRun() {
44+
doSetup silent
45+
findAws
46+
doRunCommand "'${AWS}' ${*}"
4547
}
4648

4749
# $1: path_to_package
48-
# $2: software version
49-
function doPackageInstall()
50-
{
50+
function doPackageInstall() {
5151
local path_to_package="${1}"
52-
local version="${2}"
5352
if doIsWindows
5453
then
5554
doEcho "Installing AWS for Windows..."
5655
windows_path_to_package=$(cygpath -w "${path_to_package}")
57-
powershell.exe -Command "Start-Process msiexec.exe -verb runas -Wait -ArgumentList '/I ${windows_path_to_package}\aws-${version}-windows.msi /quiet'"
56+
powershell.exe -Command "Start-Process msiexec.exe -verb runas -Wait -ArgumentList '/I ${windows_path_to_package}\aws-*-windows.msi /quiet'"
5857
elif doIsMacOs
5958
then
6059
doEcho "Installing AWS for MacOS..."
@@ -71,45 +70,42 @@ function doPackageInstall()
7170
}
7271

7372
function doSetup() {
74-
local ERR=""
75-
findAws
76-
if [[ ${AWS_INSTALLED} != "yes" ]] || [[ "${1}" != "silent" ]]
73+
if [ "${AWS_INSTALLED}" == "yes" ]
7774
then
78-
# Get leatest release
79-
if [ -z "${AWS_VERSION}" ]
75+
if [ -z "${1}" ]
8076
then
81-
doEcho "Getting latest release..."
82-
AWS_VERSION=$(curl "https://github.com/aws/aws-cli/tags" | awk -F'tags/' '/archive/ { print $2}' | sort -r | head -1 | awk -F'.zip' '{print $1}')
77+
doEcho "Aws already installed in version ${AWS_VERSION:-latest}"
78+
doRunCommand "${TOOL_VERSION_COMMAND}" "verify installation of aws"
8379
fi
84-
85-
doInstall "-" "${DEVON_IDE_HOME}/updates/install/aws" "aws" "${AWS_VERSION}"
86-
ERR="${?}"
87-
if [ "${ERR}" = "0" ]
80+
else
81+
# workaround as we are downloading the installer and not installing the software itself
82+
TOOL_VERSION_COMMAND="-"
83+
doInstall "aws" "${AWS_VERSION}" "${1}" "" "${DEVON_IDE_HOME}/updates/install/aws"
84+
if [ "${?}" = 0 ]
8885
then
89-
doPackageInstall "${DEVON_IDE_HOME}/updates/install/aws" "${AWS_VERSION}"
86+
doPackageInstall "${DEVON_IDE_HOME}/updates/install/aws"
87+
findAws
88+
if [ "${1}" != "silent" ] && ! doIsQuiet
89+
then
90+
doRunCommand "${TOOL_VERSION_COMMAND}" "verify installation of aws"
91+
fi
9092
fi
9193
doRunCommand "rm -rf ${DEVON_IDE_HOME}/updates/install/aws"
92-
93-
if [ "${1}" != "silent" ] && ! doIsQuiet
94-
then
95-
doEcho "logon again to test aws with \"aws --version\""
96-
fi
9794
fi
9895
}
9996

100-
10197
# CLI
10298
case ${1} in
10399
"help" | "-h")
104100
echo "Setup or run AWS CLI (command-line interface for Amazon-Web-Services)."
105101
echo
106102
echo "Arguments:"
107103
echo " setup install aws on your machine."
108-
echo " «args» call aws with the specified arguments. Call aws --help for details or use aws directly as preferred."
104+
echo " «args» call aws with the specified arguments. Call aws --help for details or use aws directly as preferred."
109105
echo
110106
;;
111107
"setup" | "s" | "")
112-
doSetup
108+
doSetup "${2}"
113109
;;
114110
*)
115111
doRun "${@}"

0 commit comments

Comments
 (0)