-
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.
Adjust the project layout to the maven layout; create a gradle build
script
1 parent
db4342c
commit 4fbb8e9
Showing
106 changed files
with
324 additions
and
15 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="lib" path="lib/swt.jar"/> | ||
<classpathentry kind="src" path="src/main/java"/> | ||
<classpathentry kind="src" path="src/main/resources"/> | ||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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
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
6 changes: 6 additions & 0 deletions
6
.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs
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,6 @@ | ||
#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences | ||
#Sun Dec 07 22:17:50 IST 2014 | ||
build.family.org.gradle.tooling.model.eclipse.HierarchicalEclipseProject=; | ||
org.springsource.ide.eclipse.gradle.classpath.enableSorting=true | ||
org.springsource.ide.eclipse.gradle.linkedresources= | ||
org.springsource.ide.eclipse.gradle.rootprojectloc= |
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
#Sun Mar 25 17:52:12 IST 2012 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
# | ||
#Tue Dec 09 00:05:51 IST 2014 | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.source=1.6 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
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,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
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,246 @@ | ||
import groovyx.net.http.EncoderRegistry | ||
import groovyx.net.http.HTTPBuilder | ||
import org.apache.http.HttpRequest | ||
import org.apache.http.HttpResponse | ||
import org.apache.http.auth.AuthScope | ||
import org.apache.http.auth.UsernamePasswordCredentials | ||
import org.apache.http.client.methods.HttpGet | ||
import org.apache.http.client.methods.HttpHead | ||
import org.apache.http.client.methods.HttpPut | ||
import org.apache.http.client.methods.HttpUriRequest | ||
import org.apache.http.entity.InputStreamEntity | ||
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler | ||
import org.apache.http.impl.client.DefaultRedirectStrategy | ||
import org.apache.http.protocol.HttpContext | ||
import org.gradle.api.logging.Logger | ||
import org.gradle.api.logging.Logging | ||
import groovy.json.JsonBuilder | ||
import groovyx.net.http.HTTPBuilder | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.GradleException | ||
import org.gradle.api.artifacts.Configuration | ||
import org.gradle.api.file.CopySpec | ||
import org.gradle.api.publish.Publication | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.Optional | ||
import org.gradle.api.tasks.TaskAction | ||
import org.gradle.api.tasks.Upload | ||
import java.text.DateFormat | ||
import java.text.ParseException | ||
import java.text.SimpleDateFormat | ||
|
||
import static groovyx.net.http.ContentType.BINARY | ||
import static groovyx.net.http.ContentType.JSON | ||
import static groovyx.net.http.Method.* | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'maven' | ||
apply plugin: 'eclipse' | ||
apply plugin: 'application' | ||
|
||
sourceCompatibility = 1.6 | ||
|
||
def swtArchitecture = 'win32.win32.x86_64' | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' | ||
} | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
maven { | ||
url 'https://swt-repo.googlecode.com/svn/repo/' | ||
} | ||
} | ||
dependencies { | ||
compile group: 'org.eclipse.swt', name: "org.eclipse.swt.$swtArchitecture", version: '4.3' | ||
} | ||
|
||
apply plugin: 'com.jfrog.bintray' | ||
|
||
group = groupId | ||
version = versionId | ||
|
||
jar { | ||
manifest { | ||
attributes 'Specification-Title': jarTitle, 'Specification-Version': jarVersion, 'Specification-Vendor': jarVendor | ||
attributes 'Implementation-Title': jarTitle, 'Implementation-Version': jarVersion, 'Implementation-Vendor': jarVendor | ||
} | ||
} | ||
|
||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives sourcesJar | ||
archives javadocJar | ||
} | ||
|
||
mainClassName = 'ynn.mylogo.ui.swt.Main' | ||
|
||
def groupPath = group.replaceAll('\\.', '/') | ||
|
||
bintray { | ||
user = bintrayUser | ||
key = bintrayApiKey | ||
|
||
configurations = ['archives'] | ||
// filesSpec { | ||
// from '/build/distributions' | ||
// into groupPath + '/' + bintrayVersion | ||
// } | ||
dryRun = false //Whether to run this as dry-run, without deploying | ||
publish = false //If version should be auto published after an upload | ||
pkg { | ||
repo = bintrayRepo | ||
name = bintrayPackage | ||
desc = 'myLOGO core - parser, design-time model, runtime model and basic UI' | ||
websiteUrl = githubUrl | ||
issueTrackerUrl = "${githubUrl}/issues" | ||
vcsUrl = "${githubUrl}.git" | ||
licenses = ['MIT'] | ||
labels = ['LOGO', 'parser'] | ||
publicDownloadNumbers = true | ||
//Optional version descriptor | ||
version { | ||
name = bintrayVersion | ||
vcsTag = "v${bintrayVersion}" | ||
} | ||
} | ||
} | ||
|
||
task uploadZipToBintray (dependsOn: 'distZip') << { | ||
def apiUrl = 'https://api.bintray.com' | ||
def dryRun = false | ||
def zipName = "${artifactId}-${bintrayVersion}.zip" | ||
def publishedZipName = "${artifactId}-${bintrayVersion}-${swtArchitecture}.zip" | ||
def artifactPath = "$groupPath/$artifactId/$bintrayVersion/$publishedZipName" | ||
def versionPath = "$bintrayPackage/$bintrayVersion" | ||
def uploadUri = "/content/$bintrayUser/$bintrayRepo/$versionPath/${artifactPath}" | ||
def artifactFile = file("build/distributions/$zipName") | ||
if (!artifactFile.exists()) { | ||
System.err.println "Skipping upload for missing file '$artifactFile'." | ||
return | ||
} | ||
def http = BintrayHttpClientFactory.create(apiUrl, bintrayUser, bintrayApiKey) | ||
artifactFile.withInputStream { is -> | ||
is.metaClass.totalBytes = { | ||
artifactFile.length() | ||
} | ||
println "Uploading to $apiUrl$uploadUri..." | ||
if (dryRun) { | ||
println "(Dry run) Uploaded to '$apiUrl$uploadUri'." | ||
return | ||
} | ||
http.request(PUT) { | ||
uri.path = uploadUri | ||
requestContentType = BINARY | ||
body = is | ||
response.success = { resp -> | ||
println "Uploaded to '$apiUrl$uri.path'." | ||
} | ||
response.failure = { resp -> | ||
throw new GradleException("Could not upload to '$apiUrl$uri.path': $resp.statusLine") | ||
} | ||
} | ||
} | ||
} | ||
|
||
task pushToBintray (dependsOn: ['bintrayUpload', 'uploadZipToBintray']) {} | ||
|
||
|
||
|
||
|
||
|
||
|
||
class BintrayHttpClientFactory { | ||
|
||
private static Logger logger = Logging.getLogger(BintrayHttpClientFactory.class) | ||
|
||
static HTTPBuilder create(apiUrl, user, apiKey) { | ||
def assertNotEmpty = { String name, String val -> | ||
if (val?.isEmpty()) { | ||
throw new IllegalArgumentException("Bintray $name cannot be empty!"); | ||
} | ||
} | ||
assertNotEmpty('apiUrl', apiUrl) | ||
assertNotEmpty('user', user) | ||
assertNotEmpty('apiKey', apiKey) | ||
|
||
def http = new HTTPBuilder(apiUrl) | ||
|
||
// Must use preemptive auth for non-repeatable upload requests | ||
http.headers.Authorization = "Basic ${"$user:$apiKey".toString().bytes.encodeBase64()}" | ||
|
||
//Set an entity with a length for a stream that has the totalBytes method on it | ||
def er = new EncoderRegistry() { | ||
@Override | ||
InputStreamEntity encodeStream(Object data, Object contentType) throws UnsupportedEncodingException { | ||
if (data.metaClass.getMetaMethod("totalBytes")) { | ||
InputStreamEntity entity = new InputStreamEntity((InputStream) data, data.totalBytes()) | ||
entity.setContentType(contentType.toString()) | ||
entity | ||
} else { | ||
super.encodeStream(data, contentType) | ||
} | ||
} | ||
} | ||
http.encoders = er | ||
|
||
//No point in retrying non-repeatable upload requests | ||
http.client.httpRequestRetryHandler = new DefaultHttpRequestRetryHandler(0, false) | ||
|
||
//Follow permanent redirects for PUTs | ||
http.client.setRedirectStrategy(new DefaultRedirectStrategy() { | ||
@Override | ||
boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) { | ||
def redirected = super.isRedirected(request, response, context) | ||
return redirected || response.getStatusLine().getStatusCode() == 301 | ||
} | ||
|
||
@Override | ||
HttpUriRequest getRedirect(HttpRequest request, HttpResponse response, HttpContext context) | ||
throws org.apache.http.ProtocolException { | ||
URI uri = getLocationURI(request, response, context) | ||
String method = request.requestLine.method | ||
if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) { | ||
return new HttpHead(uri) | ||
} else if (method.equalsIgnoreCase(HttpPut.METHOD_NAME)) { | ||
return new HttpPut(uri) | ||
} else { | ||
return new HttpGet(uri) | ||
} | ||
} | ||
}) | ||
|
||
if (System.getProperty('http.proxyHost')) { | ||
String proxyHost = System.getProperty('http.proxyHost') | ||
Integer proxyPort = Integer.parseInt(System.getProperty('http.proxyPort', '80')); | ||
String proxyUser = System.getProperty('http.proxyUser') | ||
String proxyPassword = System.getProperty('http.proxyPassword', '') | ||
logger.info "Using proxy ${proxyUser}:${proxyPassword}@${proxyHost}:${proxyPort}" | ||
if (proxyUser) { | ||
http.client.getCredentialsProvider().setCredentials( | ||
new AuthScope(proxyHost, proxyPort), | ||
new UsernamePasswordCredentials(proxyUser, proxyPassword) | ||
) | ||
} | ||
http.setProxy(proxyHost, proxyPort, 'http') | ||
} | ||
http | ||
} | ||
} |
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,18 @@ | ||
# Maven coordinates | ||
groupId=ynn.mylogo | ||
versionId=1.0.1 | ||
artifactId=mylogo-core | ||
|
||
# JAR | ||
jarTitle=myLOGO-Core | ||
jarVersion=1.0.1 | ||
jarVendor=Yinon Avraham | ||
|
||
# Bintray | ||
bintrayUser=yinonavraham | ||
bintrayApiKey=ed1ff5ae53bf6476b09632b90b87568d95c0d311 | ||
bintrayOwner=yinonavraham | ||
bintrayRepo=maven | ||
bintrayPackage=myLOGO-Core | ||
bintrayVersion=1.0.1 | ||
githubUrl=https://github.com/yinonavraham/myLOGO |
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,30 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>ynn.mylogo</groupId> | ||
<artifactId>mylogo-core</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>mylogo-core</name> | ||
<description>myLOGO Core - parser, design-time model, runtime model and basic UI</description> | ||
<build> | ||
<sourceDirectory>src</sourceDirectory> | ||
<resources> | ||
<resource> | ||
<directory>src</directory> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<url>https://github.com/yinonavraham/myLOGO</url> | ||
</project> |
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 @@ | ||
rootProject.name = artifactId |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.