Added gradle wrapper task and updated gradle. Updated project dependency structure

This commit is contained in:
nathan 2018-09-25 19:57:10 +02:00
parent 55f6ef3a1e
commit 51b369eab3
2 changed files with 56 additions and 41 deletions

View File

@ -65,8 +65,7 @@ apply plugin: "com.dorkbox.Licensing"
// give us access to api/implementation differences for building java libraries
apply plugin: 'java-library'
// Utilities project shared configuration
apply from: '../Utilities/scripts/gradle/utilities.gradle'
project.description = 'Unbuffered input and ANSI output support for Linux, MacOS, or Windows for Java 6+'
project.group = 'com.dorkbox'
@ -76,8 +75,8 @@ project.ext.name = 'Console'
project.ext.url = 'https://git.dorkbox.com/dorkbox/Console'
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
licensing {
@ -124,44 +123,13 @@ licensing {
}
sourceSets {
utilities {
java {
setSrcDirs Collections.singletonList('../Utilities/src')
include javaFile('dorkbox.util.OS',
'dorkbox.util.OSType',
'dorkbox.util.Property',
'dorkbox.util.FastThreadLocal',
'dorkbox.util.bytes.ByteBuffer2',
'dorkbox.util.jna.JnaHelper',
'dorkbox.util.jna.windows.Kernel32',
'dorkbox.util.jna.windows.structs.CONSOLE_SCREEN_BUFFER_INFO',
'dorkbox.util.jna.windows.structs.INPUT_RECORD',
'dorkbox.util.jna.windows.structs.SMALL_RECT',
'dorkbox.util.jna.windows.structs.COORD',
'dorkbox.util.jna.windows.structs.MOUSE_EVENT_RECORD',
'dorkbox.util.jna.windows.structs.KEY_EVENT_RECORD',
'dorkbox.util.jna.windows.structs.CharUnion',
'dorkbox.util.jna.linux.CLibraryPosix',
'dorkbox.util.jna.linux.structs.Termios')
}
}
main {
java {
setSrcDirs Collections.singletonList('src')
srcDir utilities.java
}
}
}
project.afterEvaluate {
sourceSets.remove(sourceSets.utilities)
}
repositories {
mavenLocal() // this must be first!
@ -170,8 +138,11 @@ repositories {
dependencies {
// utilities dependencies compile only (this is so the IDE can compile the util source)
compileOnly project.ext['utilities']
// utilities dependencies compile only
compileOnly(project('Utilities'))
// our main dependencies are ALSO the same as the limited utilities (they are not automatically pulled in from other sourceSets)
// needed by the utilities (custom since we don't want to include everything). IntelliJ includes everything, but our builds do not
api 'net.java.dev.jna:jna:4.5.2'
api 'net.java.dev.jna:jna-platform:4.5.2'
@ -192,24 +163,59 @@ tasks.withType(Jar) {
manifest {
attributes['Implementation-Version'] = version
attributes['Build-Date'] = Instant.now().toString()
attributes['Automatic-Module-Name'] = project.ext.name.toString()
}
}
///////////////////////////////
////// UTILITIES COMPILE (for inclusion into jars)
///////////////////////////////
static String[] javaFile(String... fileNames) {
static String[] utilFiles(String... fileNames) {
def fileList = [] as ArrayList
for (name in fileNames) {
def fixed = name.replace('.', '/') + '.java'
fileList.add('../Utilities/src/' + fixed)
fileList.add(fixed)
}
return fileList
}
task compileUtils(type: JavaCompile) {
// we don't want the default include of **/*.java
getIncludes().clear()
source = Collections.singletonList('../Utilities/src')
include utilFiles('dorkbox.util.OS',
'dorkbox.util.OSType',
'dorkbox.util.Property',
'dorkbox.util.FastThreadLocal',
'dorkbox.util.bytes.ByteBuffer2',
'dorkbox.util.jna.JnaHelper',
'dorkbox.util.jna.windows.Kernel32',
'dorkbox.util.jna.windows.structs.CONSOLE_SCREEN_BUFFER_INFO',
'dorkbox.util.jna.windows.structs.INPUT_RECORD',
'dorkbox.util.jna.windows.structs.SMALL_RECT',
'dorkbox.util.jna.windows.structs.COORD',
'dorkbox.util.jna.windows.structs.MOUSE_EVENT_RECORD',
'dorkbox.util.jna.windows.structs.KEY_EVENT_RECORD',
'dorkbox.util.jna.windows.structs.CharUnion',
'dorkbox.util.jna.linux.CLibraryPosix',
'dorkbox.util.jna.linux.structs.Termios')
classpath = sourceSets.main.compileClasspath
destinationDir = file("$rootDir/build/classes_utilities")
}
jar {
dependsOn compileUtils
// include applicable class files from subset of Utilities project
from compileUtils.destinationDir
}
/////////////////////////////
//// Maven Publishing + Release
@ -288,7 +294,6 @@ nexusStaging {
}
signing {
required {hasProperty('sonatypeUsername')}
sign publishing.publications.maven
}

View File

@ -13,4 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
include("Utilities")
for (project in rootProject.children) {
project.projectDir = file("../$project.name")
project.buildFileName = "utilities.gradle"
assert (project.projectDir.directory)
assert (project.buildFile.file)
}
enableFeaturePreview('STABLE_PUBLISHING')