aboutsummaryrefslogtreecommitdiffstats
path: root/build.gradle
blob: 8c9eacf48b4f46232b7b158bcefe9c547dd93e24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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"
      dependsOn publishToMavenLocal // Refreshes the local Maven cache before uploading

      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/' + project.getName(),
                  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/' + project.getName()) {
                  include(name: '**/**')
              }
          }
      }
  }
}