Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Add declarative widgets jar to release #468

Merged
merged 2 commits into from
Jul 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ addons:
hosts:
- declarativewidgets.org

before_install:
openssl aes-256-cbc -K $encrypted_9067f25a9380_key -iv $encrypted_9067f25a9380_iv -in etc/.gpg/secring.gpg.enc -out etc/.gpg/secring.gpg -d

before_script:
- curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
- sh -e /etc/init.d/xvfb start
Expand Down
26 changes: 24 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

.PHONY: help init clean clean-dist clean-watch clean-watch-docs dist sdist docs
.PHONY: dev dev_image dev_image_4.2 _dev _dev-python2 _dev-python3
.PHONY: server server_4.2 remove-server install install-all all release
.PHONY: server server_4.2 remove-server install install-all all release export-release-version publish-scala-jar
.PHONY: start-selenium stop-selenium _run _run-python3 _run-python2 run-test
.PHONY: test testdev test-js test-js-remote test-py test-py-all _test-py
.PHONY: _test-py-python2 _test-py-python3 test-scala test-r
Expand Down Expand Up @@ -199,6 +199,7 @@ else
@docker $(DOCKER_OPTS) run -it --rm \
-v `pwd`:/src \
-v `pwd`/etc/ivy:/root/.ivy2 \
-v `pwd`/etc/sbt_plugin_config:/root/.sbt/0.13/plugins \
$(SCALA_BUILD_REPO) bash -c 'cp -r /src/kernel-scala/* /app/. && \
sbt --warn package && \
cp target/scala-2.10/declarativewidgets*.jar /src/dist/declarativewidgets/static/declarativewidgets.jar && \
Expand Down Expand Up @@ -307,6 +308,7 @@ else
@docker $(DOCKER_OPTS) run -it --rm \
-v `pwd`/kernel-scala:/src \
-v `pwd`/etc/ivy:/root/.ivy2 \
-v `pwd`/etc/sbt_plugin_config:/root/.sbt/0.13/plugins \
$(SCALA_BUILD_REPO) bash -c 'cp -r /src/* /app/. && \
sbt --warn test'
endif
Expand Down Expand Up @@ -481,7 +483,27 @@ docs: .watch-docs dist/docs

all: init test-js-remote test-py-all test-scala test-r sdist install-all system-test

export-release-version:
docker $(DOCKER_OPTS) run -it --rm \
-v `pwd`/dist:/src \
-v `pwd`/etc/read_release_version.py:/src/read_release_version.py \
$(REPO) bash -c 'python /src/read_release_version.py' > `pwd`/dist/RELEASE_VERSION

publish-scala-jar: export-release-version dist/declarativewidgets/static/declarativewidgets.jar
@echo 'Publishing scala jar'
@docker $(DOCKER_OPTS) run -it --rm \
-v `pwd`/kernel-scala:/src \
-v `pwd`/etc/.gpg:/root/.gpg \
-v `pwd`/etc/ivy:/root/.ivy2 \
-v `pwd`/etc/sbt_plugin_config:/root/.sbt/0.13/plugins \
-v `pwd`/dist/RELEASE_VERSION:/src_version/RELEASE_VERSION \
-e REPO_USERNAME=$(REPO_USERNAME) \
-e REPO_PASSWORD=$(REPO_PASSWORD) \
-e PGP_PASSPHRASE=$(PGP_PASSPHRASE) \
$(SCALA_BUILD_REPO) bash -c 'cp -r /src/* /app/. && \
sbt publishSigned && sbt sonatypeRelease'

release: EXTRA_OPTIONS=-e PYPI_USER=$(PYPI_USER) -e PYPI_PASSWORD=$(PYPI_PASSWORD)
release: PRE_SDIST=echo "[server-login]" > ~/.pypirc; echo "username:" ${PYPI_USER} >> ~/.pypirc; echo "password:" ${PYPI_PASSWORD} >> ~/.pypirc;
release: POST_SDIST=register upload
release: sdist
release: sdist publish-scala-jar
Binary file added etc/.gpg/secring.gpg.enc
Binary file not shown.
6 changes: 6 additions & 0 deletions etc/docs/site/usage-docs/Basic-Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ declwidgets.init()
##### Scala Initialization

```
//add the declarative widgets jar/dependency via one of the %addjar or %AddDeps magics

// modify to IP and Port of this notebook server
%addjar http://localhost:8888/nbextensions/declarativewidgets/declarativewidgets.jar

// modify the GroupId, ArtifactId, Latest Version for the applicable release
// release versions can be found on http://search.maven.org/#search|ga|1|g:"org.jupyter"
%AddDeps org.jupyter declarativewidgets_2.10 0.6.1_dev --transitive --trace --verbose

import declarativewidgets._

initWidgets
Expand Down
14 changes: 14 additions & 0 deletions etc/read_release_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import os

# Get location of this file at runtime
HERE = os.path.abspath(os.path.dirname(__file__))

# Eval the version tuple and string from the source
VERSION_NS = {}
with open(os.path.join(HERE, 'urth/widgets/ext/_version.py')) as f:
exec(f.read(), {}, VERSION_NS)
print(VERSION_NS['__version__'])
2 changes: 2 additions & 0 deletions etc/sbt_plugin_config/gpg.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
66 changes: 65 additions & 1 deletion kernel-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

import scala.util.Properties
import scala.io.Source

organization := "org.jupyter"

name := "declarativewidgets"

version := "0.1-SNAPSHOT"
version := {
val releaseVersionPath = "/src_version/RELEASE_VERSION"
if(new java.io.File(releaseVersionPath).exists) {
val src = Source.fromFile(releaseVersionPath)
val version = src.getLines().next()
src.close
val regex = "SNAPSHOT(.*)".r
regex.replaceFirstIn(version, "SNAPSHOT")
} else {
"0.1-SNAPSHOT"
}
}

scalaVersion := "2.10.4"

Expand All @@ -28,3 +45,50 @@ libraryDependencies ++= Seq(
ivyLoggingLevel in ThisBuild := UpdateLogging.Quiet

parallelExecution in Test := false

publishMavenStyle := true

publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}

publishArtifact in Test := false

pomIncludeRepository := { _ => false }

pomExtra := (
<url>https://github.com/jupyter-incubator/declarativewidgets</url>
<licenses>
<license>
<name>BSD-style</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:jupyter-incubator/declarativewidgets.git</url>
<connection>scm:git:git@github.com:jupyter-incubator/declarativewidgets.git</connection>
</scm>
<developers>
<developer>
<id>dwidgets</id>
<name>declarative widgets</name>
<url>https://github.com/jupyter-incubator/declarativewidgets/graphs/contributors</url>
</developer>
</developers>)

val repoUsername = Properties.envOrElse("REPO_USERNAME", "")
val repoPassword = Properties.envOrElse("REPO_PASSWORD", "")

pgpPassphrase := Some(Properties.envOrElse("PGP_PASSPHRASE", "").toCharArray)

pgpSecretRing := file("/root/.gpg/secring.gpg")

credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
repoUsername,
repoPassword)