-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Changed JDK -Fixed workspace folders permission issue Co-authored-by: Marco Torchiano <[email protected]> Co-authored-by: Stefano Mancini <[email protected]>
- Loading branch information
Showing
16 changed files
with
200 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
#!/usr/bin/env bash | ||
shopt -s dotglob | ||
|
||
if [ ! -f "/config/workspace/.vscode/.startup" ]; then | ||
rm -rf /config/workspace/* | ||
mkdir -p /config/workspace/.vscode/ | ||
cp -R /example_project/* /config/workspace | ||
echo "[Persistent Only Feature]" > /config/workspace/.vscode/.startup | ||
echo "If your CrownLabs instance is persistent, delete this file if you want to reset the workspace on next startup." >> /config/workspace/.vscode/.startup | ||
fi | ||
|
||
# Check if in the passed arguments is specified to disable workspace through the option --disable-marketplace | ||
for ARGUMENT in "$@"; do | ||
if [ "$ARGUMENT" == "--disable-marketplace" ] ; then | ||
export EXTENSIONS_GALLERY='{"serviceUrl": ""}' | ||
fi | ||
done | ||
if [ "$ARGUMENT" == "--load-example" ] ; then | ||
if [ ! -f "$VSCODE_SRV_DIR/workspace/.vscode/.startup" ]; then | ||
rm -rf "$VSCODE_SRV_DIR"/workspace/* | ||
mkdir -p "$VSCODE_SRV_DIR/workspace/.vscode/" | ||
cp -R /example_project/* "$VSCODE_SRV_DIR/workspace" | ||
echo "[Persistent Only Feature]" > "$VSCODE_SRV_DIR/workspace/.vscode/.startup" | ||
echo "If your CrownLabs instance is persistent, delete this file if you want to reset the workspace on next startup." >> "$VSCODE_SRV_DIR/workspace/.vscode/.startup" | ||
fi | ||
|
||
if [ "${CODETOGETHER_ENABLED}" == "true" ]; then | ||
CODETOGETHER_ENABLED_ARG="--enable-proposed-api=genuitecllc.codetogether" | ||
else | ||
CODETOGETHER_ENABLED_ARG="" | ||
fi | ||
fi | ||
done | ||
|
||
exec \ | ||
code-server \ | ||
--disable-update-check \ | ||
--auth none \ | ||
"${CODETOGETHER_ENABLED_ARG}" \ | ||
--bind-addr 0.0.0.0:"${CROWNLABS_LISTEN_PORT}" \ | ||
--user-data-dir /config/data \ | ||
--extensions-dir /config/extensions \ | ||
--user-data-dir "$VSCODE_SRV_DIR/data" \ | ||
--extensions-dir "$VSCODE_SRV_DIR/extensions" \ | ||
--disable-telemetry \ | ||
--new-window \ | ||
/config/workspace | ||
"$VSCODE_SRV_DIR/workspace" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# syntax = edrevo/dockerfile-plus | ||
|
||
INCLUDE+ ./base/Dockerfile | ||
|
||
|
||
# Setup permissions | ||
|
||
# Install required packages | ||
RUN apt-get update && apt-get install -y openjdk-17-jdk openjdk-17-source maven --no-install-recommends | ||
|
||
# Install VS code extension | ||
RUN code-server --extensions-dir ${VSCODE_SRV_DIR}/extensions --install-extension vscjava.vscode-java-pack | ||
|
||
# Remove apt and useless/dangerous packages | ||
RUN apt-get clean && \ | ||
apt-get remove --autoremove --purge -y apt sudo --allow-remove-essential | ||
|
||
COPY ./java/settings.json ${VSCODE_SRV_DIR}/data/User/settings.json | ||
|
||
RUN chown -R ${USER}:${USER} ${VSCODE_SRV_DIR} | ||
|
||
USER ${USER} | ||
|
||
WORKDIR ${VSCODE_SRV_DIR} | ||
|
||
# Forces Maven to preload dependencies | ||
RUN --mount=type=bind,source=./java/triggerproject/,target=./triggerproject cd ${VSCODE_SRV_DIR}/triggerproject && mvn test && rm -rf /tmp/target | ||
|
||
RUN git config --global credential.helper 'cache --timeout=10800'&&\ | ||
git config --global user.email [email protected] &&\ | ||
git config --global user.name crownlabs | ||
|
||
ENTRYPOINT [ "/start.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"security.workspace.trust.enabled": false, | ||
"workbench.colorTheme": "Default Dark Modern", | ||
"workbench.startupEditor": "none", | ||
"window.menuBarVisibility": "visible", | ||
"java.project.importHint": false, | ||
"redhat.telemetry.enabled": false | ||
} |
77 changes: 77 additions & 0 deletions
77
provisioning/standalone/vscode/java/triggerproject/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>it.polito.oop.lab</groupId> | ||
<artifactId>sample</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- https://mvnrepository.com/artifact/junit/junit --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<sourceDirectory>src</sourceDirectory> | ||
<testSourceDirectory>test</testSourceDirectory> | ||
<directory>/tmp/target</directory> | ||
<resources> | ||
<resource> | ||
<directory>${project.basedir}/src</directory> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
|
||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<release>17</release> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.0</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.surefire</groupId> | ||
<artifactId>surefire-junit4</artifactId> | ||
<version>2.22.0</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.7</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>report</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
5 changes: 5 additions & 0 deletions
5
provisioning/standalone/vscode/java/triggerproject/src/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public class Main{ | ||
public static int m(){ | ||
return 1; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
provisioning/standalone/vscode/java/triggerproject/test/MainTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class MainTest { | ||
@Test | ||
public void test(){ | ||
assertEquals(1,Main.m()); | ||
} | ||
} |
Oops, something went wrong.