Permalink
Browse files

First project samples in Git

  • Loading branch information...
0 parents commit c3a0042d2ea002d96c2b201da5772fb1e20a2cbf @freddy33 freddy33 committed Sep 18, 2011
Showing with 889 additions and 0 deletions.
  1. +1 −0 README
  2. +15 −0 gradle-example/api/build.gradle
  3. +38 −0 gradle-example/api/src/main/java/org/gradle/api/PersonList.java
  4. +19 −0 gradle-example/api/src/main/java/org/gradle/api/package.html
  5. +26 −0 gradle-example/api/src/main/java/org/gradle/apiImpl/Impl.java
  6. +76 −0 gradle-example/build.gradle
  7. +1 −0 gradle-example/gradle.properties
  8. +14 −0 gradle-example/init.gradle
  9. +7 −0 gradle-example/services/webservice/build.gradle
  10. +35 −0 gradle-example/services/webservice/src/main/java/org/gradle/webservice/TestTest.java
  11. +31 −0 gradle-example/services/webservice/src/test/java/org/gradle/webservice/TestTestTest.java
  12. +1 −0 gradle-example/settings.gradle
  13. +42 −0 gradle-example/shared/src/main/java/org/gradle/shared/Person.java
  14. +20 −0 gradle-example/shared/src/main/java/org/gradle/shared/package-info.java
  15. +17 −0 gradle-example/shared/src/main/resources/org/gradle/shared/main.properties
  16. +34 −0 ivy-example/build.properties
  17. +83 −0 ivy-example/build.xml
  18. +6 −0 ivy-example/common-configurations.xml
  19. +206 −0 ivy-example/common.xml
  20. +17 −0 ivy-example/ivysettings.xml
  21. +3 −0 ivy-example/multi1/build.xml
  22. +17 −0 ivy-example/multi1/ivy.xml
  23. +34 −0 ivy-example/multi1/src/main/java/test/AppTest.java
  24. +10 −0 ivy-example/multi1/src/main/java/test/Multi1.java
  25. +3 −0 ivy-example/multi2/build.xml
  26. +17 −0 ivy-example/multi2/ivy.xml
  27. +10 −0 ivy-example/multi2/src/main/java/test/App.java
  28. +34 −0 ivy-example/multi2/src/main/java/test/AppTest.java
  29. +3 −0 ivy-example/multi3/build.xml
  30. +15 −0 ivy-example/multi3/ivy.xml
  31. +34 −0 ivy-example/multi3/src/main/java/test/AppTest.java
  32. +11 −0 ivy-example/multi3/src/main/java/test/Multi3.java
  33. +9 −0 ivy-example/multi3/src/main/webapp/WEB-INF/web.xml
1 README
@@ -0,0 +1 @@
+Sample projects for training and testing CI setup with Artifactory
@@ -0,0 +1,15 @@
+configurations {
+ spi
+}
+
+dependencies {
+ compile project(':shared')
+ compile module("commons-lang:commons-lang:2.4") {
+ dependency("commons-io:commons-io:1.2")
+ }
+ compile group: 'org.apache.wicket', name: 'wicket', version: '1.3.7'
+
+}
+
+// Just a smoke test that using this option does not lead to any exception
+compileJava.options.compilerArgs = ['-Xlint:unchecked']
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2011 JFrog Ltd.
+ *
+ * Licensed 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.gradle.api;
+
+import org.gradle.apiImpl.Impl;
+import org.gradle.shared.Person;
+
+import java.util.ArrayList;
+
+
+public class PersonList {
+ private ArrayList<Person> persons = new ArrayList<Person>();
+
+ public void doSomethingWithImpl() {
+ org.apache.commons.lang.builder.ToStringBuilder stringBuilder;
+ try {
+ Class.forName("org.apache.commons.io.FileUtils");
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ new Impl().implMethod();
+ }
+
+}
@@ -0,0 +1,19 @@
+<!--
+ ~ Copyright (C) 2011 JFrog Ltd.
+ ~
+ ~ Licensed 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.
+ -->
+
+<html>
+<body><p>These are the API classes</p></body>
+</html>
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2011 JFrog Ltd.
+ *
+ * Licensed 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.gradle.apiImpl;
+
+
+public class Impl {
+
+ public void implMethod() {
+ double a = 4.0 * 4;
+ }
+
+}
@@ -0,0 +1,76 @@
+/**
+ * There are 2 ways to activate the Artifactory Build-Info plugin.
+ * 1. use apply from directly from the build.gradle as shown below.
+ * 2. use the init script "gradle --init-script init.gradle" ATTENTION: Check the URL inside this init.gradle
+ * 3. Copy the init.gradle to your ~/.gradle directory and execute normally. ATTENTION: Now the Artifactory URL will
+ * always be applied to all your projects.
+ *
+ * Check the URL that apply uses to get the remote script
+ *
+ */
+
+import java.text.DateFormat
+import java.text.SimpleDateFormat
+
+def globalVersion = new Version(currentVersion)
+
+allprojects {
+ apply plugin: 'artifactory'
+ group = 'org.gradle'
+ version = globalVersion
+ status = version.status
+}
+
+subprojects {
+ apply plugin: 'maven'
+ apply plugin: 'java'
+
+ dependencies {
+ testCompile 'junit:junit:4.7'
+ }
+ manifest.mainAttributes(provider: 'gradle')
+}
+
+artifactory {
+ contextUrl = 'http://repo.jfrog.org/artifactory'
+ publish {
+ defaults {
+ publishConfigs('archives', 'published')
+ properties = ['build.status': "$it.project.status".toString()]
+ }
+ }
+ resolve {
+ repoKey = 'gradle'
+ }
+}
+
+dependsOnChildren()
+
+class Version {
+ String originalVersion
+ String thisVersion
+ String status
+ Date buildTime
+
+ Version(String versionValue) {
+ buildTime = new Date()
+ originalVersion = versionValue
+ if (originalVersion.endsWith('-SNAPSHOT')) {
+ status = 'integration'
+ thisVersion = originalVersion.substring(0,originalVersion.length()-'-SNAPSHOT'.length()) + getTimestamp()
+ } else {
+ status = 'release'
+ }
+ }
+
+ String getTimestamp() {
+ // Convert local file timestamp to UTC
+ def format = new SimpleDateFormat('yyyyMMddHHmmss')
+ format.setCalendar(Calendar.getInstance(TimeZone.getTimeZone('UTC')));
+ return format.format(buildTime)
+ }
+
+ String toString() {
+ thisVersion
+ }
+}
@@ -0,0 +1 @@
+currentVersion=1.0-SNAPSHOT
@@ -0,0 +1,14 @@
+
+gradle.projectsLoaded {
+ rootProject.allprojects {
+ buildscript {
+ repositories {
+ mavenRepo(urls: 'http://repo.jfrog.org/artifactory/gradle-plugins').setChecksums('sha1')
+ }
+ dependencies {
+ classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.3')
+ }
+ }
+ }
+}
+
@@ -0,0 +1,7 @@
+apply plugin: 'war'
+
+dependencies {
+ compile project(':shared'), 'commons-collections:commons-collections:3.2@jar', 'commons-io:commons-io:1.2', 'commons-lang:commons-lang:2.4@jar'
+ compile group: 'org.apache.wicket', name: 'wicket', version: '1.3.7'
+ compile project(':api')
+}
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 JFrog Ltd.
+ *
+ * Licensed 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.gradle.webservice;
+
+import org.apache.commons.collections.list.GrowthList;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.gradle.api.PersonList;
+import org.gradle.shared.Person;
+
+public class TestTest {
+ private String name;
+
+ public void method() {
+ FilenameUtils.separatorsToUnix("my/unix/filename");
+ ToStringBuilder.reflectionToString(new Person("name"));
+ new GrowthList();
+ new PersonList().doSomethingWithImpl(); // compile with api-spi, runtime with api
+ }
+
+}
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2007 the original author or authors.
+ *
+ * Licensed 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.gradle.webservice;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Hans Dockter
+ */
+public class TestTestTest extends TestCase {
+ public void testClasspath() {
+ new TestTest().method();
+ }
+
+ public void testApiCompileClasspath() {
+ new org.gradle.api.PersonList();
+ }
+}
@@ -0,0 +1 @@
+include "shared", "api", "services:webservice"
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 JFrog Ltd.
+ *
+ * Licensed 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.gradle.shared;
+
+import java.io.IOException;
+import java.util.Properties;
+
+public class Person {
+ private String name;
+
+ public Person(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String readProperty() throws IOException {
+ Properties properties = new Properties();
+ properties.load(getClass().getClassLoader().getResourceAsStream("org/gradle/shared/main.properties"));
+ return properties.getProperty("main");
+ }
+}
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2011 JFrog Ltd.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * These are the shared classes.
+ */
+package org.gradle.shared;
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2011 JFrog Ltd.
+#
+# Licensed 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.
+#
+
+main=mainValue
@@ -0,0 +1,34 @@
+# ***************************************************************
+# * 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.
+# ***************************************************************
+lib.dir = ${basedir}/lib
+build.dir = ${basedir}/build
+classes.dir = ${build.dir}/classes
+src.dir = ${basedir}/src
+
+repository.dir=${basedir}/../repository
+ivy.local.default.root=${repository.dir}/local
+ivy.shared.default.root=${repository.dir}/shared
+
+ivy.file = ${basedir}/ivy.xml
+ivy.settings.file=${basedir}/../ivysettings.xml
+
+jar.file = ${build.dir}/${ant.project.name}.jar
+main.class.name = ${ant.project.name}.Main
+ivy.cache.dir=/home/tomer/.ivy2/cache
+module.version.target = 1.0
Oops, something went wrong.

0 comments on commit c3a0042

Please sign in to comment.