/*
 * This file was generated by the Gradle 'init' task and
 * modified by the application designer
 */
plugins {
    //The application plugin is deprecated.
    id 'application'
    //id 'java'
    id 'eclipse'
}
    
version '1.0'
 
java {
    toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
    flatDir {   dirs '../unibolibs' } //, './myLibs' 
}

sourceSets {
    main {
        java {
            srcDirs = ['src/main/java']
        }
        resources {
            srcDirs = ['src/main/resources']
        }
    }
    test {
        java {
            srcDirs = ['src/test/java']
        }
        resources {
            srcDirs = ['src/test/resources']
        }
    }
}


dependencies {
    //Specifica che la dipendenza JUnit 4 è necessaria solo per la compilazione e l'esecuzione dei test
	 testImplementation 'junit:junit:4.13.2'
	 
	 implementation 'org.slf4j:slf4j-jdk14:2.0.13'
	 
	 /* JSON ******************************************** */
    // https://mvnrepository.com/artifact/org.json/json
    implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    implementation group: 'org.json', name: 'json', version: '20180130'
	 
    /*  MQTT *******************************************************************************  */
    // https://mvnrepository.com/artifact/org.eclipse.paho/org.eclipse.paho.client.mqttv3
    implementation group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version: '1.2.5'
	 
	//Added since some library does use logs
    implementation 'ch.qos.logback:logback-classic:1.2.11'   

	//WSSOCKET: added to optimize with OutWs
     implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.6.0'
	 

    /* UNIBO *************************** */
    implementation name: 'uniboInterfaces'
    implementation name: '2p301'
    implementation name: 'unibo.basicomm23-1.0' 


}

application {
    //Define the main class for the application.
    mainClassName    = 'conwayMqtt.MainConwayMqtt'
}

/*
task run(type: JavaExec){
	classpath = sourceSets.main.runtimeClasspath
	mainClass = "conwayMqtt.MainConwayMqtt"
}

*/

 jar {
    println("building jar")
    duplicatesStrategy = duplicatesStrategy.EXCLUDE //per via di locgback.xml quando si usa spring
    from sourceSets.main.allSource
    from('./') {
      include '*.pl' 
      include '*.json'
    }
    manifest {
        attributes 'Main-Class': "conwayMqtt.MainConwayMqtt"
    }
}


/*
Sulla presenza di una ulteriore directry src
 Eclipse potrebbe aver configurato la directory src 
 come una directory sorgente nel build path del progetto.
 
 Questo può accadere se il progetto è stato importato in Eclipse prima di essere 
 configurato correttamente come progetto Gradle.
*/