Skip to content

windows 10, intellij idea community and cygwin

nick n edited this page May 8, 2019 · 1 revision

windows 10, intellij idea community and cygwin

the goal of this document is NOT to make netdisco work under windows

it is however a starting point for those wanting to develop under windows.

things that work

  • git and github support

  • perl syntax checking

  • template toolkit syntax checking

  • sql (postgresql specific) syntax checking

  • building

    • Build.PL

    • Build

    • Build install (installs in cygwin environment)

    • Build distclean

    • Build distcheck

    • Build makemeta

    • Build manifest

    • Build test (mostly)

  • code analysis

  • local::lib

things that don’t work

  • building

    • Build test (for some modules)

  • everything that uses #/usr/bin/env perl

  • some mro based modules

  • perl critic support (should work, most likely local config)

  • the perl module does not yet support all perl syntax variations, in particular it will think dancer exported functions are not defined.

Introduction

Netdisco is not supported on windows. several features will not work due to no underlying support from several perl modules (Net::OpenSSH & IO::Socket::SSL both have issues).

That being said, we can set up a working dev environment based on cygwin & the intellij idea community edition ide.

wsl is also possible but this requires the ultimate edition of intellij idea. see here: https://github.com/netdisco/netdisco/wiki/windows-10,-intellij-idea-ultimate-and-wsl

strawberry won’t work since it fails to build some modules.

activestate perl might work, but hasn’t been tested.

for now the rancid plugin is a simple project to experiment with (also has working tests) https://github.com/netdisco/nd2-web-plugin-rancid/

Requirements

cygwin

cygwin setup

first go through the basic setup to get cygwin running, this won’t be detailed in this document. we will use the default c:\cygwin64 directory for this example.

then run the setup program again and make sure the following packages are installed:

  • curl

  • gcc-g++

  • make

  • net-snmp-gui

  • net-snmp-utils

  • openssh

  • perl-DBI

  • perl-IO-Socket-SSL

  • perl-IO-Tty

  • perl-MRO-Compat

  • perl-Module-Build

  • postgresql

  • postgresql-client

  • postgresql-contrib

  • postgresql-devel

  • zlib-devel

netdisco install under cygwin

install netdisco and it’s dependencies on the system, under your own user.

curl -L https://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco
mkdir ~/bin
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/

additional perl modules in cywin

more perl modules will be needed, which we’ll install via cpanm in a cygwin shell.

localenv cpanm -n Test::Perl::Critic Test::Distribution
localenv cpanm -n Data::Printer
localenv cpanm -n PPI Class::ISA Module::Info Module::Load
localenv cpanm -n Env::Path Test::Compile Test::More Test::Class::Most Test::MockObject::Extends
localenv cpanm -n Bundle::Camelcade

camelcade is specific for intellij idea’s perl support.

intellij idea

installation

this is just running through the setup tools.

required plugins

perl5 support is provided through the Camelcade Perl5-IDEA project. you will need to install the following plugins through the plugin manager:

  • Perl (Version 2019.1.2 or higher)

  • Template Toolkit Support (Version 2019.1.2 or higher)

  • Database Navigator (Version 3.1.1432.0 or higher)

  • MIB support (not required, only for working with mibs)

setting up perl support

in the intellij settings menu, go to:

  • languages & frameworks

    • perl5

add a new perl5 interpreter as system perl. select c:\cygwin64\bin\perl.exe.

this should show up as "Local, System: Perl 5.26.3 for x86_64-cygwin-threads-multi".

then add the following external libraries:

  • C:\cygwin64\home_yourusername_\perl5\

  • C:\cygwin64\lib\perl5\

  • C:\cygwin64\usr\share\perl5

setting up a project

finally create a new project by checking out netdisco or snmp-info from git.

build tasks & pipelines can be defined here. you will need to include your local perl installation into each build task using the following as perl5 parameter: -I/home/yourusername/perl5/lib/perl5 -Mlocal::lib