Skip to content

Add IDE and containerization support files to new projects #20

Description

@trumpyla

Summary

New projects created with repo_setup.sh should include optional IDE configuration files and Docker support to improve developer experience and enable containerized development/deployment.

Scope

Add optional IDE configurations and Docker support files to new projects based on project type and user preferences.

Required Files

IDE Support

1. .vscode/ (VS Code workspace)

Files to create:

  • .vscode/settings.json - Workspace settings (formatters, linters, extensions)
  • .vscode/extensions.json - Recommended extensions
  • .vscode/launch.json - Debug configurations
  • .vscode/tasks.json - Build tasks

Language-specific settings:

Java:

{
  "java.configuration.updateBuildConfiguration": "automatic",
  "java.compile.nullAnalysis.mode": "automatic",
  "java.format.settings.url": ".editorconfig",
  "maven.view": "hierarchical",
  "java.debug.settings.hotCodeReplace": "auto"
}

C/C++:

{
  "C_Cpp.default.compilerPath": "/usr/bin/gcc",
  "C_Cpp.default.cppStandard": "c++20",
  "C_Cpp.default.intelliSenseMode": "gcc-x64",
  "cmake.configureOnOpen": true
}

Rust:

{
  "rust-analyzer.checkOnSave.command": "clippy",
  "rust-analyzer.cargo.features": "all",
  "rust-analyzer.inlayHints.parameterHints.enable": true
}

Recommended extensions:

  • Java: vscjava.vscode-java-pack, vscjava.vscode-maven
  • C/C++: ms-vscode.cpptools, ms-vscode.cmake-tools, llvm-vs-code-extensions.vscode-clangd
  • Rust: rust-lang.rust-analyzer, vadimcn.vscode-lldb
  • All: editorconfig.editorconfig, ms-vscode.makefile-tools

2. .idea/ (IntelliJ IDEA / CLion / RustRover)

Files to create:

  • .idea/codeStyles/Project.xml - Code style settings
  • .idea/inspectionProfiles/Project_Default.xml - Code inspections
  • .idea/runConfigurations/ - Run/debug configurations
  • .idea/vcs.xml - VCS settings

Important: Most .idea/ files should be in .gitignore except:

  • Code styles
  • Inspection profiles
  • Shared run configurations
  • Copyright profiles

Language-specific:

  • Java: Maven/Gradle integration, JDK settings
  • C/C++: CMake/Bazel toolchain settings
  • Rust: Cargo integration, clippy settings

Containerization Support

3. Dockerfile (language-specific)

Java (Maven) example:

# Build stage
FROM maven:3.9-eclipse-temurin-21 AS build
WORKDIR /app
COPY pom.xml .
COPY src ./src
RUN mvn clean package -DskipTests

# Runtime stage
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]

C/C++ (CMake) example:

FROM gcc:13 AS build
WORKDIR /app
COPY . .
RUN cmake -B build -DCMAKE_BUILD_TYPE=Release && \
    cmake --build build --parallel

FROM debian:bookworm-slim
WORKDIR /app
COPY --from=build /app/build/bin/* .
CMD ["./app"]

Rust example:

FROM rust:1.75 AS build
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY src ./src
RUN cargo build --release

FROM debian:bookworm-slim
WORKDIR /app
COPY --from=build /app/target/release/app .
CMD ["./app"]

4. .dockerignore

Generic template:

# Version control
.git
.gitignore
.github

# Build artifacts
target/
build/
dist/
*.o
*.a
*.so

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Documentation
*.md
docs/
LICENSE

# Tests
tests/
test/
*.test

5. docker-compose.yml (optional)

For projects with multiple services or dependencies:

version: '3.9'

services:
  app:
    build: .
    ports:
      - "8080:8080"
    environment:
      - LOG_LEVEL=info
    volumes:
      - ./data:/app/data
    depends_on:
      - db
  
  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_PASSWORD: example
    volumes:
      - db-data:/var/lib/postgresql/data

volumes:
  db-data:

Implementation Approach

Phase 1: Create Template Files

# Directory structure
templates/
├── .github/           # (from issue #19)
├── .vscode/
│   ├── settings.json.java
│   ├── settings.json.cpp
│   ├── settings.json.c
│   ├── settings.json.rust
│   ├── extensions.json.java
│   ├── extensions.json.cpp
│   ├── extensions.json.rust
│   └── launch.json.{lang}
├── .idea/
│   └── codeStyles/
│       └── Project.xml
├── docker/
│   ├── Dockerfile.java
│   ├── Dockerfile.cpp
│   ├── Dockerfile.c
│   ├── Dockerfile.rust
│   ├── .dockerignore.template
│   └── docker-compose.yml.template

Phase 2: Update repo_setup.sh

Add flags and setup function:

# New flags
WITH_VSCODE="false"
WITH_IDEA="false"
WITH_DOCKER="false"

# Parse new options
--with-vscode)      WITH_VSCODE="true" ;;
--with-idea)        WITH_IDEA="true" ;;
--with-docker)      WITH_DOCKER="true" ;;

# New function
setup_dev_environment() {
    local project_type="$1"
    
    # VS Code
    if [[ "$WITH_VSCODE" == "true" ]]; then
        info "Setting up VS Code workspace"
        mkdir -p .vscode
        
        # Copy language-specific settings
        if [[ -f ".common/artagon-common/templates/.vscode/settings.json.$project_type" ]]; then
            cp ".common/artagon-common/templates/.vscode/settings.json.$project_type" \
                .vscode/settings.json
        fi
        
        if [[ -f ".common/artagon-common/templates/.vscode/extensions.json.$project_type" ]]; then
            cp ".common/artagon-common/templates/.vscode/extensions.json.$project_type" \
                .vscode/extensions.json
        fi
        
        success "VS Code workspace configured"
    fi
    
    # IntelliJ IDEA
    if [[ "$WITH_IDEA" == "true" ]]; then
        info "Setting up IntelliJ IDEA project"
        mkdir -p .idea/codeStyles
        
        cp .common/artagon-common/templates/.idea/codeStyles/Project.xml \
            .idea/codeStyles/Project.xml
        
        success "IntelliJ IDEA project configured"
    fi
    
    # Docker
    if [[ "$WITH_DOCKER" == "true" ]]; then
        info "Setting up Docker support"
        
        # Copy Dockerfile
        if [[ -f ".common/artagon-common/templates/docker/Dockerfile.$project_type" ]]; then
            cp ".common/artagon-common/templates/docker/Dockerfile.$project_type" Dockerfile
        fi
        
        # Copy .dockerignore
        cp .common/artagon-common/templates/docker/.dockerignore.template .dockerignore
        
        # Optional: docker-compose.yml
        if [[ -f ".common/artagon-common/templates/docker/docker-compose.yml.template" ]]; then
            cp ".common/artagon-common/templates/docker/docker-compose.yml.template" \
                docker-compose.yml
        fi
        
        success "Docker support configured"
    fi
}

Phase 3: Update .gitignore

Ensure IDE-specific files are properly ignored (keep only shared configs):

# VS Code (keep only workspace settings we want shared)
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/tasks.json

# IntelliJ IDEA (keep only shared configs)
.idea/*
!.idea/codeStyles/
!.idea/inspectionProfiles/
!.idea/runConfigurations/
!.idea/vcs.xml

Testing Requirements

Integration tests must verify:

  1. ✅ VS Code settings created for correct language
  2. ✅ IntelliJ IDEA configs created when requested
  3. ✅ Dockerfile matches project type
  4. ✅ .dockerignore excludes appropriate files
  5. ✅ Files are valid JSON/YAML
  6. ✅ Docker builds successfully (if possible)

Add test suite: tests/integration/test_dev_environment.sh

Documentation Updates

  • README.md - Document new flags: --with-vscode, --with-idea, --with-docker
  • docs/CONTRIBUTING.md - Explain IDE setup for contributors
  • scripts/repo_setup.sh help text - Document new options
  • Create docs/IDE-SETUP.md - Detailed IDE configuration guide
  • Create docs/DOCKER.md - Docker usage guide

Benefits

  1. Developer Experience: Ready-to-use IDE configurations
  2. Consistency: Same settings across team members
  3. Onboarding: New developers can start immediately
  4. Containerization: Easy deployment and testing
  5. CI/CD: Docker images for build/test/deploy pipelines

Usage Examples

# Java project with VS Code and Docker
./scripts/repo_setup.sh --type java --name my-api \
    --with-vscode --with-docker

# C++ project with CLion (IntelliJ) support
./scripts/repo_setup.sh --type cpp --name my-engine \
    --with-idea --with-docker

# Rust project with all IDE support
./scripts/repo_setup.sh --type rust --name my-tool \
    --with-vscode --with-idea --with-docker

Acceptance Criteria

  • Template files created for all supported languages
  • VS Code settings templates for Java, C, C++, Rust
  • IntelliJ IDEA code style templates
  • Dockerfile templates for each language
  • .dockerignore template created
  • repo_setup.sh flags added: --with-vscode, --with-idea, --with-docker
  • Integration tests verify all file creation
  • Documentation updated (README, IDE-SETUP.md, DOCKER.md)
  • .gitignore updated to handle IDE files correctly
  • Tested with all project types

Related Issues

Notes

  • IDE configs are optional (not enabled by default) to avoid forcing specific IDEs
  • Docker support should include multi-stage builds for smaller images
  • Consider adding .devcontainer/devcontainer.json for VS Code Remote Containers
  • IntelliJ IDEA configs should be minimal (most settings are user-specific)
  • VS Code settings should reference .editorconfig where possible

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions