Permalink
Browse files

Update DEVELOPMENT.md

  • Loading branch information...
alexarchambault committed Nov 7, 2018
1 parent 84727d8 commit b03b602e8cbbad9e17262f78e91114885627c0ee
Showing with 11 additions and 67 deletions.
  1. +11 −67 doc/DEVELOPMENT.md
View
@@ -1,15 +1,5 @@
# Cookbook of stuff to do while developing on coursier
General note: always explicitly set the scala version at the sbt prompt, like
```
> ++2.12.4
> ++2.11.11
> ++2.10.6
```
Some modules of coursier are only built in specific scala versions (sbt plugins in 2.10 and 2.12, cli and web modules in 2.11, …). coursier doesn't use sbt-doge
to handle that for now (but any help to make it work would be welcome).
The sources of coursier rely on some git submodules. Clone the sources of coursier via
```
$ git clone --recursive https://github.com/coursier/coursier.git
@@ -25,53 +15,20 @@ The latter command also needs to be run whenever these submodules are updated.
## Compile and run the CLI
```
$ sbt ++2.11.11 "project cli" pack
$ sbt cli/pack
$ cli/target/pack/bin/coursier --help
$ modules/cli/target/pack/bin/coursier --help
```
Note: `sbt ++2.11.11 cli/pack` used to work fine, but doesn't anymore, see
https://github.com/coursier/coursier/commit/3636c58d07532ab2dc176f2d2caa2b4d51050f12.
## Automatically re-compile the CLI
Doesn't work anymore :/ `sbt ++2.11.11 ~cli/pack` used to work, but doesn't
anymore for now (see above). `sbt ++2.11.11 "project cli" ~pack` only watches
the sources of the cli module, not those of the modules it depends on (core,
cache, …).
## Run a scripted test of sbt-coursier or sbt-shading
```
$ sbt
> ++2.12.4
> sbt-plugins/publishLocal
> sbt-coursier/scripted sbt-coursier/simple
> sbt-shading/scripted sbt-shading/shading
```
`++2.12.4` sets the scala version, which automatically builds the plugins for sbt 1.0. For sbt 0.13, do `++2.10.6`.
`sbt-plugins/publishLocal` publishes locally the plugins *and their dependencies*, which scripted seems not to do automatically.
## Run all the scripted tests of sbt-coursier or sbt-shading
```
$ sbt
> ++2.12.4
> sbt-plugins/publishLocal
> sbt-coursier/scripted
> sbt-shading/scripted
```
Use `++2.10.6` for sbt 0.13. See discussion above too.
`sbt "~cli/pack"` watches the sources, and re-generates `modules/cli/target/pack` accordingly.
## Run unit tests (JVM)
```
$ sbt
> ++2.12.4
> testsJVM/testOnly coursier.util.TreeTests
> testsJVM/test
```
@@ -83,7 +40,6 @@ To run the tests each time the sources change, prefix the test commands with
`~`, like
```
$ sbt
> ++2.12.4
> ~testsJVM/testOnly coursier.util.TreeTests
> ~testsJVM/test
```
@@ -95,7 +51,6 @@ The JS tests require node to be installed. They automatically run `npm install`
JS tests can be run like JVM tests, like
```
$ sbt
> ++2.12.4
> testsJS/testOnly coursier.util.TreeTests
> testsJS/test
```
@@ -106,32 +61,19 @@ Like for the JVM tests, prefix test commands with `~` to watch sources (see abov
### Main tests
Run the small web repositories with:
```
$ scripts/launch-test-repo.sh --port 8080 --list-pages
$ scripts/launch-test-repo.sh --port 8081
```
Both of these commands spawn a web server in the background.
Run the main ITs with
Run the main integration tests with
```
$ sbt ++2.12.4 testsJVM/it:test
$ sbt testsJVM/it:test
```
### Nexus proxy tests
Start the test Nexus servers with
Run the proxy integration tests with
```
$ scripts/launch-proxies.sh
$ sbt proxy-tests/it:test
```
This spawns two docker-based Nexus servers in the background (a Nexus 2 and a Nexus 3).
Then run the proxy ITs with
```
$ sbt ++2.12.4 proxy-tests/it:test
```
Note that these tests automatically spawn, then stop, docker containers running Sonatype Nexus servers.
### Build with Pants
@@ -142,11 +84,13 @@ Currently only the CLI command can be built via Pants with Scala 2.12.4.
To iterate on code changes:
```
cd modules
./pants run cli/src/main/scala-2.12:coursier-cli -- fetch --help
```
To build a distributable binary
```
cd modules
./pants binary cli/src/main/scala-2.12:coursier-cli
# Artifact will be placed under dist/
@@ -162,7 +106,7 @@ Its sources are in the `web` module.
To build and test this demo site locally, you can do
```
$ sbt web/fastOptJS
$ open web/target/scala-2.12/classes/index.html
$ open modules/web/target/scala-2.12/classes/index.html
```
(on Linux, use `xdg-open` instead of `open`)

0 comments on commit b03b602

Please sign in to comment.