plugins {
	//id 'java'
    id 'eclipse'
    //id 'distribution'
    id 'application'    //includes java
	id 'org.springframework.boot' version '3.4.2'
	id 'io.spring.dependency-management' version '1.1.7'
}

group = 'unibo.disi'
version = '1.0'

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(17)
	}
}

repositories {
	mavenCentral()
	flatDir {   dirs '../unibolibs'	 }
}

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

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.springframework.boot:spring-boot-starter-websocket'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
 	testImplementation 'org.springframework.boot:spring-boot-starter-test'
 	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

    //testImplementation 'junit:junit:4.13.2'
   /* JSON ********************************************************************************* */
     implementation 'com.googlecode.json-simple:json-simple:1.1.1'

	//SOCKET.IO (for WEnv)
    implementation group: 'javax.websocket', name: 'javax.websocket-api', version: '1.1'
    //javax.websocket api is only the specification
    implementation group: 'org.glassfish.tyrus.bundles', name: 'tyrus-standalone-client', version: '1.9'

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

}

 /*
task run(type: JavaExec){
	classpath = sourceSets.main.runtimeClasspath
	mainClass = "unibo.disi.conwaygui.ConwayguiApplication"
}


distributions {
    main {
        contents {
            from 'src/main/resources'
            from 'build/libs'
        }
    }
}
 
 */
application {
    //Define the main class for the application.
    mainClassName    = 'unibo.disi.conwaygui.ConwayguiApplication'
}

 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': "unibo.disi.conwaygui.ConwayguiApplication"
    }
}


tasks.named('test') {
	useJUnitPlatform()
}
