Skip to content

Commit

Permalink
Release 0.9
Browse files Browse the repository at this point in the history
Merge branch 'develop'

* develop:
  Adding jar & publish to build
  • Loading branch information
mpdeimos committed Apr 29, 2014
2 parents 668d567 + 82a3ac5 commit 4814309
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".infra"]
path = .infra
url = https://github.com/mpdeimos/.infra.git
1 change: 1 addition & 0 deletions .infra
Submodule .infra added at b5c8a4
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ language: java

jdk:
- oraclejdk7

env:
- secure: "W/lA3oQfMGFSHwbgR7e9sQ+0z6nXUJR9oGnefjUG7Vu2z5Wnsz0lcXN+A0soAFbm7CzrHMK4sY5V8oiqTl+cZTaULe2FjdFEQo7CffNNMwxtefIgrnpYPW5+6O9SYwja9qyHWeYQ2Kk62qiySbf2DkleBYhjzcmgcNFO4xKXa+k="

install: ant get-ivy

script: ant test
script: ant test publish

notifications:
email:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WebScraper [![Build Status](http://img.shields.io/travis/mpdeimos/web-scraper/master.svg)](https://travis-ci.org/mpdeimos/web-scraper)
WebScraper [![Build Status](https://travis-ci.org/mpdeimos/web-scraper.svg?branch=develop)](https://travis-ci.org/mpdeimos/web-scraper)
==========

Easy to use, annotation-based, multi-threaded Java library for sraping websites using CSS selectors.
114 changes: 100 additions & 14 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<project
xmlns:ivy="antlib:org.apache.ivy.ant"
name="com.mpdeimos.webscraper"
basedir="."
default="help">

<property environment="env"/>
<property name="ivy.install.version" value="2.4.0-rc1" />
<property name="ivy.home" value="${user.home}/.ant" />

Expand Down Expand Up @@ -92,36 +92,122 @@
</junit>
</target>

<target name="getgitdetails" >
<exec executable="git" outputproperty="git.tag">
<scriptdef name="regexreplace" language="javascript">
<attribute name="name"/>
<attribute name="value"/>
<attribute name="regex"/>
<attribute name="replace"/>
<![CDATA[
var regex = attributes.get("regex");
var replace = attributes.get("replace");
var value = attributes.get("value");
var replaced = value.replaceAll(regex, replace);
project.setProperty(attributes.get("name"), replaced);
]]>
</scriptdef>

<target name="git-info" >
<exec executable="git" outputproperty="git.branch">
<arg value="name-rev"/>
<arg value="--name-only"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" outputproperty="git.revision">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" outputproperty="git.count">
<arg value="rev-list"/>
<arg value="--count"/>
<arg value="--all"/>
</exec>
<exec executable="git" outputproperty="git.tag">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg line="--match version/*"/>
<arg value="--abbrev=0"/>
</exec>
<exec executable="git" outputproperty="git.describe">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg line="--match version/*"/>
</exec>
<exec executable="git" outputproperty="git.describe.long">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg line="--match version/*"/>
<arg value="--long"/>
</exec>

<regexreplace name="git.version" value="${git.describe}" regex="version/(.*)" replace="$1"/>
<regexreplace name="git.version.long" value="${git.describe.long}" regex="version/(.*)" replace="$1"/>
<regexreplace name="git.version.main" value="${git.tag}" regex="version/(.*)" replace="$1"/>
</target>

<target name="project-info" >
<ivy:info/>

<loadfile srcfile="./README.md" property="readme.title">
<filterchain>
<headfilter lines="1"/>
<tokenfilter>
<linetokenizer/>
<replaceregex pattern="([^\[]+).*" replace="\1"/>
<trim/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="./README.md" property="readme.description">
<filterchain>
<tokenfilter>
<linetokenizer/>
<trim/>
<ignoreblank/>
</tokenfilter>
<headfilter lines="1" skip="2"/>
</filterchain>
</loadfile>
</target>

<target name="jar" description="Create Jars" depends="build,git-info,project-info">

<target name="jar" description="Create Jars" depends="build,getgitdetails">

<mkdir dir="./build/tmp/" />
<mkdir dir="./build/jars/" />
<mkdir dir="./build/jar" />

<property name="build.jar" value="./build/jars/${ivy.organisation}.${ivy.module}.jar"/>

<jar jarfile="./build/jars/ant-resource-compiler.jar">
<jar jarfile="${build.jar}">
<manifest>
<attribute name="Class-Path" value="." />
<attribute name="Git-Revision" value="${git.revision}" />
<attribute name="Implementation-Version" value="${git.tag}" />
<section name="${ivy.organisation}/${ivy.module}">
<attribute name="Class-Path" value="." />
<attribute name="Specification-Title" value="${readme.title}" />
<attribute name="Specification-Version" value="${git.version.main}" />
<attribute name="Specification-Vendor" value="Martin Pöhlmann" />
<attribute name="Implementation-Title" value="${ivy.organisation}.${ivy.module}" />
<attribute name="Implementation-Version" value="${git.version.long}" />
<attribute name="Implementation-Vendor" value="Martin Pöhlmann" />
</section>
</manifest>
<fileset dir="./build/classes" includes="**/*" />
<fileset dir="./src" includes="**/*.prototype" />
<fileset dir="./build/main" includes="**/*" />
<fileset dir="./src/main" includes="**/*.prototype" />
</jar>

</target>

<target name="publish" depends="clean, build, jar" description="Publish this project in the ivy repository">
<target name="publish" description="Publish Jars" depends="jar" if="env.CI">

<exec executable="./.infra/smartfile/publish" failonerror="true">
<arg value="${build.jar}"/>
</exec>

</target>

<target name="ivy-publish" depends="clean, build, jar" description="Publish this project in the ivy repository">
<ivy:publish artifactspattern="./build/jars/[artifact].[ext]"
resolver="shared"
pubrevision="latest"
Expand Down
16 changes: 13 additions & 3 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,25 @@
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="com.mpdeimos" module="webscraper" />
<ivy-module
version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:e="http://ant.apache.org/ivy/extra"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
>
<info
organisation="com.mpdeimos"
module="webscraper"
e:title="Web Scraper"
e:author="Martin Poehlmann"
/>
<configurations>
<conf name="main" description="Building and executing the library" />
<conf name="test" extends="main" visibility="private" description="Testing the library" />
</configurations>
<dependencies>
<dependency org="org.jsoup" name="jsoup" rev="1.7.3" />
<dependency org="junit" name="junit" rev="4.11" conf="test->default" />
<dependency org="com.google.code.gson" name="gson" rev="2.2.4" conf="test->default"/>
</dependencies>
</ivy-module>

0 comments on commit 4814309

Please sign in to comment.