|
1 | | -buildscript { |
2 | | - repositories { |
3 | | - if( JavaVersion.current() == JavaVersion.VERSION_1_7 ) { |
4 | | - // Fallback for JDK 7 that can no longer connect to jcenter with https |
5 | | - maven { url "http://jcenter.bintray.com" } |
6 | | - } else { |
7 | | - jcenter() |
8 | | - } |
9 | | - } |
10 | | - dependencies { |
11 | | - // This sucks down a lot of stuff that 'normal' users wouldn't |
12 | | - // have and won't need anyway. |
13 | | - if( project.hasProperty('releaseUser') ) { |
14 | | - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+' |
15 | | - } |
16 | | - } |
17 | | -} |
18 | | - |
19 | | -apply plugin: 'java' |
20 | | -apply plugin: 'groovy' |
21 | | -apply plugin: 'maven' |
22 | | - |
23 | | -version='1.4.2-SNAPSHOT' |
24 | | -group='com.simsilica' |
25 | | - |
26 | | -ext.jmeVersion = "3.1.0-stable" |
27 | | -ext.slf4jVersion = '1.7.32' |
28 | | - |
29 | | -// Version meta-data |
30 | | -ext { |
31 | | - releaseDescription = "Sim-Math ${project.version}" |
32 | | - releaseVcsTag = "${project.name}-v${project.version}" |
33 | | -} |
34 | | - |
35 | | -// Project-wide meta-data |
36 | | -ext { |
37 | | - bintrayLabels = ['jMonkeyEngine', 'gamedev', 'math'] |
38 | | - websiteUrl = 'https://github.com/Simsilica/SimMath' |
39 | | - vcsUrl = 'https://github.com/Simsilica/SimMath.git' |
40 | | - githubRepo = 'Simsilica/SimMath' |
41 | | - issueTrackerUrl = 'https://github.com/Simsilica/SimMath/issues' |
42 | | -} |
43 | | - |
44 | | -repositories { |
45 | | - mavenLocal() |
46 | | - |
47 | | - if( JavaVersion.current() == JavaVersion.VERSION_1_7 ) { |
48 | | - // Fallback for JDK 7 that can no longer connect to jcenter with https |
49 | | - maven { url "http://jcenter.bintray.com" } |
50 | | - } else { |
51 | | - jcenter() |
52 | | - } |
53 | | -} |
54 | | - |
55 | | -sourceCompatibility = 1.7 |
56 | | -compileJava { |
57 | | - options.encoding = 'UTF-8' |
58 | | - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" |
59 | | -} |
60 | | - |
61 | | -// Make sure the build file declares what it actually imports |
62 | | -configurations.compile { |
63 | | - transitive = false |
64 | | -} |
65 | | - |
66 | | -dependencies { |
67 | | - // Pull in jme core for the math package for easy translation to/from JME |
68 | | - // classes. |
69 | | - compile "org.jmonkeyengine:jme3-core:$jmeVersion" |
70 | | - |
71 | | - compile "org.slf4j:slf4j-api:$slf4jVersion" |
72 | | - |
73 | | - testCompile 'junit:junit:4.12' |
74 | | - testCompile 'org.codehaus.groovy:groovy-all:2.4.11' |
75 | | -} |
76 | | - |
77 | | -test { |
78 | | - testLogging { |
79 | | - // I want to see the tests that are run and pass, etc. |
80 | | - events "passed", "skipped", "failed", "standardOut", "standardError" |
81 | | - } |
82 | | -} |
83 | | - |
84 | | -// Configuration to produce maven-repo style -sources and -javadoc jars |
85 | | -task sourcesJar(type: Jar) { |
86 | | - classifier = 'sources' |
87 | | - from sourceSets.main.allSource |
88 | | - exclude '**/.backups' |
89 | | -} |
90 | | - |
91 | | -task javadocJar(type: Jar, dependsOn: javadoc) { |
92 | | - classifier = 'javadoc' |
93 | | - from javadoc.destinationDir |
94 | | -} |
95 | | - |
96 | | -artifacts { |
97 | | - archives sourcesJar |
98 | | - archives javadocJar |
99 | | -} |
100 | | - |
101 | | - |
102 | | -// Put this at the end or it won't pick up the project.version and stuff |
103 | | -if( project.hasProperty('releaseUser') ) { |
104 | | - apply plugin: 'com.jfrog.bintray' |
105 | | - apply from: 'https://raw.githubusercontent.com/Simsilica/gradle-plugins/master/simtools-release.gradle' |
106 | | -} |
107 | | - |
108 | | - |
| 1 | +/* |
| 2 | + * SimMath build script. |
| 3 | + */ |
| 4 | + |
| 5 | +plugins { |
| 6 | + id 'java-library' |
| 7 | + id 'groovy' |
| 8 | + id 'maven-publish' |
| 9 | + id 'signing' |
| 10 | +} |
| 11 | + |
| 12 | +version='1.5.0' |
| 13 | +group='com.simsilica' |
| 14 | +ext.websiteUrl = 'https://github.com/Simsilica/SimMath' |
| 15 | + |
| 16 | +ext.jmeVersion = "3.1.0-stable" |
| 17 | +ext.slf4jVersion = '1.7.32' |
| 18 | + |
| 19 | +repositories { |
| 20 | + mavenCentral() |
| 21 | +} |
| 22 | + |
| 23 | +dependencies { |
| 24 | + // Pull in jme core for the math package for easy translation to/from JME |
| 25 | + // classes. |
| 26 | + api "org.jmonkeyengine:jme3-core:$jmeVersion" |
| 27 | + |
| 28 | + implementation "org.slf4j:slf4j-api:$slf4jVersion" |
| 29 | + |
| 30 | + testImplementation 'junit:junit:4.12' |
| 31 | + testImplementation 'org.codehaus.groovy:groovy-all:2.4.11' |
| 32 | +} |
| 33 | + |
| 34 | + |
| 35 | +compileJava { // compile-time options: |
| 36 | + options.encoding = 'UTF-8' |
| 37 | + options.compilerArgs << '-Xlint:unchecked' |
| 38 | + options.deprecation = true |
| 39 | + if( JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_10) ) { |
| 40 | + options.release = 7 |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +java { |
| 45 | + sourceCompatibility = 1.7 |
| 46 | + targetCompatibility = 1.7 |
| 47 | + withJavadocJar() |
| 48 | + withSourcesJar() |
| 49 | +} |
| 50 | + |
| 51 | +javadoc { |
| 52 | + // Disable doclint for JDK8+. |
| 53 | + if( JavaVersion.current().isJava8Compatible() ) { |
| 54 | + options.addStringOption('Xdoclint:none', '-quiet') |
| 55 | + } |
| 56 | +} |
| 57 | + |
| 58 | +test { |
| 59 | + testLogging { |
| 60 | + // I want to see the tests that are run and pass, etc. |
| 61 | + events "passed", "skipped", "failed", "standardOut", "standardError" |
| 62 | + } |
| 63 | +} |
| 64 | + |
| 65 | +sourceSets { |
| 66 | + main { |
| 67 | + resources { |
| 68 | + exclude "**/.backups/**" |
| 69 | + } |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +publishing { |
| 74 | + publications { |
| 75 | + library(MavenPublication) { |
| 76 | + from components.java |
| 77 | + pom { |
| 78 | + description = 'A double-based math package similar to JME\'s float-based math classes.' |
| 79 | + developers { |
| 80 | + developer { |
| 81 | + name = 'Paul Speed' |
| 82 | + } |
| 83 | + } |
| 84 | + inceptionYear = '2015' |
| 85 | + licenses { |
| 86 | + license { |
| 87 | + distribution = 'repo' |
| 88 | + name = 'New BSD (3-clause) License' |
| 89 | + url = project.ext.websiteUrl + '/blob/master/license.md' |
| 90 | + } |
| 91 | + } |
| 92 | + name = project.group + ':' + project.name |
| 93 | + scm { |
| 94 | + connection = 'scm:git:git://github.com/Simsilica/SimMath.git' |
| 95 | + developerConnection = 'scm:git:ssh://github.com:Simsilica/SimMath.git' |
| 96 | + url = project.ext.websiteUrl + '/tree/master' |
| 97 | + } |
| 98 | + url = project.ext.websiteUrl |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + // Staging to OSSRH relies on the existence of 2 properties |
| 103 | + // (ossrhUsername and ossrhPassword) |
| 104 | + // which should be stored in ~/.gradle/gradle.properties |
| 105 | + repositories { |
| 106 | + maven { |
| 107 | + credentials { |
| 108 | + username = project.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user' |
| 109 | + password = project.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password' |
| 110 | + } |
| 111 | + name = 'OSSRH' |
| 112 | + |
| 113 | + def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' |
| 114 | + def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots' |
| 115 | + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
| 116 | + |
| 117 | + //url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' |
| 118 | + } |
| 119 | + } |
| 120 | +} |
| 121 | + |
| 122 | +tasks.register('install') { |
| 123 | + dependsOn 'publishToMavenLocal' |
| 124 | + description 'Installs Maven artifacts to the local repository.' |
| 125 | +} |
| 126 | + |
| 127 | + |
| 128 | +// signing tasks |
| 129 | + |
| 130 | +// Signing relies on the existence of 3 properties |
| 131 | +// (signing.keyId, signing.password, and signing.secretKeyRingFile) |
| 132 | +// which should be stored in ~/.gradle/gradle.properties |
| 133 | + |
| 134 | +signing { |
| 135 | + sign publishing.publications |
| 136 | +} |
| 137 | +tasks.withType(Sign) { |
| 138 | + onlyIf { project.hasProperty('signing.keyId') } |
| 139 | +} |
| 140 | + |
| 141 | +// Customize some tasks |
| 142 | +tasks.sourcesJar { |
| 143 | + exclude "**/.backups/**" |
| 144 | +} |
0 commit comments