Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#832: Solution for unstable update sites #881

Merged
merged 48 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0de1122
update-sites
alfeilex Sep 9, 2022
ac86394
Update eclipse-update-sites.asciidoc
alfeilex Sep 9, 2022
bc76b2f
Update eclipse-update-sites.asciidoc
alfeilex Sep 9, 2022
088449f
Update eclipse-update-sites.asciidoc
alfeilex Sep 9, 2022
a4c4dec
Update eclipse-update-sites.asciidoc
alfeilex Sep 9, 2022
664a418
Merge branch 'devonfw:master' into eclipse-update-sites
alfeilex Sep 9, 2022
29e5dd2
update sites
alfeilex Sep 9, 2022
1107d0c
Merge branch 'devonfw:master' into eclipse-update-sites
alfeilex Sep 9, 2022
e830694
modify eclipse command
alfeilex Sep 9, 2022
9e2a622
Merge branch 'eclipse-update-sites' of https://github.com/alfeilex/id…
alfeilex Sep 9, 2022
8e22cb9
change eclipse command
alfeilex Sep 11, 2022
db03244
Update eclipse.asciidoc
alfeilex Sep 11, 2022
b92f1dc
Update eclipse.asciidoc
alfeilex Sep 11, 2022
d8b74b8
Update eclipse.asciidoc
alfeilex Sep 11, 2022
ea8f72e
Update CHANGELOG.asciidoc
alfeilex Sep 11, 2022
8c5499f
fix shellcheck
alfeilex Sep 11, 2022
8e822d2
fix version
alfeilex Sep 11, 2022
7e1b016
Update eclipse
alfeilex Sep 11, 2022
e10e65d
Update CHANGELOG.asciidoc
alfeilex Sep 12, 2022
f510de2
Merge branch 'devonfw:master' into eclipse-update-sites
alfeilex Sep 12, 2022
8952507
Update CHANGELOG.asciidoc
alfeilex Sep 12, 2022
add6bb4
Update eclipse
alfeilex Sep 12, 2022
ed490f5
Update eclipse
alfeilex Sep 12, 2022
0db2d29
Update eclipse
alfeilex Sep 12, 2022
e2ec0ee
removed empty echos
alfeilex Sep 12, 2022
52ad676
Merge branch 'master' into eclipse-update-sites
alfeilex Sep 12, 2022
3f7e0a1
add improvements
alfeilex Sep 13, 2022
b6e5a4e
add improvements
alfeilex Sep 13, 2022
853f8ab
Update eclipse.asciidoc
alfeilex Sep 13, 2022
8248f31
Update eclipse.asciidoc
alfeilex Sep 13, 2022
0bf805d
Update eclipse.asciidoc
alfeilex Sep 13, 2022
47b255b
Update eclipse.asciidoc
alfeilex Sep 13, 2022
6a712c3
improvements
alfeilex Sep 13, 2022
765ac2f
review improvements
alfeilex Sep 13, 2022
b0ac8fb
modify eclipse command
alfeilex Sep 14, 2022
bb36013
fix shellcheck
alfeilex Sep 14, 2022
4311336
fix shellcheck
alfeilex Sep 14, 2022
fcc4312
fix shellcheck
alfeilex Sep 14, 2022
3c69085
Update eclipse.asciidoc
alfeilex Sep 14, 2022
5bff37c
change timestamp
alfeilex Sep 14, 2022
a5a7da0
Update eclipse.asciidoc
alfeilex Sep 14, 2022
881c800
add -vm to eclipse mirror function
alfeilex Sep 14, 2022
e5812d2
fix shellcheck
alfeilex Sep 14, 2022
7e32e28
Merge branch 'master' into eclipse-update-sites
alfeilex Sep 16, 2022
49b0fe3
small improvements to doc
hohwille Sep 16, 2022
38f37a7
add doCheckProperties function
alfeilex Sep 16, 2022
25fb9ed
#881: renamed function
hohwille Sep 16, 2022
4f4afce
Merge branch 'master' into eclipse-update-sites
hohwille Sep 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file documents all notable changes to https://github.com/devonfw/ide[devonf
Release in process:

* https://github.com/devonfw/ide/issues/751[#751]: Documentation of functions
* https://github.com/devonfw/ide/issues/832[#832]: Solution for unstable update sites

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

Expand Down
26 changes: 26 additions & 0 deletions documentation/eclipse.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ You may also supply additional arguments as `devon eclipse «args»`. These are
|`ws-re[verse]` |reverse merge changes from workspace into settings
|`ws-reverse-add` |reverse merge adding new properties
|`create-script` |create launch script for this IDE, your current workspace and your OS
|`mirror «id» [«url»]` |mirror the content of an update-site
|=======================

There are link:variables.asciidoc[variables] that can be used for Eclipse. These are explained by the following table:
Expand All @@ -41,13 +42,15 @@ In your link:settings.asciidoc[settings] git repository create a folder https://
Here you can create a properties file for each plugin. This is an example https://github.com/devonfw/ide-settings/blob/master/eclipse/plugins/tmterminal.properties[tmterminal.properties]:
```
plugin_url=http://download.eclipse.org/tm/terminal/marketplace
plugin_mirror_url=https://my-server.com/terminal-2022-09-13
plugin_id=org.eclipse.tm.terminal.feature.feature.group,org.eclipse.tm.terminal.view.feature.feature.group,org.eclipse.tm.terminal.control.feature.feature.group,org.eclipse.tm.terminal.connector.ssh.feature.feature.group,org.eclipse.tm.terminal.connector.telnet.feature.feature.group
plugin_active=true
```

The variables are defined as follows:

* `plugin_url` defines the URL of the Eclipse update site of the plugin
* `plugin_mirror_url` defines the URL of the Eclipse mirrored update site of the plugin. See xref:mirroring update sites[Mirroring Eclipse Update Site]
* `plugin_id` defines the feature group ID(s) to install. To install multiple features/plugins provide a coma-separated list of IDs. If you want to customize `devonfw-ide` with new plugins you can first install them manually and then go to `About Eclipse > Installation Details` then you can filter for your newly installed plugin and find the values in the `Id` column. Copy & paste them from here to make up your own custom config.
* `plugin_active` is an optional parameter. If it is `true` (default) the plugin will be installed automatically during the project link:setup.asciidoc[setup] for all developers in your team. Otherwise, developers can still install the plugin manually via `devon eclipse add-plugin «plugin-name»` from the config file `settings/eclipse/plugins/«plugin-name».properties`. See the `settings/eclipse/plugins` folder for possible values of «plugin-name».

Expand All @@ -70,6 +73,29 @@ ECLIPSE_PLUGINS=("anyedit" "" "regexutil" "")
```
Of course you may also mix plugin IDs with fully qualified plugins.

=== mirroring update sites

A common problem with eclipse plugins is that they are provided decentralized as so-called update sites via URLs.
The maintainer of that URL is in full control of the availability and the content behind that URL.
If the service gets broken, obviously the plugin can not be downloaded.
Even worse, if existing content gets updated, the result is not reproducible anymore.

While the plugin artifact itself is versioned, the request to install a plugin can not specify a version but always downloads the "latest" version from the update site.
If at all some kind of versioning for stability is in place it happens via the URL itself so for different major versions different URLs are provided.
A possible solution is to mirror the update site locally and then make it available on your own webserver.
This way you always have access to the plugin version you need as a developer without being dependent on the plugin provider.
Below is the process to mirror a plugin update-site.

To mirror with only one paramter, you just need the `«plugin-id»` of an existing plugin in `${DEVON_IDE_HOME}/settings/eclipse/plugins` (e.g. checkstyle).
Open any CLI in `${DEVON_IDE_HOME}` and run the following command.

`devon eclipse mirror «plugin-id» [«url»]`

This command will automatically mirror the content of an update site to a specific directory named by `«plugin-id»` together with the current date in `${DEVON_DOWNLOAD_DIR}/update-sites/` (e.g. checkstyle-2022-09-14).
Afterwards, the folder can be uploaded to your own webserver and the URL can be put manually in `«plugin_mirror_url»` in the `«plugin-id».properties` file.
This only works if a valid `plugin_url` is already set in the properties for the given `plugin_id` (see xref:plugins[plugins]).
If you want to mirror an update site independently of `«plugin-id».properties`, you can enter an update site URL for the optional `«url»` parameter (e.g. https://checkstyle.org/eclipse-cs-update-site).

== dictionary

Eclipse already comes with a build-in spellchecker. This is very helpful when writing comments. The default settings of `devonfw-ide` ship with a project specific https://github.com/devonfw/ide-settings/blob/master/eclipse/project.dictionary[dictionary file] and according configurations to enable spellchecking and configuring this dictionary.
Expand Down
72 changes: 62 additions & 10 deletions scripts/src/main/resources/scripts/command/eclipse
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ function doInstallEclipsePlugin() {
result=${?}
if [ "${result}" != 0 ]
then
echo
doEchoAttention "Installation of plugin ${plugin} failed. Please try to install manually or rerun setup (devon eclipse setup)."
echo
fi
return "${result}"
}
Expand Down Expand Up @@ -95,22 +93,23 @@ function doSetup() {
function doAddPluginFromConfig() {
if [ -f "${1}" ]
then
plugin_id=""
plugin_active="true"
plugin_url=""
doLoadProperties "${1}"
if [ -z "${plugin_id}" ] || [ -z "${plugin_url}" ]
doCheckProperties "${1}"
local url
if [ -n "${plugin_mirror_url}" ]
then
doWarning "Invalid eclipse plugin config: ${file}"
elif [ "${plugin_active}" = "true" ] || [ -n "${2}" ]
url="${plugin_mirror_url}"
else
url="${plugin_url}"
fi
if [ "${plugin_active}" = "true" ] || [ -n "${2}" ]
then
# check if plugin successfully installed
local plugin_fileprefix="${1/*\//}"
plugin_fileprefix="${plugin_fileprefix/.properties/}"
local install_file="${ECLIPSE_HOME}/.devon.${plugin_fileprefix}.installed"
if [ ! -e "${install_file}" ]
then
doInstallEclipsePlugin "${plugin_id}" "${plugin_url}"
doInstallEclipsePlugin "${plugin_id}" "${url}"
result_rc=$?
if [ "${result_rc}" = 0 ]
then
Expand Down Expand Up @@ -254,6 +253,53 @@ function doImportEclipse() {
"${ECLIPSE_HOME}/eclipse" -nosplash -vm "${ECLIPSE_JAVA_HOME}/bin/java" -application org.eclipse.ant.core.antRunner -buildfile "${DEVON_IDE_HOME}/scripts/lib_script/import.xml" -data "${WORKSPACE_PATH}" -keyring ~/.eclipse/.keyring -vm "${ECLIPSE_JAVA_HOME}/bin/java" -vmargs -DdevonImportPath="${importPath}" -DdevonImportWorkingSet="${importWorkingSets}" ${ECLIPSE_VMARGS}
}

# $1: id
# $2: optional plugin URL (update site)
function doMirrorUpdateSite() {
if [ -z "${1}" ]
then
doFail "Parameter \"id\" is missing."
fi
local url
if [ -n "${2}" ]
then
url="${2}"
else
doCheckProperties "${1}"
url="${plugin_url}"
fi
local timestamp
timestamp=$(date +'%Y-%m-%d')
"${ECLIPSE_HOME}/eclipse" -nosplash -vm "${ECLIPSE_JAVA_HOME}/bin/java" -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source "${url}" -destination "${DEVON_DOWNLOAD_DIR}/update-sites/${1}-${timestamp}" -vmargs "${ECLIPSE_VMARGS}"
"${ECLIPSE_HOME}/eclipse" -nosplash -vm "${ECLIPSE_JAVA_HOME}/bin/java" -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source "${url}" -destination "${DEVON_DOWNLOAD_DIR}/update-sites/${1}-${timestamp}" -vmargs "${ECLIPSE_VMARGS}"
local result="${?}"
if [ "${result}" != 0 ]
then
doEchoAttention "Mirroring of the update-site ${url} failed. Please check the URL or rerun setup (devon eclipse setup)."
fi
return "${result}"
}

function doCheckProperties() {
local file="${1}"
if [ ! -f "${1}" ]
then
file="${SETTINGS_PATH}/eclipse/plugins/${1}.properties"
fi
if [ -f "${file}" ]
then
plugin_id=""
plugin_active="true"
plugin_url=""
plugin_mirror_url=""
doLoadProperties "${file}"
if [ -z "${plugin_id}" ] || [ -z "${plugin_url}" ]
then
doFail "Invalid eclipse plugin config: ${file}"
fi
fi
}

# CLI
if [ "${1}" = "-h" ] || [ "${1}" = "help" ]
then
Expand All @@ -269,6 +315,7 @@ then
echo " ws-reverse-add reverse merge adding new properties"
echo " create-script create eclipse-${WORKSPACE} script if not already exists"
echo " import «path» [«workingsets»] import projects in «path» into current workspace. «workingsets» comma-separated list of workingsets (no spaces between ,), eg: ./myproject ws1,ws2"
echo " mirror «id» [«url»] mirror the content of an update-site"
exit
fi
ECLIPSE_HOME="${DEVON_IDE_HOME}/software/eclipse"
Expand Down Expand Up @@ -318,6 +365,11 @@ do
then
doImportEclipse "${2}" "${3}"
exit ${?}
elif [ "${1}" = "mirror" ]
then
shift
doMirrorUpdateSite "${@}"
exit ${?}
else
doFail "Unknown argument: ${1}"
fi
Expand Down