Skip to content

Commit

Permalink
Merge branch 'master' into devonfw#1112-Version-prefix-not-working-as…
Browse files Browse the repository at this point in the history
…-expected
  • Loading branch information
hohwille authored May 22, 2023
2 parents f802a37 + 92c2261 commit f2e4d2c
Show file tree
Hide file tree
Showing 34 changed files with 882 additions and 105 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/update-urls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ jobs:
- name: Commit and push to ide-urls
run: |
cd ide-urls
git add .
git config --global user.name ${{ secrets.BUILD_USER }}
git config --global user.email ${{ secrets.BUILD_USER_EMAIL }}
git commit -m "Update urls" || echo "No changes, nothing to do." && exit 0
git push
git add .
git commit -m "Update urls"
if [ $? = 0 ]
then
git push
else
echo "Commit failed. Most probably no changes and nothing to do."
fi
1 change: 1 addition & 0 deletions documentation/LICENSE.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ The following table shows the components that may be used. The column `inclusion
|https://github.com/devonfw/devon4ng[devon4ng] |Optional|https://github.com/devonfw/devon4ng/blob/master/LICENSE.txt[ASL 2.0]
|https://github.com/devonfw/devon4node[devon4node] |Optional|https://github.com/devonfw/devon4node/blob/develop/LICENSE.txt[ASL 2.0]
|https://www.jetbrains.com/idea/[IntelliJ IDEA] |Optional|https://www.jetbrains.com/opensource/idea/[ASL 2.0]
|https://developer.android.com/studio[Android Studio] |Optional|https://developer.android.com/license[ASL 2.0]
|http://www.jasypt.org/[jasypt] |Optional|http://www.jasypt.org/license.html[ASL 2.0]
|https://www.docker.com/[docker]|Optional|https://docs.docker.com/engine/#licensing[ASL 2.0] and https://www.docker.com/legal/docker-software-end-user-license-agreement[EULA]
|https://kubernetes.io/[kubernetes]|Optional|https://github.com/kubernetes/kubernetes/blob/master/LICENSE[ASL 2.0]
Expand Down
70 changes: 70 additions & 0 deletions documentation/android-studio.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
:toc:
toc::[]

= android-studio

The `android-studio` commandlet allows to install, configure, and launch https://developer.android.com/studio/[Android Studio].
To launch Android Studio for your current workspace and `devonfw-ide` installation, simply run:
`devon android-studio`

You may also supply additional arguments as `devon android-studio «args»`.
These are explained by the following table:

.Usage of `devon android-studio`
[options="header"]
|=======================
|*Argument(s)* |*Meaning*
|`--all` |if provided as first arg then to command will be invoked for each workspace
|`setup` |setup Android Studio (install or update)
|`add-plugin «id»`|install an additional plugin
|`run` |launch Android Studio (default if no argument is given)
|`start` |same as `run`
|`ws-up[date]` |update workspace
|`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
|=======================

There are link:variables.asciidoc[variables] that can be used for Android Studio.
These are explained by the following table:

.Variables of devonfw-ide for Android Studio
[options="header"]
|=======================
|*Variable*|*Meaning*
|*`ANDROID_STUDIO_VERSION`*|The version of the tool Android Studio to install and use.
|*`EXTRA_JAVA_VERSION`*|You can set this to a different (newer) version of Java used to launch your IDE (other than `JAVA_VERSION` that is used to build your project)
|=======================

== plugins

To be productive with Android Studio you need plugins.
Of course `devonfw-ide` can automate this for you:
In your link:settings.asciidoc[settings] git repository create a folder https://github.com/devonfw/ide-settings/tree/master/android-studio/plugins[android-studio/plugins] (click this link to see more examples and see which plugins come by default).
Here you can create a properties file for each plugin.
This is an example https://github.com/devonfw/ide-settings/blob/master/android-studio/plugins/asciidoc.properties[scala.properties]:
```
plugin_id=org.asciidoctor.intellij.asciidoc
plugin_active=false
```

The variables are defined as following:

* `plugin_id` defines the unique ID of the plugin to install.
If you want to customize `devonfw-ide` with new plugins use the search on https://plugins.jetbrains.com/androidstudio to find the plugin of your choice.
Select the tab `Versions` and click on a version in the list.
The plugin ID is displayed in the upper right corner.
Copy & paste the ID 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 android-studio add-plugin «plugin_id»`.

In general, you should try to stick with the configuration pre-defined by your project.
But some plugins may be considered as personal flavor and are typically not predefined by the project config.
Such plugins should be shipped with your link:settings.asciidoc[settings] as described above with `plugin_active=false` allowing you to easily install it manually.
Surely, you can easily add plugins via the UI of Android Studio.
However, be aware that some plugins may collect sensitive data or could introduce other vulnerabilities.
So consider the governance of your project and talk to your technical lead before installing additional plugins that are not pre-defined in your link:settings.asciidoc[settings].

As maintainer of the link:settings.asciidoc[settings] for your project you should avoid to ship too many plugins that may waste resources but are not used by every developer.
By configuring additional plugins with `plugin_active=false` you can give your developers the freedom to install some additional plugins easily.
1 change: 1 addition & 0 deletions documentation/cli.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ However, when you automate and want to avoid "command not found" errors, you can

The following commandlets are currently available:

* link:android-studio.asciidoc[android-studio]
* link:aws.asciidoc[aws]
* link:az.asciidoc[az]
* link:build.asciidoc[build]
Expand Down
2 changes: 2 additions & 0 deletions documentation/devonfw-ide-usage.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ include::variables.asciidoc[leveloffset=2]

include::cli.asciidoc[leveloffset=2]

include::android-studio.asciidoc[leveloffset=3]

include::aws.asciidoc[leveloffset=3]

include::az.asciidoc[leveloffset=3]
Expand Down
40 changes: 30 additions & 10 deletions documentation/intellij.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ The `intellij` commandlet allows to install, configure, and launch https://www.j
To launch IntelliJ for your current workspace and `devonfw-ide` installation, simply run:
`devon intellij`

You may also supply additional arguments as `devon intellij «args»`. These are explained by the following table:
You may also supply additional arguments as `devon intellij «args»`.
These are explained by the following table:

.Usage of `devon intellij`
[options="header"]
Expand All @@ -24,32 +25,51 @@ You may also supply additional arguments as `devon intellij «args»`. These are
|`create-script` |create launch script for this IDE, your current workspace and your OS
|=======================

There are link:variables.asciidoc[variables] that can be used for IntelliJ. These are explained by the following table:
There are link:variables.asciidoc[variables] that can be used for IntelliJ.
These are explained by the following table:

.Variables of devonfw-ide for intelliJ
[options="header"]
|=======================
|*Variable*|*Meaning*
|*`INTELLIJ_VERSION`*|The version of the tool IntelliJ to install and use.
|*`INTELLIJ_EDITION_TYPE`*|The edition of the tool IntelliJ to install and use. The value `C` mean Community edition and the value `U` mean Ultimate edition. The Ultimate edition requires a license. The user has to buy the license separately and it is not part of devonfw-ide. The devonfw-ide only supports download and installation.
|*`EXTRA_JAVA_VERSION`|You can set this to a different (newer) version of Java used to launch your IDE (other than `JAVA_VERSION` that is used to build your project)
|*`INTELLIJ_EDITION_TYPE`*|The edition of the tool IntelliJ to install and use.
The value `C` mean Community edition and the value `U` mean Ultimate edition.
The Ultimate edition requires a license.
The user has to buy the license separately, and it is not part of devonfw-ide.
The devonfw-ide only supports download and installation.
|*`EXTRA_JAVA_VERSION`*|You can set this to a different (newer) version of Java used to launch your IDE (other than `JAVA_VERSION` that is used to build your project)
|=======================

== plugins

To be productive with IntelliJ you need plugins. Of course `devonfw-ide` can automate this for your:
To be productive with IntelliJ you need plugins.
Of course `devonfw-ide` can automate this for your:
In your link:settings.asciidoc[settings] git repository create a folder https://github.com/devonfw/ide-settings/tree/master/intellij/plugins[intellij/plugins] (click this link to see more examples and see which plugins come by default).
Here you can create a properties file for each plugin. This is an example https://github.com/devonfw/ide-settings/blob/master/intellij/plugins/scala.properties[scala.properties]:
Here you can create a properties file for each plugin.
This is an example https://github.com/devonfw/ide-settings/blob/master/intellij/plugins/scala.properties[scala.properties]:
```
plugin_id=org.intellij.scala
plugin_active=false
```

The variables are defined as following:

* `plugin_id` defines the unique ID of the plugin to install. If you want to customize `devonfw-ide` with new plugins use the search on https://plugins.jetbrains.com/idea_ce to find the plugin of your choice. Select the tab `Versions` and click on a version in the list. The plugin ID is displayed in the upper right corner. Copy & paste the ID 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 intellij add-plugin «plugin_id»`.
* `plugin_id` defines the unique ID of the plugin to install.
If you want to customize `devonfw-ide` with new plugins use the search on https://plugins.jetbrains.com/idea_ce to find the plugin of your choice.
Select the tab `Versions` and click on a version in the list.
The plugin ID is displayed in the upper right corner.
Copy & paste the ID 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 intellij add-plugin «plugin_id»`.

In general you should try to stick with the configuration pre-defined by your project. But some plugins may be considered as personal flavor and are typically not predefined by the project config. Such plugins should be shipped with your link:settings.asciidoc[settings] as described above with `plugin_active=false` allowing you to easily install it manually. Surely, you can easily add plugins via the UI of IntelliJ. However, be aware that some plugins may collect sensitive data or could introduce other vulnerabilities. So consider the governance of your project and talk to your technical lead before installing additional plugins that are not pre-defined in your link:settings.asciidoc[settings].
In general you should try to stick with the configuration pre-defined by your project.
But some plugins may be considered as personal flavor and are typically not predefined by the project config.
Such plugins should be shipped with your link:settings.asciidoc[settings] as described above with `plugin_active=false` allowing you to easily install it manually.
Surely, you can easily add plugins via the UI of IntelliJ.
However, be aware that some plugins may collect sensitive data or could introduce other vulnerabilities.
So consider the governance of your project and talk to your technical lead before installing additional plugins that are not pre-defined in your link:settings.asciidoc[settings].

As maintainer of the link:settings.asciidoc[settings] for your project you should avoid to ship too many plugins that may waste resources but are not used by every developer. By configuring additional plugins with `plugin_active=false` you can give your developers the freedom to install some additional plugins easily.
As maintainer of the link:settings.asciidoc[settings] for your project you should avoid to ship too many plugins that may waste resources but are not used by every developer.
By configuring additional plugins with `plugin_active=false` you can give your developers the freedom to install some additional plugins easily.
1 change: 1 addition & 0 deletions documentation/scripts.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This directory is the heart of the `devonfw-ide` and contains the required link:
----
/scripts
├──/ https://github.com/devonfw/ide/tree/master/scripts/src/main/resources/scripts/command[command]
│ ├── link:android-studio.asciidoc[android-studio]
│ ├── link:aws.asciidoc[aws]
│ ├── link:az.asciidoc[az]
│ ├── link:build.asciidoc[build]
Expand Down
201 changes: 201 additions & 0 deletions scripts/src/main/resources/scripts/command/android-studio
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
#!/usr/bin/env bash

# autocompletion list
if [ "${1}" = "shortlist" ]
then
all_opts="ws-update ws-reverse ws-reverse-add create-script"
if [ -z "${2}" ]
then
echo "--all setup version add-plugin run start ${all_opts} help"
elif [ "${2}" = "--all" ]
then
echo "${all_opts}"
fi
exit
fi

# shellcheck source=scripts/functions
source "$(dirname "${0}")"/../functions
ANDROID_STUDIO_HOME="${DEVON_IDE_HOME}/software/android-studio"
if doIsMacOs
then
TOOL_VERSION_COMMAND="cd '${DEVON_IDE_HOME}/software/macos/android-studio'/*.app && head -n 6 'Contents/Resources/product-info.json'"
else
TOOL_VERSION_COMMAND="head -n 7 '${ANDROID_STUDIO_HOME}/product-info.json'"
fi
# shellcheck source=scripts/commandlet-cli
source "$(dirname "${0}")"/../commandlet-cli
cd "${DEVON_IDE_HOME}" || exit 255

function doSetup() {
doDevonCommand java setup silent
doInstall "android-studio" "${ANDROID_STUDIO_VERSION}" "${1}"
if [ "${?}" = 0 ]
then
if [ -f "${ANDROID_STUDIO_HOME}/bin/studio.sh" ]
then
ln -s "${ANDROID_STUDIO_HOME}/bin/studio.sh" "${ANDROID_STUDIO_HOME}/bin/studio"
fi
export PATH="${ANDROID_STUDIO_HOME}/bin:${PATH}"
doAddPlugins
fi
}

function doAddPlugins() {
local file
for file in "${SETTINGS_PATH}"/android-studio/plugins/*.properties
do
if [ -f "${file}" ]
then
plugin_id=""
plugin_active="true"
doLoadProperties "${file}"
if [ -z "${plugin_id}" ]
then
doWarning "Invalid Android Studio plugin config: ${file}"
elif [ "${plugin_active}" = "true" ]
then
doAddPlugin "${plugin_id}"
fi
fi
done
}

function doAddPlugin() {
local pluginId="${1}"
local download_dir="${DEVON_DOWNLOAD_DIR}"
local android_studio_build
local install_path="${DEVON_IDE_HOME}/software/android-studio-plugins/"
if [ -e "${ANDROID_STUDIO_HOME}/build.txt" ]
then
android_studio_build="$(cat "${ANDROID_STUDIO_HOME}/build.txt")"
elif [ -e "${ANDROID_STUDIO_HOME}/Android Studio.app/Contents/Resources/build.txt" ]
then
android_studio_build="$(cat "${ANDROID_STUDIO_HOME}/Android Studio.app/Contents/Resources/build.txt")"
fi

if [ -n "${1}" ] && [ -n "${android_studio_build}" ]
then
mkdir -p "${install_path}"
local download_url="https://plugins.jetbrains.com/pluginManager?action=download&id=${pluginId}&build=${android_studio_build}"
local filename="android-studio-plugin-${android_studio_build}-${pluginId}"
doDownload "${download_url}" "${download_dir}" "${filename}" "" "" "" "" "" "${filename}"
# test if downloaded file is a valid zip archive...
if unzip -z "${download_dir}/${filename}" > /dev/null 2>&1
then
local extract_path="${DEVON_IDE_HOME}/updates/extracted/${pluginId}"
doUnzip "${download_dir}/${filename}" "${extract_path}"
doRunCommand "cp -r '${extract_path}/'* '${install_path}/'"
doRunCommand "rm -r '${extract_path}/'"
else
doRunCommand "cp '${download_dir}/${filename}' '${install_path}/${pluginId}'"
fi
else
doEcho "No plugins to be installed"
fi
}

function doConfigureAndroidStudio() {
local mode="${1}"
if [ ! -d "${WORKSPACE_PATH}/.idea" ]
then
if [ -z "${mode}" ]
then
mode="-u"
elif [ "${mode}" != "-u" ]
then
doFail "Workspace ${WORKSPACE} is not initialized.\nReverse merge is not possible."
fi
fi
if [ -n "${mode}" ]
then
doConfigureWorkspace "${SETTINGS_PATH}/android-studio/workspace" "${WORKSPACE_PATH}" "${mode}"
fi
}

function doStartAndroidStudio() {
doConfigureAndroidStudio "-u"
if [ -n "${EXTRA_JAVA_VERSION}" ]
then
JAVA_HOME="${DEVON_IDE_HOME}/software/extra/java"
doExtendPath "${JAVA_HOME}"
fi
echo "launching Android Studio..."
local STUDIO="${ANDROID_STUDIO_HOME}/bin/studio64.exe"
if [ ! -f "${STUDIO}" ];
then
STUDIO="${ANDROID_STUDIO_HOME}/bin/studio"
fi
if [ ! -f "${STUDIO}" ];
then
STUDIO="${ANDROID_STUDIO_HOME}/studio"
fi
export STUDIO_PROPERTIES="${WORKSPACE_PATH}/idea.properties"
if doIsMacOs
then
echo "MacOs command ${STUDIO}"
open "${STUDIO}" --args "${@}"
else
echo "command ${STUDIO}"
"${STUDIO}" "${@}" &
fi
}

# CLI
if [ "${1}" = "-h" ] || [ "${1}" = "help" ]
then
echo "Manage Android Studio IDE and workspace."
echo
echo "Arguments:"
echo " --all if provided as first arg then to command will be invoked for each workspace"
echo " setup setup Android Studio (install or update)"
echo " add-plugin «id» install an additional plugin"
echo " run | start launch Android Studio IDE (default if no argument is given)"
echo " ws-up[date] update Android Studio workspace"
echo " ws-re[verse] reverse merge changes from workspace into settings"
echo " ws-reverse-add reverse merge adding new properties"
echo " create-script create android-studio-${WORKSPACE} script if not already exists"
exit
fi
if [ -z "${1}" ]
then
doSetup silent
doStartAndroidStudio
elif [ "${1}" = "setup" ]
then
doSetup "${2}"
exit
fi
if [ "${1}" = "--all" ]
then
shift
doDevonCommandAllWorkspaces android-studio "${@}"
fi
while [ -n "${1}" ]
do
if [ "${1}" = "run" ] || [ "${1}" = "start" ]
then
doSetup silent
shift
doStartAndroidStudio "${@}"
elif [ "${1}" = "ws-up" ] || [ "${1}" = "ws-update" ]
then
doConfigureAndroidStudio "-u"
elif [ "${1}" = "ws-re" ] || [ "${1}" = "ws-reverse" ]
then
doConfigureAndroidStudio "-i"
elif [ "${1}" = "ws-reverse-add" ]
then
doConfigureAndroidStudio "-x"
elif [ "${1}" = "create-script" ]
then
doCreateIdeScript android-studio
elif [ "${1}" = "add-plugin" ]
then
shift
doAddPlugin "${@}"
else
doFail "Unknown argument: ${1}"
fi
shift
done
Loading

0 comments on commit f2e4d2c

Please sign in to comment.