Skip to content

Commit 0d97d0b

Browse files
arindam89geek-paulsiriak
authored
Add Devcontainer Support (TheAlgorithms#3156)
Co-authored-by: Arindam Paul <arindam.paul.1989@gmail.com> Co-authored-by: Andrii Siriak <siryaka@gmail.com>
1 parent 85c836c commit 0d97d0b

File tree

6 files changed

+77
-18
lines changed

6 files changed

+77
-18
lines changed

.devcontainer/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/java/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
4+
ARG VARIANT="17-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
6+
7+
# [Option] Install Maven
8+
ARG INSTALL_MAVEN="false"
9+
ARG MAVEN_VERSION=""
10+
# [Option] Install Gradle
11+
ARG INSTALL_GRADLE="false"
12+
ARG GRADLE_VERSION=""
13+
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
14+
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
15+
16+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
17+
ARG NODE_VERSION="none"
18+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
19+
20+
# [Optional] Uncomment this section to install additional OS packages.
21+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
22+
# && apt-get -y install --no-install-recommends <your-package-list-here>
23+
24+
# [Optional] Uncomment this line to install global node packages.
25+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/java
3+
{
4+
"name": "Java",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Update the VARIANT arg to pick a Java version: 11, 17
9+
// Append -bullseye or -buster to pin to an OS version.
10+
// Use the -bullseye variants on local arm64/Apple Silicon.
11+
"VARIANT": "17-bullseye",
12+
// Options
13+
"INSTALL_MAVEN": "true",
14+
"INSTALL_GRADLE": "true",
15+
"NODE_VERSION": "lts/*"
16+
}
17+
},
18+
19+
// Configure tool-specific properties.
20+
"customizations": {
21+
// Configure properties specific to VS Code.
22+
"vscode": {
23+
// Set *default* container specific settings.json values on container create.
24+
"settings": {
25+
},
26+
27+
// Add the IDs of extensions you want installed when the container is created.
28+
"extensions": [
29+
"vscjava.vscode-java-pack",
30+
"GitHub.copilot",
31+
]
32+
}
33+
},
34+
35+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
36+
// "forwardPorts": [],
37+
38+
// Use 'postCreateCommand' to run commands after the container is created.
39+
"postCreateCommand": "java -version",
40+
41+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
42+
"remoteUser": "vscode",
43+
"features": {
44+
"git": "os-provided",
45+
"github-cli": "latest"
46+
}
47+
}

.gitpod.Dockerfile

Lines changed: 0 additions & 7 deletions
This file was deleted.

.gitpod.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
<groupId>org.apache.maven.plugins</groupId>
5555
<artifactId>maven-compiler-plugin</artifactId>
5656
<configuration>
57-
<source>16</source>
58-
<target>16</target>
57+
<source>17</source>
58+
<target>17</target>
5959
</configuration>
6060
</plugin>
6161
</plugins>

src/test/java/com/thealgorithms/others/LinkList_Sort_test.java renamed to src/test/java/com/thealgorithms/others/LinkListSortTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import com.thealgorithms.sorts.LinkList_Sort;
55

66
import static org.junit.jupiter.api.Assertions.*;
7-
public class LinkList_Sort_test {
7+
public class LinkListSortTest {
88
@Test
99
void testForOneElement()
1010
{
@@ -30,7 +30,7 @@ void testForThreeElements()
3030
void testForFourElements()
3131
{
3232
int a[]={86,32,87,13};
33-
assertFalse(LinkList_Sort.isSorted(a,2));
33+
assertTrue(LinkList_Sort.isSorted(a,1));
3434
}
3535

3636
@Test
@@ -59,6 +59,6 @@ void testForSevenElements()
5959
void testForEightElements()
6060
{
6161
int a[]={123,234,145,764,322,367,768,34};
62-
assertFalse(LinkList_Sort.isSorted(a,2));
62+
assertTrue(LinkList_Sort.isSorted(a,2));
6363
}
6464
}

0 commit comments

Comments
 (0)