Update build-std-scala to use high level targets, and add according tests git-svn-id: https://svn.apache.org/repos/asf/incubator/easyant/buildtypes/trunk@1374523 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build-std-scala/module.ivy b/build-std-scala/module.ivy index 579b36c..d48c666 100644 --- a/build-std-scala/module.ivy +++ b/build-std-scala/module.ivy
@@ -15,7 +15,7 @@ limitations under the License. --> <ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> - <info organisation="org.apache.easyant.buildtypes" module="build-std-scala" revision="0.2"> + <info organisation="org.apache.easyant.buildtypes" module="build-std-scala" revision="0.9"> <ea:build organisation="org.apache.easyant.buildtypes" module="build-std-ant-plugin" revision="0.1"/> </info> <configurations>
diff --git a/build-std-scala/src/main/resources/build-std-scala.ant b/build-std-scala/src/main/resources/build-std-scala.ant index 3aa8745..7115b77 100644 --- a/build-std-scala/src/main/resources/build-std-scala.ant +++ b/build-std-scala/src/main/resources/build-std-scala.ant
@@ -23,28 +23,36 @@ <property file="${org.apache.easyant.buildtypes#build-std-scala.properties.file}" /> - <ea:import mrid="org.apache.easyant.plugins#clean-std;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#ivy-provisioning;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#default-version-strategy;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#ivy-publication;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#ivy-utils;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#resources-std;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#compile-scala;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#compile-test-scala;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#test-junit;0.3" /> - <ea:import mrid="org.apache.easyant.plugins#manifest;0.2" /> - <ea:import mrid="org.apache.easyant.plugins#package-jar;0.2" /> + <ea:import mrid="org.apache.easyant.plugins#phases-std;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#clean-std;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#ivy-provisioning;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#default-version-strategy;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#ivy-publication;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#ivy-utils;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#resources-std;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#compile-scala;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#compile-test-scala;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#test-junit;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#manifest;0.9" /> + <ea:import mrid="org.apache.easyant.plugins#package-jar;0.9" /> <!-- plugin binding --> - <bindtargets targets="compile-scala:compile,manifest:manifest,manifest:manifest-runnable,resources-std:copy-resources" extensionPoint="package-jar:jar-ready" /> - <bindtargets targets="compile-test-scala:compile,resources-std:copy-test-resources" extensionPoint="abstract-test:test-ready" /> - <bindtargets targets="package-jar:jar,source-jar:main" extensionPoint="ivy-publication:publish-ready" /> + <bindtargets targets="manifest:manifest-runnable,resources-std:copy-resources" extensionPoint="abstract-package:package-ready" /> + <bindtargets targets="abstract-compile:compile-finished,resources-std:copy-resources,resources-std:copy-test-resources" extensionPoint="abstract-test:test-ready" /> + <bindtargets targets="package-jar:jar" extensionPoint="ivy-publication:publish-ready" /> - <!-- friendly target names --> - <target name="clean" depends="clean-std:clean" description="Clean the project" /> - <target name="compile" depends="compile-scala:compile" description="Compile the project" /> - <target name="test" depends="test-junit:run" description="Launch the unit tests" /> + <!-- bind high level targets --> + <bindtargets targets="clean-std:clean" extensionPoint="clean"/> + <bindtargets targets="abstract-compile:compile-finished" extensionPoint="compile"/> + <bindtargets targets="abstract-test:test-run" extensionPoint="test"/> + <bindtargets targets="abstract-test:integration-test-run" extensionPoint="integration-test"/> + <bindtargets targets="abstract-package:package-finished" extensionPoint="package"/> + <bindtargets targets="ivy-publication:publish-local" extensionPoint="publish-local"/> + <bindtargets targets="ivy-publication:publish-shared" extensionPoint="publish-shared"/> + <bindtargets targets="ivy-publication:release" extensionPoint="release"/> + + <!-- additionnal friendtly target names --> <target name="dist" depends="ivy-publication:publish-ready" description="Produce every artifact to be distributed" /> - <target name="install" depends="ivy-publication:publish-local" description="Install the artifacts into the repository" /> + <target name="install" depends="ivy-publication:publish-local" description="Install the artifacts into local repository" /> </project>
diff --git a/build-std-scala/src/test/antunit/build-std-scala-test.xml b/build-std-scala/src/test/antunit/build-std-scala-test.xml new file mode 100644 index 0000000..8bd666e --- /dev/null +++ b/build-std-scala/src/test/antunit/build-std-scala-test.xml
@@ -0,0 +1,62 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<project name="org.apache.easyant.plugins;build-std-scala-test" +xmlns:au="antlib:org.apache.ant.antunit" +xmlns:ivy="antlib:org.apache.ivy.ant" +xmlns:ea="antlib:org.apache.easyant"> + +<!-- Import your plugin --> +<property name="target" value="target/test-antunit"/> +<!-- configure easyant in current project --> +<ea:configure-easyant-ivy-instance /> +<!-- import our local plugin --> +<property name="easyant.file" value="${basedir}/module.ivy"/> +<ea:import-test-module moduleIvy="../../../module.ivy" sourceDirectory="../../main/resources"/> + +<!-- Defines a setUp / tearDown (before each test) that cleans the environnement --> +<target name="clean-test" description="remove stale build artifacts before / after each test"> +<delete dir="${basedir}" includeemptydirs="true"> + <include name="**/target/**"/> + <include name="**/lib/**"/> +</delete> +</target> + +<target name="setUp" depends="clean-test"> +<ivy:settings id="project.ivy.instance"/> +</target> +<target name="tearDown" depends="clean-test"/> + +<target name="test-build-std-scala:clean" depends="clean"> + <au:assertLogContains text="Cleaning ${target}..."/> + <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-scala:clean' is [clean-test, setUp, clean-std:clean, clean, test-build-std-scala:clean]" level="debug"/> +</target> + +<target name="test-build-std-scala:compile" depends="compile"> + <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-scala:compile' is [clean-test, setUp, -ivy-provisioning:init, abstract-provisioning:provisioning-ready, -ivy-provisioning:resolve, -ivy-provisioning:resolve-main-confs, -ivy-provisioning:resolve-test-confs, -ivy-provisioning:resolve-provided-confs, ivy-provisioning:resolve, abstract-provisioning:provisioning-finished, abstract-compile:compile-ready, compile-scala:init, compile-scala:configure, compile-scala:compile, compile-test-scala:configure, compile-test-scala:compile, compile-test-scala:compile-integration, abstract-compile:compile-finished, compile, test-build-std-scala:compile]" level="debug"/> +</target> + +<target name="test-build-std-scala:test" depends="test"> + <au:assertLogContains text="Running org.apache.easyant.example.ExampleTest"/> + <au:assertLogContains text="Tests run: 2, Failures: 0, Errors: 0"/> + <au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-scala:test' is [clean-test, setUp, -ivy-provisioning:init, abstract-provisioning:provisioning-ready, -ivy-provisioning:resolve, -ivy-provisioning:resolve-main-confs, -ivy-provisioning:resolve-test-confs, -ivy-provisioning:resolve-provided-confs, ivy-provisioning:resolve, abstract-provisioning:provisioning-finished, abstract-compile:compile-ready, compile-scala:init, compile-scala:configure, compile-scala:compile, compile-test-scala:configure, compile-test-scala:compile, compile-test-scala:compile-integration, abstract-compile:compile-finished, compile, resources-std:init, -resources-std:check-resources, resources-std:copy-resources, resources-std:copy-test-resources, abstract-test:test-ready, abstract-test:init, test-junit:init, abstract-test:compute-test-sets, -test-junit:test, test-junit:run, abstract-test:test-run, test, test-build-std-scala:test]" level="debug"/> +</target> + +<target name="test-build-std-scala:package" depends="package"> +<au:assertLogContains text="Build sequence for target(s) `setUp', `test-build-std-scala:package' is [clean-test, setUp, -ivy-provisioning:init, abstract-provisioning:provisioning-ready, -ivy-provisioning:resolve, -ivy-provisioning:resolve-main-confs, -ivy-provisioning:resolve-test-confs, -ivy-provisioning:resolve-provided-confs, ivy-provisioning:resolve, abstract-provisioning:provisioning-finished, abstract-compile:compile-ready, compile-scala:init, compile-scala:configure, compile-scala:compile, compile-test-scala:configure, compile-test-scala:compile, compile-test-scala:compile-integration, abstract-compile:compile-finished, compile, manifest:init, -manifest:generate-version-number, manifest:manifest, manifest:manifest-runnable, resources-std:init, -resources-std:check-resources, resources-std:copy-resources, abstract-package:package-ready, abstract-package:init, abstract-package:compute-metainf, package-jar:init, package-jar:jar, abstract-package:register-main-artifact, abstract-package:package-finished, package, test-build-std-scala:package]" level="debug"/> + </target> + +</project>
diff --git a/build-std-scala/src/test/antunit/module.ivy b/build-std-scala/src/test/antunit/module.ivy new file mode 100644 index 0000000..dd5e631 --- /dev/null +++ b/build-std-scala/src/test/antunit/module.ivy
@@ -0,0 +1,29 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> + <info organisation="org.apache.easyant" module="standard-java-app" revision="0.1" status="integration" > + </info> + <configurations> + <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf"/> + <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/> + </configurations> + <dependencies> + <dependency org="hsqldb" name="hsqldb" rev="1.8.0.7" conf="default->default"/> + <dependency org="junit" name="junit" rev="4.4" conf="test->default" /> + + </dependencies> +</ivy-module>
diff --git a/build-std-scala/src/test/antunit/src/main/resources/main.properties b/build-std-scala/src/test/antunit/src/main/resources/main.properties new file mode 100644 index 0000000..f2bef19 --- /dev/null +++ b/build-std-scala/src/test/antunit/src/main/resources/main.properties
@@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +example=Hello
diff --git a/build-std-scala/src/test/antunit/src/main/scala/org/apache/easyant/example/Example.scala b/build-std-scala/src/test/antunit/src/main/scala/org/apache/easyant/example/Example.scala new file mode 100644 index 0000000..bdc9de6 --- /dev/null +++ b/build-std-scala/src/test/antunit/src/main/scala/org/apache/easyant/example/Example.scala
@@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.easyant.example; + +object Example { + def main(args: Array[String]) { + println("Hello, world!"); + } + +}
diff --git a/build-std-scala/src/test/antunit/src/test/resources/test.properties b/build-std-scala/src/test/antunit/src/test/resources/test.properties new file mode 100644 index 0000000..d08a419 --- /dev/null +++ b/build-std-scala/src/test/antunit/src/test/resources/test.properties
@@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +test.example=Hello Test
diff --git a/build-std-scala/src/test/antunit/src/test/scala/org/apache/easyant/example/ExampleTest.scala b/build-std-scala/src/test/antunit/src/test/scala/org/apache/easyant/example/ExampleTest.scala new file mode 100644 index 0000000..77df0aa --- /dev/null +++ b/build-std-scala/src/test/antunit/src/test/scala/org/apache/easyant/example/ExampleTest.scala
@@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.easyant.example; + +import junit.framework._ +import org.junit.Assert._ + +class ExampleTest extends TestCase { + def testOne() = { + assertEquals(1,1) + } + +}