aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 1d4261630bf6e89e014eca794bcd3a637089bbdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
plugins {
    id 'application'
    id 'jacoco'
    id 'checkstyle'
}

application {
	mainClass = 'ui.Main'
}

repositories {
    mavenCentral()
}

sourceSets {
	main {
		java {
			srcDirs 'src/main/'
		}
		resources {
			srcDirs 'src/resources/'
		}
	}
	test {
		java {
			srcDirs 'src/test/'
		}
    }
}

dependencies {
	implementation files('lib/spec/flatlaf-3.2.5.jar')
	implementation files('lib/spec/flatlaf-intellij-themes-3.2.5.jar')
	implementation files('lib/spec/json-20231013.jar')
	implementation files('lib/spec/zxing-3.5.2.jar')

	testImplementation files('lib/apiguardian-api-1.1.2.jar')
	testImplementation files('lib/junit-jupiter-5.8.1.jar')
	testImplementation files('lib/junit-jupiter-api-5.8.1.jar')
	testImplementation files('lib/junit-jupiter-engine-5.8.1.jar')
	testImplementation files('lib/junit-jupiter-params-5.8.1.jar')
	testImplementation files('lib/junit-platform-commons-1.8.1.jar')
	testImplementation files('lib/junit-platform-engine-1.8.1.jar')
    testImplementation files('lib/opentest4j-1.2.0.jar')
}

test {
    dependsOn checkstyleMain
    useJUnitPlatform()
    finalizedBy jacocoTestReport 
}

jacoco {
    toolVersion = "0.8.8"
}

jacocoTestReport {
    dependsOn test
    reports {
        xml.required = false
        csv.required = false
        html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
    }
    afterEvaluate {
        classDirectories = files(classDirectories.files.collect {
            fileTree(dir: it, exclude: ['ui/**'])
        })
    }
}

tasks.withType(Checkstyle) {
    reports {
        xml.required = false
        html.required = true
        configFile file('checkstyle.xml')
    }
}

tasks.register('uml') {
    doFirst {
        renderUML("all")
        renderUML("type")
        renderUML("assoc")
    }

    dependsOn project(':umlgen').build
}

ext.renderUML = { scope ->
    def output = new ByteArrayOutputStream()
    javaexec {
        classpath = project(':umlgen').sourceSets.main.runtimeClasspath
        mainClass = 'moe.yuuta.umlgen.Main'
        standardOutput = output
        args "${sourceSets.main.java.srcDirs[1]}", scope
    }
    def dot = output.toByteArray()
    out.close()
    def input = new ByteArrayInputStream(dot)
    output = new FileOutputStream("${rootDir}/arts/uml.${scope}.pdf")
    exec {
        commandLine 'dot', '-Tpdf'
        standardInput = input
        standardOutput = output
    }
    input.close()
    output.close()
}