apply plugin: 'kotlin-platform-common'
//apply plugin: 'application'

//mainClassName = "com.soywiz.korge.tictactoe.TicTacToe"

sourceSets {
	//generated.resources.srcDirs = ['src/generated/resources']
	//main.resources.srcDirs = [ 'src/main/resources' ]
	main.resources.srcDirs = [ 'src/main/resources', 'src/generated/resources' ]
}

/*
sourceSets {
	generated.resources.srcDirs = [ 'genresources' ]

	main.kotlin.srcDirs = [ 'src' ]
	main.resources.srcDirs = [ 'resources', 'genresources' ]
	test.kotlin.srcDirs = [ 'test' ]
}
*/


dependencies {
	compile "com.soywiz:korge-common:$korVersion"
	compile "com.soywiz:korge-ext-swf-common:$korVersion"
	compile "com.soywiz:korau-mp3-common:$korVersion"
	testCompile "com.soywiz:korge-tests-common:$korVersion"
	//compile "com.soywiz:korge:$korVersion"
	//compile "com.soywiz:korge-ext-swf:$korVersion"
	//compile "com.soywiz:korau-mp3:$korVersion"
}

/*
compileKotlin2Js {
	kotlinOptions.outputFile = "${projectDir}/web/output.js"
	//kotlinOptions.moduleKind = "amd"
	kotlinOptions.moduleKind = "umd"
	//kotlinOptions.moduleKind = "commonjs"
	//kotlinOptions.sourceMap = true
	kotlinOptions.sourceMap = false
}


clean {
	delete new File("${projectDir}/web")
}

compileKotlin2Js.doLast {
	configurations.compile.each { File file ->
		copy {
			includeEmptyDirs = false

			from zipTree(file.absolutePath)
			into "${projectDir}/web"
			include { fileTreeElement ->
				def path = fileTreeElement.path
				(path.endsWith(".js") || path.endsWith(".js.map")) && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/"))
			}
		}
	}

	copy {
		from sourceSets.main.resources.srcDirs
		into "${projectDir}/web"
	}
}

jar.enabled = false
*/
//distTar.enabled = false
//distZip.enabled = false


/*
apply from: "../include.gradle"

apply plugin: 'kotlin'
apply plugin: 'application'

mainClassName = "com.soywiz.korge.tictactoe.TicTacToe"

sourceSets {
    generated.resources.srcDirs = [ 'genresources' ]

    main.kotlin.srcDirs = [ 'src' ]
    main.resources.srcDirs = [ 'resources', 'genresources' ]
    test.kotlin.srcDirs = [ 'test' ]
}


dependencies {
    compile "com.soywiz:korge:$korVersion"
    compile "com.soywiz:korge-ext-swf:$korVersion"
    compile "com.soywiz:korau-mp3:$korVersion"
}

jar.enabled = false
distTar.enabled = false
distZip.enabled = false
*/
