Skip to content

Commit

Permalink
- Version 0.7.1
Browse files Browse the repository at this point in the history
- Fix usage of `replArgs` that were broken after last refactor
- Re-enable automatic doc-site publishing
- Remove now-unused `tested` aggregate-project, since `integration` tests need to be split out for perf/stability reasons
- Make CI run `published/test:compile` in `executable` build to try and catch more issues
  • Loading branch information
Li Haoyi committed Aug 17, 2016
1 parent 7608d6f commit 375cf39
Show file tree
Hide file tree
Showing 12 changed files with 196 additions and 105 deletions.
5 changes: 3 additions & 2 deletions amm/repl/src/main/scala/ammonite/repl/ApiImpls.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class ReplApiImpl(val interp: Interpreter,
prompt0: Ref[String],
frontEnd0: Ref[FrontEnd],
history0: => History,
sess0: Session) extends DefaultReplAPI{
sess0: Session,
replArgs0: Seq[Bind[_]]) extends DefaultReplAPI{
import interp._

def lastException = interp.lastException
Expand Down Expand Up @@ -120,7 +121,7 @@ class ReplApiImpl(val interp: Interpreter,


def width = width0

def replArgs = replArgs0.toVector
def height = height0

object sess extends Session {
Expand Down
4 changes: 3 additions & 1 deletion amm/repl/src/main/scala/ammonite/repl/Repl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ class Repl(input: InputStream,
prompt,
frontEnd,
history,
new SessionApiImpl(i.eval)
new SessionApiImpl(i.eval),
replArgs

)
Seq(("ammonite.repl.ReplBridge", "repl", replApi))
},
Expand Down
1 change: 1 addition & 0 deletions amm/repl/src/main/scala/ammonite/repl/ReplAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ abstract class FullReplAPI extends ReplAPI{
}
def typeOf[T: WeakTypeTag] = scala.reflect.runtime.universe.weakTypeOf[T]
def typeOf[T: WeakTypeTag](t: => T) = scala.reflect.runtime.universe.weakTypeOf[T]
def replArgs: Vector[Bind[_]]
}


Expand Down
3 changes: 2 additions & 1 deletion amm/src/main/scala/ammonite/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ case class Main(predef: String = "",
Ref(null),
Ref(null),
new History(Vector.empty),
new SessionApiImpl(i.eval)
new SessionApiImpl(i.eval),
Vector()
)
Seq(("ammonite.repl.ReplBridge", "repl", replApi))
},
Expand Down
4 changes: 0 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ lazy val readme = ScalatexReadme(
(unmanagedSources in Compile) += baseDirectory.value/".."/"project"/"Constants.scala"
)

lazy val tested = project
.in(file("target/tested"))
.aggregate(published, integration)
.settings(dontPublishSettings)

lazy val published = project
.in(file("target/published"))
Expand Down
4 changes: 3 additions & 1 deletion ci/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def executable() = {
}else{
println("MISC COMMIT: generating executable but not publishing")
for (version <- latestVersions) {
%sbt("++" + version, "published/test:compile")
%sbt("++" + version, "integration/test:compile")
%sbt("++" + version, "amm/test:assembly")
}
}
Expand All @@ -161,7 +163,7 @@ def executable() = {
def docs() = {
// Disable doc auto-publishing for now, as the recent modularization means we
// need to make significant changes to the readme and that'll time.
if (false && isMasterCommit){
if (isMasterCommit){
println("MASTER COMMIT: Updating version and publishing to Github Pages")

publishDocs()
Expand Down
2 changes: 1 addition & 1 deletion project/Constants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ object Constants{
val version = "version-SNAPSHOT"
val unstableVersion = "unstableVersion-SNAPSHOT"
val curlUrl = "<curlUrl-set-me-in-Constants.scala>"
val unstableCurlUrl = "unstableCurlUrl-set-me-in-Constants.scala>"
val unstableCurlUrl = "<unstableCurlUrl-set-me-in-Constants.scala>"
}
37 changes: 25 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For more detailed information, check out the internals documentation for high-le
Although most features should be unit tested, it's still useful to fire up a REPL from the current codebase to see things work (or not). There are a variety of shells you can spin up for testing different things:

- `sbt ~terminal/test:run` is useful for manual testing the terminal interaction; it basically contains a minimal echo-anything terminal, with multiline input based on the count of open- and closed-parentheses. This lets you test all terminal interactions without all the complexity of the Scala compiler, classloaders, etc. that comes in `repl/`
- `sbt ~amm/test:run` brings up the Ammonite-REPL using the source code in the repository, and automatically restarts it on-exit if you have made a change to the code. Useful for manual testing both of `amm/` as well as `ops/`, since you can just `import ammonite.ops._` and start using them. Note that this does not bring in filesystem utilities like the `wd` variable, `cd!` command. You can also pass in the path to a `.scala` file to run it using Ammonite's script runner
- `sbt ~amm/test:run` brings up the Ammonite-REPL using the source code in the repository, and automatically restarts it on-exit if you have made a change to the code. Useful for manual testing both of `amm/` as well as `ops/`, since you can just `import ammonite.ops._` and start using them. Note that this does not bring in filesystem utilities like the `wd` variable, `cd!` command. You can also pass in the path to a `.sc` file to run it using Ammonite's script runner
- `sbt ~shell/test:run` brings up a fully-loaded shell with all filesystem utilities included: `wd`, `cd!`, autocomplete for filesystem paths, and more. This uses `readme/resources/example-predef.scala` instead of your default predef, for easier experimentation and development.
- `sbt ~integration/test:run` runs the trivial main method in the `integration` subproject, letting you manually test running Ammonite programmatically, whether through `run` or `debug`
- `sbt ~integration/test:console` brings up a console in the `integration` subproject, loading Ammonite-REPL as a test console, as described in the readme. Similar to `integration/test:run` but useful for verifying the different classloader/execution environment we get by starting Ammonite inside the Scala REPL doesn't break things
Expand All @@ -62,17 +62,30 @@ While working on a arbitrary `xyz` subproject, `sbt ~xyz/test` runs tests after

### Publishing

- `git clean -xdf` to make sure you're building from a clean project
- Update the `project/Constants.scala` version number to the new version
- `sbt ++2.11.8 amm/assembly ++2.10.5 amm/assembly` to bundle the REPL as a standalone distribution
- `sbt +published/publishLocal` or `sbt +published/publishSigned` is used for publishing.
- Create a new release on https://github.com/lihaoyi/Ammonite/releases and upload the two executables for 2.11.8 and 2.10.5, as well as the `shell/src/main/resources/amm/shell/example-predef.scala` file.
- Create short URLs for the 2.11.8 executable download and the `example-predef.scala` file and fix the readme code in `readme/Sample.scala` to use these short URLs
- `sbt ~readme/run` builds the documentation inside its target folder, which you can view by opening `readme/target/scalatex/index.html` in your browser.
- `git commit -am $VERSION` with the new version number, and `git tag $VERSION`
- `git checkout gh-pages && cp -r readme/target/scalatex/* . && git add -A && git commit -am . && git push` will deploy the generated documentation to Github Pages
- Swap `project/Constants.scala` to `$NEXT_VERSION-SNAPSHOT` and commit it
- Wait 30 minutes for things to and run through the curl-download flow and make sure it works
- Publishing is automatic, controlled by scripts in the @code{ci/} folder.

- Every commit that lands in master will publish a new
[unstable version](http://www.lihaoyi.com/Ammonite/#UnstableVersions),
that you can already use and download. This includes publishing the unstable version
to maven central to the
[snapshot-commit-uploads](https://github.com/lihaoyi/Ammonite/releases/tag/snapshot-commit-uploads)
tag, and updating the documentation-site so it's
[Unstable Version](http://www.lihaoyi.com/Ammonite/#UnstableVersions) download
instructions to point to it, though the "main" download/install instructions
in the doc-site will not be changed.

- Every commit that lands in master *with a tag* will re-publish a stable version
to maven central and upload a new versioned release (using the tag as the
version) and the doc-site is updated so the main download/install instructions
point at the new published stable version.

In general, if you land a change in master, once CI completes (1-2hrs) you
should be able to download it via the
[Unstable Version](http://www.lihaoyi.com/Ammonite/#UnstableVersions)
instructions and make use of your changes standalone or in an SBT project.

Occassionally, the CI job building and publishing one of the above steps
flakes and fails, and needs to be re-run through the travis web interface.

## Issue Tags

Expand Down
96 changes: 51 additions & 45 deletions readme/Footer.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,56 @@
to use these projects, the Scaladoc is still useful as a reference.

@sect{Changelog}
@sect{0.7.1}
@ul

@li
Hygienified the default namespace by avoiding importing all the
@sect.ref{Repl API} functions into local scope, instead leaving them
inside the @code{repl} object. @b{This is a backwards incompatible
change!}
@li
Separated the APIs available from scripts (@code{load.*} and
@code{resolvers} in the @code{interp} object)
from those available from the REPL (in the @code{repl} object).
@code{repl} is not available when running scripts, unless you pass in
the @code{--repl-api} flag at the command line.
@li
If you want to maintain the old behavior, e.g. for backwards-compat,
put a @hl.scala{import repl._} in your @code{~/.ammonite/predef.sc} and
@hl.scala{import interp._} in your @code{~/.ammonite/predefShared.s} to
bring everything back into scope again.
@li
@code{predef.sc} now only applies to the interactive REPL. If you
want predef code that applies to scripts use @code{predefScript.sc},
or if you want predef code that applies to both you can use
@code{predefShared.sc}.
@li
Added a version of @sect.ref{desugar} to Scala 2.10.x. It doesn't
print things as prettily/accurately as the 2.11.x version, but it's
better than nothing.
@li
Changed the syntax for @hl.scala{import $file} segments outside your
current directory from @hl.scala{import $file.`..`.foo} to
@hl.scala{import $file.^.foo}. This makes it a lot shorter and
mitigates a problems caused by the file-name being too long.
@li
You can now use a @code{JAVA_OPTS} environment variable to pass flags
to the JVM when starting Ammonite, thanks to @lnk("Simon Scarduzio",
"https://github.com/sscarduzio")
@li
Running scripts outside the current working directory tree, as well as
scripts with non-alphanumeric symbols in their file path, now works
thanks to @lnk("coderabhishek", "https://github.com/coderabhishek")
@li
Scripts without the @code{.sc} can now be run directly from the command line
rather than throwing an @code{IndexOutOfBoundsException}.
@li
Modularized Ammonite's internals; the main module @code{ammonite} has now
been broken into 5 smaller modules for maintainability. This in
itself should not be visible to the outside world, but be sure to
report any bugs!

@sect{0.7.0}
@ul
@li
Expand Down Expand Up @@ -159,7 +209,7 @@
Fixed #400: load.exec in predef.scala causes NPE in 0.5.9 or 0.6.0
@li
Fixed #398: by default, using Ammonite inside a SBT project uses the
old `~/.ammonite/` storage folder, not the `InMemory` storage system.
old @code{~/.ammonite/} storage folder, not the @code{InMemory} storage system.
This restores the pre-0.5.9 behavior
@li
Fix regression causing BACKSPACE to not work while performing a
Expand Down Expand Up @@ -804,47 +854,3 @@

@sect{Unstable Changlog}
@ul
@li
You can now use a @code{JAVA_OPTS} environment variable to pass flags
to the JVM when starting Ammonite, thanks to @lnk("Simon Scarduzio",
"https://github.com/sscarduzio")
@li
Running scripts outside the current working directory tree, as well as
scripts with non-alphanumeric symbols in their file path, now works
thanks to @lnk("coderabhishek", "https://github.com/coderabhishek")
@li
Scripts without the `.sc` can now be run directly from the command line
rather than throwing an `IndexOutOfBoundsException`.
@li
Modularized Ammonite's internals; the main module `ammonite` has now
been broken into 5 smaller modules for maintainability. This in
itself should not be visible to the outside world, but be sure to
report any bugs!
@li
Hygienified the default namespace by avoiding importing all the
@sect.ref{Repl API} functions into local scope, instead leaving them
inside the @code{repl} object.
@li
Separated the APIs available from scripts (@code{load.*} and
@code{resolvers} in the @code{interp} object)
from those available from the REPL (in the @code{repl} object).
@code{repl} is not available when running scripts, unless you pass in
the @code{--repl-api} flag at the command line.
@li
If you want to maintain the old behavior, e.g. for backwards-compat,
use @hl.scala{import interp._, repl._} to bring everything into scope
again.
@li
@code{predef.sc} now only applies to the interactive REPL. If you
want predef code that applies to scripts use @code{predefScript.sc},
or if you want predef code that applies to both you can use
@code{predefShared.sc}.
@li
Added a version of @sect.ref{desugar} to Scala 2.10.x. It doesn't
print things as prettily/accurately as the 2.11.x version, but it's
better than nothing.
@li
Changed the syntax for @hl.scala{import $file} segments outside your
current directory from @hl.scala{import $file.`..`.foo} to
@hl.scala{import $file.^.foo}. This makes it a lot shorter and
mitigates a problems caused by the file-name being too long.
2 changes: 1 addition & 1 deletion readme/Ops.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
@hl.ref(opsExamples, Seq("constructingPaths", "//"), "}")

@p
Note that there are no in-built operations to change the `cwd`. In general you should not need to: simply defining a new path, e.g.
Note that there are no in-built operations to change the @code{cwd}. In general you should not need to: simply defining a new path, e.g.

@hl.ref(opsExamples, Seq("newPath", "val"), "}")

Expand Down
20 changes: 18 additions & 2 deletions readme/Repl.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@

@p
All of these are also available as part of the @hl.scala{repl} object
which is imported in scope by default.
which is imported in scope by default. This is in addition to the
functionality available under the @code{interp} object, which is also
available in scripts:

@hl.ref('amm/'runtime/'src/'main/'scala/'ammonite/'runtime/"InterpAPI.scala", "trait InterpAPI")

@sect{Utilities}
@p
Expand Down Expand Up @@ -769,6 +773,18 @@
If you want these changes to always be present, place them in your
@code{~/.ammonite/predef.scala}.

@sect{JVM Flags}
@p
Ammonite also supports the @code{JAVA_OPTS} environment variable for
passing arguments to the JVM that it runs inside, e.g. you can pass in
a custom memory limit via

@hl.scala
bash$ JAVA_OPTS="-Xmx1024m" amm

@p
To start the REPL while letting it use only up to 1024 megabytes of memory

@sect{Embedding}
@p
The Ammonite REPL is just a plain-old-Scala-object, just like any other
Expand All @@ -789,7 +805,7 @@
@p
Then instantate it with this code anywhere within your program:

@hl.ref('amm/'src/'test/'scala/'ammonite/"TestMain.scala")
@hl.ref('integration/'src/'test/'scala/'ammonite/'integration/"TestMain.scala")

@p
You can configure the instantiated REPL by passing in arguments to the
Expand Down
Loading

0 comments on commit 375cf39

Please sign in to comment.