From 7af15ac6ba87e0b043ec2bbc0ab26bc703b81e51 Mon Sep 17 00:00:00 2001 From: Ivan Porto Carrero Date: Thu, 20 Sep 2012 23:28:50 -0700 Subject: [PATCH] publish snapshot --- .gitignore | 86 +++- build.sbt | 82 ++++ pom.xml => pom.xml.disabled | 6 +- sbt | 441 ++++++++++++++++++ .../scalabeans/BeanIntrospector.scala | 4 +- 5 files changed, 606 insertions(+), 13 deletions(-) create mode 100644 build.sbt rename pom.xml => pom.xml.disabled (97%) create mode 100755 sbt diff --git a/.gitignore b/.gitignore index 59209a8..f08a8f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,78 @@ -/target -/.scala_dependencies -/.classpath -/.settings -/.project -/lib_managed -/bin -/mavenrepo +## generic files to ignore +*~ +*.lock +*.DS_Store +*.swp +*.out + +# rails specific +*.sqlite3 +config/database.yml +log/* +tmp/* + +# java specific +*.class + +# python specific +*.pyc + +# xcode/iphone specific +build/* +*.pbxuser +*.mode2v3 +*.mode1v3 +*.perspective +*.perspectivev3 +*~.nib + +# akka specific +logs/* + +# sbt specific +project/boot +lib_managed/* +project/build/target +project/build/lib_managed +project/build/src_managed +project/plugins/lib_managed +project/plugins/target +project/plugins/src_managed +project/plugins/project + +core/lib_managed +core/target +pubsub/lib_managed +pubsub/target + +# eclipse specific +.metadata +jrebel.lic +.idea/workspace.xml +.idea/bashsupport_project.xml + +*.iml +*.ipr +*.iws + +target +.idea +.settings +.classpath +.project +.ensime* +*.sublime-* +src/main/webapp/js/app.js +src/main/javascript/**/*.js +src/main/javascript/*.js +src/main/javascript/**/*.jsm +src/main/javascript/*.jsm +.cache +src/main/webapp/scripts +src/main/webapp/css +src/main/webapp/img +src/main/webapp/build.txt +src/main/webapp/index.html +node_modules +src/main/webapp/app.html +.#* diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..68c4e1a --- /dev/null +++ b/build.sbt @@ -0,0 +1,82 @@ +import scala.xml.Group + +organization := "org.json4s" + +name := "scalabeans" + +version := "0.3.0-SNAPSHOT" + +scalaVersion := "2.9.2" + +javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation") + +scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8") + +homepage := Some(url("https://github.com/scalastuff/scalabeans")) + +startYear := Some(2010) + +licenses := Seq(("ASL", url("http://www.apache.org/licenses/LICENSE-2.0.txt"))) + +pomExtra <<= (pomExtra, name, description) {(pom, name, desc) => pom ++ Group( + + scm:git:git@github.com:scalastuff/scalabeans.git + https://github.com/scalastuff/scalabeans + + + + rditerwich + Ruud Diterwich + + + advorkovyy + Alexander Dvorkovyy + + + + + Sergey Nazarov + + +)} + +packageOptions <+= (name, version, organization) map { + (title, version, vendor) => + Package.ManifestAttributes( + "Created-By" -> "Simple Build Tool", + "Built-By" -> System.getProperty("user.name"), + "Build-Jdk" -> System.getProperty("java.version"), + "Specification-Title" -> title, + "Specification-Version" -> version, + "Specification-Vendor" -> vendor, + "Implementation-Title" -> title, + "Implementation-Version" -> version, + "Implementation-Vendor-Id" -> vendor, + "Implementation-Vendor" -> vendor + ) + } + +publishMavenStyle := true + +publishTo <<= version { (v: String) => + val nexus = "https://oss.sonatype.org/" + if (v.trim.endsWith("SNAPSHOT")) + Some("snapshots" at nexus + "content/repositories/snapshots") + else + Some("releases" at nexus + "service/local/staging/deploy/maven2") +} + +publishArtifact in Test := false + +pomIncludeRepository := { x => false } + +libraryDependencies ++= Seq( + "com.thoughtworks.paranamer" % "paranamer" % "2.5.1", + "org.codehaus.woodstox" % "woodstox-core-asl" % "4.1.4" % "optional", + "junit" % "junit" % "4.8.2" % "test", + "com.google.guava" % "guava" % "13.0.1", + "com.dyuproject.protostuff" % "protostuff-core" % "1.0.7" % "optional", + "com.dyuproject.protostuff" % "protostuff-api" % "1.0.7" % "optional", + "com.dyuproject.protostuff" % "protostuff-json" % "1.0.7" % "optional", + "com.dyuproject.protostuff" % "protostuff-xml" % "1.0.7" % "optional" +) diff --git a/pom.xml b/pom.xml.disabled similarity index 97% rename from pom.xml rename to pom.xml.disabled index 03ce049..cd5d906 100644 --- a/pom.xml +++ b/pom.xml.disabled @@ -45,9 +45,9 @@ src/test/scala - org.scala-tools - maven-scala-plugin - 2.15.2 + net.alchim31.maven + scala-maven-plugin + 3.1.0 diff --git a/sbt b/sbt new file mode 100755 index 0000000..7fedc73 --- /dev/null +++ b/sbt @@ -0,0 +1,441 @@ +#!/usr/bin/env bash +# +# A more capable sbt runner, coincidentally also called sbt. +# Author: Paul Phillips + +# todo - make this dynamic +declare -r sbt_release_version=0.12.0 +declare -r sbt_snapshot_version=0.13.0-SNAPSHOT + +unset sbt_jar sbt_dir sbt_create sbt_snapshot sbt_launch_dir +unset scala_version java_home sbt_explicit_version +unset verbose debug quiet + +for arg in "$@"; do + case $arg in + -q|-quiet) quiet=1 ;; + *) ;; + esac +done + +build_props_sbt () { + if [[ -f project/build.properties ]]; then + versionLine=$(grep ^sbt.version project/build.properties) + versionString=${versionLine##sbt.version=} + echo "$versionString" + fi +} + +update_build_props_sbt () { + local ver="$1" + local old=$(build_props_sbt) + + if [[ $ver == $old ]]; then + return + elif [[ -f project/build.properties ]]; then + perl -pi -e "s/^sbt\.version=.*\$/sbt.version=${ver}/" project/build.properties + grep -q '^sbt.version=' project/build.properties || echo "sbt.version=${ver}" >> project/build.properties + + echo !!! + echo !!! Updated file project/build.properties setting sbt.version to: $ver + echo !!! Previous value was: $old + echo !!! + fi +} + +sbt_version () { + if [[ -n $sbt_explicit_version ]]; then + echo $sbt_explicit_version + else + local v=$(build_props_sbt) + if [[ -n $v ]]; then + echo $v + else + echo $sbt_release_version + fi + fi +} + +echoerr () { + [[ -z $quiet ]] && echo 1>&2 "$@" +} +vlog () { + [[ $verbose || $debug ]] && echoerr "$@" +} +dlog () { + [[ $debug ]] && echoerr "$@" +} + +# this seems to cover the bases on OSX, and someone will +# have to tell me about the others. +get_script_path () { + local path="$1" + [[ -L "$path" ]] || { echo "$path" ; return; } + + local target=$(readlink "$path") + if [[ "${target:0:1}" == "/" ]]; then + echo "$target" + else + echo "$(dirname $path)/$target" + fi +} + +# a ham-fisted attempt to move some memory settings in concert +# so they need not be dicked around with individually. +get_mem_opts () { + local mem=${1:-1536} + local perm=$(( $mem / 4 )) + (( $perm > 256 )) || perm=256 + (( $perm < 1024 )) || perm=1024 + local codecache=$(( $perm / 2 )) + + echo "-Xms${mem}m -Xmx${mem}m -XX:MaxPermSize=${perm}m -XX:ReservedCodeCacheSize=${codecache}m" +} + +die() { + echo "Aborting: $@" + exit 1 +} + +make_url () { + groupid="$1" + category="$2" + version="$3" + + echo "http://typesafe.artifactoryonline.com/typesafe/ivy-$category/$groupid/sbt-launch/$version/sbt-launch.jar" +} + +declare -r default_jvm_opts="-Dfile.encoding=UTF8" +declare -r default_sbt_opts="-XX:+CMSClassUnloadingEnabled" +declare -r default_sbt_mem=1536 +declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy" +declare -r sbt_opts_file=".sbtopts" +declare -r jvm_opts_file=".jvmopts" +declare -r latest_28="2.8.2" +declare -r latest_29="2.9.2" +declare -r latest_210="2.10.0-SNAPSHOT" + +declare -r script_path=$(get_script_path "$BASH_SOURCE") +declare -r script_dir="$(dirname $script_path)" +declare -r script_name="$(basename $script_path)" + +# some non-read-onlies set with defaults +declare java_cmd=java +declare sbt_launch_dir="$script_dir/.lib" +declare sbt_universal_launcher="$script_dir/lib/sbt-launch.jar" +declare sbt_mem=$default_sbt_mem +declare sbt_jar=$sbt_universal_launcher + +# pull -J and -D options to give to java. +declare -a residual_args +declare -a java_args +declare -a scalac_args +declare -a sbt_commands + +build_props_scala () { + if [[ -f project/build.properties ]]; then + versionLine=$(grep ^build.scala.versions project/build.properties) + versionString=${versionLine##build.scala.versions=} + echo ${versionString%% .*} + fi +} + +execRunner () { + # print the arguments one to a line, quoting any containing spaces + [[ $verbose || $debug ]] && echo "# Executing command line:" && { + for arg; do + if printf "%s\n" "$arg" | grep -q ' '; then + printf "\"%s\"\n" "$arg" + else + printf "%s\n" "$arg" + fi + done + echo "" + } + + exec "$@" +} + +sbt_groupid () { + case $(sbt_version) in + 0.7.*) echo org.scala-tools.sbt ;; + 0.10.*) echo org.scala-tools.sbt ;; + 0.11.[12]) echo org.scala-tools.sbt ;; + *) echo org.scala-sbt ;; + esac +} + +sbt_artifactory_list () { + local version0=$(sbt_version) + local version=${version0%-SNAPSHOT} + local url="http://typesafe.artifactoryonline.com/typesafe/ivy-snapshots/$(sbt_groupid)/sbt-launch/" + dlog "Looking for snapshot list at: $url " + + curl -s --list-only "$url" | \ + grep -F $version | \ + perl -e 'print reverse <>' | \ + perl -pe 's#^/dev/null + dlog "curl returned: $?" + echo "$url" + return + done +} + +jar_url () { + case $(sbt_version) in + 0.7.*) echo "http://simple-build-tool.googlecode.com/files/sbt-launch-0.7.7.jar" ;; + *-SNAPSHOT) make_snapshot_url ;; + *) make_release_url ;; + esac +} + +jar_file () { + echo "$sbt_launch_dir/$1/sbt-launch.jar" +} + +download_url () { + local url="$1" + local jar="$2" + + echo "Downloading sbt launcher $(sbt_version):" + echo " From $url" + echo " To $jar" + + mkdir -p $(dirname "$jar") && { + if which curl >/dev/null; then + curl --fail --silent "$url" --output "$jar" + elif which wget >/dev/null; then + wget --quiet -O "$jar" "$url" + fi + } && [[ -f "$jar" ]] +} + +acquire_sbt_jar () { + sbt_url="$(jar_url)" + sbt_jar="$(jar_file $(sbt_version))" + + [[ -f "$sbt_jar" ]] || download_url "$sbt_url" "$sbt_jar" +} + +usage () { + cat < path to global settings/plugins directory (default: ~/.sbt/) + -sbt-boot path to shared boot directory (default: ~/.sbt/boot in 0.11+) + -ivy path to local Ivy repository (default: ~/.ivy2) + -mem set memory options (default: $sbt_mem, which is + $(get_mem_opts $sbt_mem) ) + -no-share use all local caches; no sharing + -offline put sbt in offline mode + -jvm-debug Turn on JVM debugging, open at the given port. + -batch Disable interactive mode + + # sbt version (default: from project/build.properties if present, else latest release) + !!! The only way to accomplish this pre-0.12.0 if there is a build.properties file which + !!! contains an sbt.version property is to update the file on disk. That's what this does. + -sbt-version use the specified version of sbt + -sbt-jar use the specified jar as the sbt launcher + -sbt-snapshot use a snapshot version of sbt + -sbt-launch-dir directory to hold sbt launchers (default: $sbt_launch_dir) + + # scala version (default: as chosen by sbt) + -28 use $latest_28 + -29 use $latest_29 + -210 use $latest_210 + -scala-home use the scala build at the specified directory + -scala-version use the specified version of scala + + # java version (default: java from PATH, currently $(java -version |& grep version)) + -java-home alternate JAVA_HOME + + # jvm options and output control + JAVA_OPTS environment variable holding jvm args, if unset uses "$default_jvm_opts" + SBT_OPTS environment variable holding jvm args, if unset uses "$default_sbt_opts" + .jvmopts if file is in sbt root, it is prepended to the args given to the jvm + .sbtopts if file is in sbt root, it is prepended to the args given to **sbt** + -Dkey=val pass -Dkey=val directly to the jvm + -J-X pass option -X directly to the jvm (-J is stripped) + -S-X add -X to sbt's scalacOptions (-J is stripped) + +In the case of duplicated or conflicting options, the order above +shows precedence: JAVA_OPTS lowest, command line options highest. +EOM +} + +addJava () { + dlog "[addJava] arg = '$1'" + java_args=( "${java_args[@]}" "$1" ) +} +addSbt () { + dlog "[addSbt] arg = '$1'" + sbt_commands=( "${sbt_commands[@]}" "$1" ) +} +addScalac () { + dlog "[addScalac] arg = '$1'" + scalac_args=( "${scalac_args[@]}" "$1" ) +} +addResidual () { + dlog "[residual] arg = '$1'" + residual_args=( "${residual_args[@]}" "$1" ) +} +addResolver () { + addSbt "set resolvers in ThisBuild += $1" +} +addDebugger () { + addJava "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1" +} +get_jvm_opts () { + # echo "${JAVA_OPTS:-$default_jvm_opts}" + # echo "${SBT_OPTS:-$default_sbt_opts}" + + [[ -f "$jvm_opts_file" ]] && cat "$jvm_opts_file" +} + +process_args () +{ + require_arg () { + local type="$1" + local opt="$2" + local arg="$3" + + if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then + die "$opt requires <$type> argument" + fi + } + while [[ $# -gt 0 ]]; do + case "$1" in + -h|-help) usage; exit 1 ;; + -v|-verbose) verbose=1 && shift ;; + -d|-debug) debug=1 && shift ;; + -q|-quiet) quiet=1 && shift ;; + + -ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;; + -mem) require_arg integer "$1" "$2" && sbt_mem="$2" && shift 2 ;; + -no-colors) addJava "-Dsbt.log.noformat=true" && shift ;; + -no-share) addJava "$noshare_opts" && shift ;; + -sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;; + -sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;; + -debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;; + -offline) addSbt "set offline := true" && shift ;; + -jvm-debug) require_arg port "$1" "$2" && addDebugger $2 && shift 2 ;; + -batch) exec 0 )) || echo "Starting $script_name: invoke with -help for other options" + +# verify this is an sbt dir or -create was given +[[ -f ./build.sbt || -d ./project || -n "$sbt_create" ]] || { + cat <