allprojects { apply plugin: 'java-library' group = 'org.jogamp.ardor3d' version = '1.0-SNAPSHOT' } subprojects { apply plugin: 'java' apply plugin: 'maven-publish' java { withJavadocJar() withSourcesJar() } publishing { publications { mavenJava(MavenPublication) { from components.java pom { name = "JogAmp's Ardor3D Continuation" description = 'A general-purpose, professionally oriented, open source, scenegraph based 3D engine written in Java' url = 'https://jogamp.org/deployment/ardor3d/' licenses { license { name = 'zlib/libpng License' url = 'http://opensource.org/licenses/Zlib' } } developers { developer { id = 'gouessej' name = 'Julien Gouesse' email = 'gouessej@orange.fr' } } scm { connection = 'scm:git:git://jogamp.com/srv/scm/ardor3d.git' developerConnection = 'ssh://jgouesse@jogamp.org/srv/scm/ardor3d.git' url = 'https://jogamp.org/cgit/ardor3d.git/' } } } } } sourceCompatibility = JavaVersion.VERSION_20 targetCompatibility = JavaVersion.VERSION_20 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' //FIXME stop using the URL deprecated constructors //options.compilerArgs = ['-Xlint:deprecation'] } task packageSources(type: Jar) { archiveClassifier = 'sources' from sourceSets.main.allSource } artifacts.archives packageSources repositories { mavenLocal() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } maven { url "https://repo.maven.apache.org/maven2" } maven { url "https://jogamp.org/deployment/maven" } maven { url "https://swt-repo.googlecode.com/svn/repo/" } } configurations.all { resolutionStrategy { dependencySubstitution { // The maven property ${osgi.platform} is not handled by Gradle // so we replace the dependency, using the osgi platform from the project settings def os = System.getProperty("os.name").toLowerCase() if (os.contains("windows")) { substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') using module("org.eclipse.platform:org.eclipse.swt.win32.win32.x86_64:3.106.3") } else if (os.contains("linux")) { substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') using module("org.eclipse.platform:org.eclipse.swt.gtk.linux.x86_64:3.106.3") } else if (os.contains("mac")) { substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') using module("org.eclipse.platform:org.eclipse.swt.cocoa.macosx.x86_64:3.106.3") } } } } dependencies { testImplementation group: 'junit', name: 'junit', version:'4.13.2' testImplementation group: 'org.easymock', name: 'easymock', version:'5.1.0' } } // SSH upload with Ant: https://blog.mrhaki.com/2009/12/gradle-goodness-using-optional-ant-task.html configurations { sshAntTask } repositories { mavenCentral() } dependencies { sshAntTask 'org.apache.ant:ant-jsch:1.10.13', 'com.jcraft:jsch:0.1.55' } tasks.register('publishToJogAmpMavenArdor3d') { description = 'Publishes all Maven publications produced by this project to the remote JogAmp Maven repository.' group = "Publishing" def passphrase = project.property('JogAmpScpPassword') // Redefines scp Ant task, with the classpath property set to our newly defined sshAntTask configuration classpath. ant.taskdef(name: 'scp', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp', classpath: configurations.sshAntTask.asPath) doLast { // Invokes the scp Ant task. (Use gradle -i to see the output of the Ant task.) ant.scp(todir: 'jgouesse@jogamp.org:/srv/www/jogamp.org/deployment/maven-ardor3d/org/jogamp/ardor3d', keyfile: '${user.home}/.ssh/id_rsa', passphrase: passphrase as String, sftp: 'false', trust: 'true', verbose: 'true') { fileset(dir: '${user.home}/.m2/repository/org/jogamp/ardor3d') { include(name: '**/**') } } } }