Skip to content

Commit 578cca4

Browse files
committed
Major refactor and tidy
Added pom generation for distribution
1 parent 5224716 commit 578cca4

24 files changed

Lines changed: 260 additions & 212 deletions

Jenkinsfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
def checkoutCode() {
44
stage 'checkout'
5-
checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'https://github.com/codesqueak/Z80Processor.git']]]
5+
checkout scm: [$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'https://github.com/codesqueak/Z80Processor.git']]]
66
}
77

88
def build() {
@@ -34,10 +34,10 @@ def jacocoreport() {
3434
stage 'execute Z80 build'
3535

3636
node {
37-
checkoutCode()
38-
build()
39-
test()
40-
junitreport()
41-
findbugsreport()
42-
jacocoreport()
37+
checkoutCode()
38+
build()
39+
test()
40+
junitreport()
41+
findbugsreport()
42+
jacocoreport()
4343
}

build.gradle

Lines changed: 83 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,102 @@ apply plugin: 'java'
1111
apply plugin: 'eclipse'
1212
apply plugin: 'jacoco'
1313
apply plugin: 'findbugs'
14+
apply plugin: 'maven'
1415

1516
sourceCompatibility = javaVersion
1617
targetCompatibility = javaVersion
1718

1819

1920
task setVersion {
20-
if(System.env.BUILD_NUMBER){
21-
version = projectVersionMajor+'.'+projectVersionMinor+'.'+System.env.BUILD_NUMBER
22-
}
23-
else
24-
{
25-
version = projectVersionMajor+'.'+projectVersionMinor+'.'+projectVersionBuild
26-
}
21+
if (System.env.BUILD_NUMBER) {
22+
version = projectVersionMajor + '.' + projectVersionMinor + '.' + System.env.BUILD_NUMBER
23+
} else {
24+
version = projectVersionMajor + '.' + projectVersionMinor + '.' + projectVersionBuild
25+
}
2726
}
2827

2928

3029
jar {
31-
baseName = projectName
32-
manifest
33-
{
34-
attributes 'Implementation-Title': projectName,
35-
'Implementation-Version': version
36-
}
30+
baseName = projectName
31+
manifest
32+
{
33+
attributes 'Implementation-Title': projectName,
34+
'Implementation-Version': version
35+
}
36+
}
37+
38+
39+
task sourcesJar(type: Jar, dependsOn: classes) {
40+
classifier = 'sources'
41+
from sourceSets.main.allSource
42+
}
43+
44+
task javadocJar(type: Jar, dependsOn: javadoc) {
45+
classifier = 'javadoc'
46+
from javadoc.destinationDir
47+
}
48+
49+
task createPom << {
50+
pom
51+
{
52+
project {
53+
name 'Z80'
54+
groupId 'com.codingrodent'
55+
description 'A Z80 Microprocessor core in Java'
56+
url 'https://github.com/codesqueak/Z80Processor.git'
57+
scm {
58+
url 'https://github.com/codesqueak/Z80Processor'
59+
connection 'scm:git:git://github.com/codesqueak/Z80Processor.git'
60+
developerConnection 'scm:git:ssh://github.com:codesqueak/Z80Processor.git'
61+
}
62+
63+
licenses {
64+
license {
65+
name 'The Apache Software License, Version 2.0'
66+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
67+
distribution 'repo'
68+
}
69+
}
70+
developers {
71+
developer {
72+
id 'codesqueak'
73+
name 'codesqueak'
74+
email 'codesqueak@gmail.com'
75+
organizationUrl 'http://www.codesqueak.com'
76+
// organization 'codesqueak'
77+
}
78+
}
79+
}
80+
}.writeTo("$buildDir/libs/" + projectName + "-" + version + ".pom")
3781
}
3882

83+
artifacts {
84+
archives sourcesJar
85+
archives javadocJar
86+
}
3987

4088
repositories {
4189
mavenCentral()
4290
}
4391

4492
jacoco {
45-
toolVersion = "0.7+"
93+
toolVersion = "0.7.7.201606060606"
4694
reportsDir = file("$buildDir/customJacocoReportDir")
4795
}
4896

4997
test
50-
{
51-
maxParallelForks = 1
52-
filter
53-
{
54-
includeTestsMatching "net.codingrodent.microprocessor.*"
55-
}
56-
jacoco {
57-
append = false
58-
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
59-
classDumpFile = file("$buildDir/jacoco/classpathdumps")
60-
}
61-
}
98+
{
99+
maxParallelForks = 1
100+
filter
101+
{
102+
includeTestsMatching "com.codingrodent.microprocessor.*"
103+
}
104+
jacoco {
105+
append = false
106+
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
107+
classDumpFile = file("$buildDir/jacoco/classpathdumps")
108+
}
109+
}
62110

63111
jacocoTestReport {
64112
reports {
@@ -67,13 +115,13 @@ jacocoTestReport {
67115
html.destination "${buildDir}/jacocoHtml"
68116
}
69117
}
70-
118+
71119
findbugs {
72120
toolVersion = "3.+"
73121
sourceSets = [sourceSets.main]
74122
effort = "max"
75123
reportLevel = "high"
76-
findbugsTest.enabled=false
124+
findbugsTest.enabled = false
77125
ignoreFailures = true
78126
}
79127

@@ -83,17 +131,19 @@ tasks.withType(FindBugs) {
83131
html.enabled = false
84132
}
85133
}
86-
134+
87135
check.dependsOn jacocoTestReport
88136
test.dependsOn javadoc
137+
jar.dependsOn createPom
89138
jar.dependsOn setVersion
90139

91140

141+
92142
dependencies {
93-
testCompile("junit:junit:4.+")
94-
testCompile("org.mockito:mockito-all:2.+")
95-
testCompile("com.jayway.jsonpath:json-path-parent:1.+")
96-
testCompile("org.hamcrest:hamcrest-all:1.+")
143+
testCompile("junit:junit:4.12")
144+
testCompile("org.mockito:mockito-all:2.0.2-beta")
145+
// testCompile("com.jayway.jsonpath:json-path-parent:1.+")
146+
testCompile("org.hamcrest:hamcrest-all:1.3")
97147
}
98148

99149
task wrapper(type: Wrapper) {

codeformat.xml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
<code_scheme name="codeformat">
2-
<option name="GENERATE_FINAL_PARAMETERS" value="true" />
3-
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="2" />
4-
<codeStyleSettings language="JAVA">
5-
<option name="KEEP_LINE_BREAKS" value="false" />
6-
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
7-
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
8-
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
9-
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
10-
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
11-
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
12-
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
13-
<arrangement>
14-
<groups>
15-
<group>
16-
<type>GETTERS_AND_SETTERS</type>
17-
<order>KEEP</order>
18-
</group>
19-
<group>
20-
<type>OVERRIDDEN_METHODS</type>
21-
<order>KEEP</order>
22-
</group>
23-
</groups>
24-
</arrangement>
25-
</codeStyleSettings>
2+
<option name="GENERATE_FINAL_PARAMETERS" value="true"/>
3+
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="2"/>
4+
<codeStyleSettings language="JAVA">
5+
<option name="KEEP_LINE_BREAKS" value="false"/>
6+
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false"/>
7+
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/>
8+
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
9+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
10+
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/>
11+
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true"/>
12+
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true"/>
13+
<arrangement>
14+
<groups>
15+
<group>
16+
<type>GETTERS_AND_SETTERS</type>
17+
<order>KEEP</order>
18+
</group>
19+
<group>
20+
<type>OVERRIDDEN_METHODS</type>
21+
<order>KEEP</order>
22+
</group>
23+
</groups>
24+
</arrangement>
25+
</codeStyleSettings>
2626
</code_scheme>

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#
22
# Global properties
33
#
4-
projectName=z80-java
4+
projectName=z80Processor
55
javaVersion=1.8
66
#
7-
projectVersionMajor=1
8-
projectVersionMinor=2
7+
projectVersionMajor=2
8+
projectVersionMinor=0
99
projectVersionBuild=0

src/main/java/net/codingrodent/microprocessor/IBaseDevice.java renamed to src/main/java/com/codingrodent/microprocessor/IBaseDevice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package net.codingrodent.microprocessor;
15+
package com.codingrodent.microprocessor;
1616

1717
/**
1818
* Interface to describe the I/O processor bus

src/main/java/net/codingrodent/microprocessor/ICPU.java renamed to src/main/java/com/codingrodent/microprocessor/ICPU.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package net.codingrodent.microprocessor;
15+
package com.codingrodent.microprocessor;
1616

1717
/**
1818
* Interface to the processor

src/main/java/net/codingrodent/microprocessor/ICPUData.java renamed to src/main/java/com/codingrodent/microprocessor/ICPUData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package net.codingrodent.microprocessor;
15+
package com.codingrodent.microprocessor;
1616

1717
/**
1818
* Interface to describe the processor version

src/main/java/net/codingrodent/microprocessor/IMemory.java renamed to src/main/java/com/codingrodent/microprocessor/IMemory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package net.codingrodent.microprocessor;
15+
package com.codingrodent.microprocessor;
1616

1717
/**
1818
* Interface to describe the memory processor bus

src/main/java/net/codingrodent/microprocessor/ProcessorException.java renamed to src/main/java/com/codingrodent/microprocessor/ProcessorException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package net.codingrodent.microprocessor;
15+
package com.codingrodent.microprocessor;
1616

1717
/**
1818
* Exception thrown under various CPU states that may need exception processing

src/main/java/net/codingrodent/microprocessor/Z80/CPUConstants.java renamed to src/main/java/com/codingrodent/microprocessor/Z80/CPUConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package net.codingrodent.microprocessor.Z80;
15+
package com.codingrodent.microprocessor.Z80;
1616

1717
public class CPUConstants {
1818
// Pre-calculate parity table

0 commit comments

Comments
 (0)