Mercurial > hg > Members > sugi > GradleTest
changeset 0:1929863e27dc default tip
Gradle Test
author | YU |
---|---|
date | Wed, 23 Apr 2014 15:53:00 +0900 |
parents | |
children | |
files | build.gradle lib/jsonic-1.2.0.jar lib/msgpack-0.6.8-SNAPSHOT-sources.jar lib/msgpack-0.6.8-SNAPSHOT.jar src/main/java/org/gradle/GradleMain.java src/main/java/org/gradle/Person.java src/main/resources/org/gradle/resource.xml src/test/java/org/gradle/PersonTest.java src/test/resources/org/gradle/test-resource.xml |
diffstat | 9 files changed, 95 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.gradle Wed Apr 23 15:53:00 2014 +0900 @@ -0,0 +1,44 @@ +apply plugin: 'java' +apply plugin: 'eclipse' + +version = '1.0' + +dependencies { + compile fileTree(dir: 'lib', include: '*.jar') + runtime fileTree(dir: 'lib', include: '*.jar') + testCompile group: 'junit', name: 'junit', version: '4.+' +} + +jar { + copy { + from configurations.compile + into 'app/lib' + } + + def manifestClasspath = configurations.compile.collect{ 'lib/' + it.getName() }.join(' ') + manifest { + attributes 'Implementation-Title': 'Gradle Quickstart' + attributes 'Implementation-Version': version + attributes 'Main-Class' : 'org.gradle.GradleMain' + attributes 'Class-Path': manifestClasspath + } + + from (configurations.compile.resolve().collect { it.isDirectory() ? it : fileTree(it) }) { + exclude 'META-INF/MANIFEST.MF' + exclude 'META-INF/*.SF' + exclude 'META-INF/*.DSA' + exclude 'META-INF/*.RSA' + exclude '**/*.jar' + } + + destinationDir = file('app') + archiveName = 'GradleTest.jar' +} + +repositories { + mavenCentral() +} + +test { + systemProperties 'property': 'value' +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/gradle/GradleMain.java Wed Apr 23 15:53:00 2014 +0900 @@ -0,0 +1,18 @@ +package org.gradle; + +import java.util.Map; +import java.util.HashMap; + +import net.arnx.jsonic.JSON; + +public class GradleMain { + public static void main(String[] args) { + Map<String, Object> map = new HashMap<String, Object>(); + + map.put("hoge", "HOGE"); + map.put("fuga", "FUGA"); + map.put("piyo", "PIYO"); + + System.out.println(JSON.encode(map)); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/gradle/Person.java Wed Apr 23 15:53:00 2014 +0900 @@ -0,0 +1,19 @@ +package org.gradle; + +public class Person { + private final String name; + + public Person(String name) { + this.name = name; + + } + + public String getName() { + return name; + } + + public static void main(String[] args){ + Person person = new Person("Larry"); + System.out.println(person.getName()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/org/gradle/resource.xml Wed Apr 23 15:53:00 2014 +0900 @@ -0,0 +1,1 @@ +<some-element/>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/org/gradle/PersonTest.java Wed Apr 23 15:53:00 2014 +0900 @@ -0,0 +1,12 @@ +package org.gradle; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class PersonTest { + @Test + public void canConstructAPersonWithAName() { + Person person = new Person("Larry"); + assertEquals("Larry", person.getName()); + } +}