mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-05 08:17:33 +08:00
Add Devcontainer Support (#3156)
Co-authored-by: Arindam Paul <arindam.paul.1989@gmail.com> Co-authored-by: Andrii Siriak <siryaka@gmail.com>
This commit is contained in:
25
.devcontainer/Dockerfile
Normal file
25
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/java/.devcontainer/base.Dockerfile
|
||||||
|
|
||||||
|
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
|
||||||
|
ARG VARIANT="17-bullseye"
|
||||||
|
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
|
||||||
|
|
||||||
|
# [Option] Install Maven
|
||||||
|
ARG INSTALL_MAVEN="false"
|
||||||
|
ARG MAVEN_VERSION=""
|
||||||
|
# [Option] Install Gradle
|
||||||
|
ARG INSTALL_GRADLE="false"
|
||||||
|
ARG GRADLE_VERSION=""
|
||||||
|
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||||
|
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||||
|
|
||||||
|
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
||||||
|
ARG NODE_VERSION="none"
|
||||||
|
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional OS packages.
|
||||||
|
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||||
|
|
||||||
|
# [Optional] Uncomment this line to install global node packages.
|
||||||
|
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
47
.devcontainer/devcontainer.json
Normal file
47
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||||
|
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/java
|
||||||
|
{
|
||||||
|
"name": "Java",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"args": {
|
||||||
|
// Update the VARIANT arg to pick a Java version: 11, 17
|
||||||
|
// Append -bullseye or -buster to pin to an OS version.
|
||||||
|
// Use the -bullseye variants on local arm64/Apple Silicon.
|
||||||
|
"VARIANT": "17-bullseye",
|
||||||
|
// Options
|
||||||
|
"INSTALL_MAVEN": "true",
|
||||||
|
"INSTALL_GRADLE": "true",
|
||||||
|
"NODE_VERSION": "lts/*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
"customizations": {
|
||||||
|
// Configure properties specific to VS Code.
|
||||||
|
"vscode": {
|
||||||
|
// Set *default* container specific settings.json values on container create.
|
||||||
|
"settings": {
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"extensions": [
|
||||||
|
"vscjava.vscode-java-pack",
|
||||||
|
"GitHub.copilot",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
"postCreateCommand": "java -version",
|
||||||
|
|
||||||
|
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"features": {
|
||||||
|
"git": "os-provided",
|
||||||
|
"github-cli": "latest"
|
||||||
|
}
|
||||||
|
}
|
7
.gitpod.Dockerfile
vendored
7
.gitpod.Dockerfile
vendored
@ -1,7 +0,0 @@
|
|||||||
FROM gitpod/workspace-full
|
|
||||||
|
|
||||||
# Install custom tools, runtimes, etc.
|
|
||||||
# For example "bastet", a command-line tetris clone:
|
|
||||||
# RUN brew install bastet
|
|
||||||
#
|
|
||||||
# More information: https://www.gitpod.io/docs/config-docker/
|
|
@ -1,6 +0,0 @@
|
|||||||
image:
|
|
||||||
file: .gitpod.Dockerfile
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- init: 'echo "TODO: Replace with init/build command"'
|
|
||||||
command: (e.g. 'npm start', 'yarn watch'...)
|
|
4
pom.xml
4
pom.xml
@ -54,8 +54,8 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>16</source>
|
<source>17</source>
|
||||||
<target>16</target>
|
<target>17</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
import com.thealgorithms.sorts.LinkList_Sort;
|
import com.thealgorithms.sorts.LinkList_Sort;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
public class LinkList_Sort_test {
|
public class LinkListSortTest {
|
||||||
@Test
|
@Test
|
||||||
void testForOneElement()
|
void testForOneElement()
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ public class LinkList_Sort_test {
|
|||||||
void testForFourElements()
|
void testForFourElements()
|
||||||
{
|
{
|
||||||
int a[]={86,32,87,13};
|
int a[]={86,32,87,13};
|
||||||
assertFalse(LinkList_Sort.isSorted(a,2));
|
assertTrue(LinkList_Sort.isSorted(a,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -59,6 +59,6 @@ public class LinkList_Sort_test {
|
|||||||
void testForEightElements()
|
void testForEightElements()
|
||||||
{
|
{
|
||||||
int a[]={123,234,145,764,322,367,768,34};
|
int a[]={123,234,145,764,322,367,768,34};
|
||||||
assertFalse(LinkList_Sort.isSorted(a,2));
|
assertTrue(LinkList_Sort.isSorted(a,2));
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user