forked from jfrog/project-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c3a0042
Showing
33 changed files
with
889 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Sample projects for training and testing CI setup with Artifactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'] |
38 changes: 38 additions & 0 deletions
38
gradle-example/api/src/main/java/org/gradle/api/PersonList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
gradle-example/api/src/main/java/org/gradle/api/package.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
26 changes: 26 additions & 0 deletions
26
gradle-example/api/src/main/java/org/gradle/apiImpl/Impl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
currentVersion=1.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
} |
35 changes: 35 additions & 0 deletions
35
gradle-example/services/webservice/src/main/java/org/gradle/webservice/TestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
gradle-example/services/webservice/src/test/java/org/gradle/webservice/TestTestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include "shared", "api", "services:webservice" |
42 changes: 42 additions & 0 deletions
42
gradle-example/shared/src/main/java/org/gradle/shared/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
gradle-example/shared/src/main/java/org/gradle/shared/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
17 changes: 17 additions & 0 deletions
17
gradle-example/shared/src/main/resources/org/gradle/shared/main.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.