Skip to content

Commit f587593

Browse files
committed
Add Structure101 to Build
Closes gh-620
1 parent 1abcfbd commit f587593

File tree

16 files changed

+238
-8
lines changed

16 files changed

+238
-8
lines changed

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ buildscript {
2222

2323
apply plugin: 'io.spring.convention.root'
2424
apply plugin: 'io.spring.convention.docs'
25+
apply plugin: 's101'
2526

2627
group = "org.springframework.ldap"
2728
description = "Spring LDAP"
@@ -49,4 +50,8 @@ asciidoctor {
4950
options = [
5051
eruby: 'erubis'
5152
]
53+
}
54+
55+
s101 {
56+
configurationDirectory = project.file("etc/s101")
5257
}

buildSrc/src/main/java/s101/S101Configurer.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,21 @@ private boolean deleteDirectory(File directoryToBeDeleted) {
161161
}
162162

163163
private String installBuildTool(File installationDirectory, File configurationDirectory) {
164-
String source = "https://structure101.com/binaries/19159";
164+
String source = "https://structure101.com/binaries/v6";
165165
try (final WebClient webClient = new WebClient()) {
166166
HtmlPage page = webClient.getPage(source);
167+
Matcher matcher = null;
167168
for (HtmlAnchor anchor : page.getAnchors()) {
168-
Matcher matcher = Pattern.compile("(structure101-build-java-all-)(.*).zip").matcher(anchor.getHrefAttribute());
169-
if (matcher.find()) {
170-
copyZipToFilesystem(source, installationDirectory, matcher.group(1) + matcher.group(2));
171-
return matcher.group(2);
169+
Matcher candidate = Pattern.compile("(structure101-build-java-all-)(.*).zip").matcher(anchor.getHrefAttribute());
170+
if (candidate.find()) {
171+
matcher = candidate;
172172
}
173173
}
174-
return null;
174+
if (matcher == null) {
175+
return null;
176+
}
177+
copyZipToFilesystem(source, installationDirectory, matcher.group(1) + matcher.group(2));
178+
return matcher.group(2);
175179
} catch (Exception ex) {
176180
throw new RuntimeException(ex);
177181
}
@@ -233,7 +237,7 @@ private void copyZipToFilesystem(String source, File destination, String name) {
233237
}
234238

235239
private String validateFilename(String filename, String intendedDir)
236-
throws IOException {
240+
throws java.io.IOException {
237241
File f = new File(filename);
238242
String canonicalPath = f.getCanonicalPath();
239243

@@ -263,7 +267,7 @@ private void configureProject(String version, File configurationDirectory) {
263267
private void copyToProject(String location, File destination) {
264268
Resource resource = new ClassPathResource(location);
265269
try (InputStream is = resource.getInputStream();
266-
OutputStream os = new FileOutputStream(destination)) {
270+
OutputStream os = new FileOutputStream(destination)) {
267271
IOUtils.copy(is, os);
268272
} catch (IOException ex) {
269273
throw new UncheckedIOException(ex);

etc/s101/config.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<headless version="1.0">
3+
<operations>
4+
<operation type="publish">
5+
<argument name="overwrite" value="true"/>
6+
<argument name="diagrams" value="true"/>
7+
</operation>
8+
<operation type="check-key-measures">
9+
<argument name="baseline" value="baseline"/>
10+
<argument name="useProjectFileSpec" value="true"/>
11+
<argument name="useProjectFileDiagrams" value="true"/>
12+
<argument name="fail-on-architecture-violations" value="false"/>
13+
<argument name="fail-on-fat-package" value="false"/>
14+
<argument name="fail-on-fat-class" value="false"/>
15+
<argument name="fail-on-fat-method" value="false"/>
16+
<argument name="fail-on-feedback-dependencies" value="true"/>
17+
<argument name="fail-on-spec-violation-dependencies" value="false"/>
18+
<argument name="fail-on-total-problem-dependencies" value="false"/>
19+
<argument name="fail-on-spec-item-violations" value="false"/>
20+
<argument name="fail-on-biggest-class-tangle" value="true"/>
21+
<argument name="fail-on-tangled-package" value="true"/>
22+
<argument name="fail-on-architecture-violations" value="false"/>
23+
<argument name="fail-on-total-problem-dependencies" value="true"/>
24+
<argument name="identifier-on-violation" value="S101 key measure violation"/>
25+
</operation>
26+
</operations>
27+
<arguments>
28+
<argument name="local-project" value="const(THIS_FILE)/project.java.hsp"/>
29+
<argument name="repository" value="const(THIS_FILE)/repository"/>
30+
<argument name="project" value="snapshots"/>
31+
</arguments>
32+
</headless>

etc/s101/project.java.hsp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<local-project language="java" version="6.1.19172" xml-version="3" flavor="j2se">
3+
<property name="show-as-module" value="false" />
4+
<property name="publish-architecture-artifacts" value="true" />
5+
<property name="force-classpath" value="false" />
6+
<property name="project-type" value="classpath" />
7+
<property name="hide-externals" value="true" />
8+
<property name="parse-archive-in-archive" value="false" />
9+
<property name="include-injected-dependency" value="false" />
10+
<property name="relative-to" value="const(THIS_FILE)/.." />
11+
<property name="action-set-mod" value="1" />
12+
<property name="detail-mode" value="true" />
13+
<property name="hide-deprecated" value="false" />
14+
<property name="resolve-name-clashes" value="true" />
15+
<property name="project-excluded" />
16+
<property name="show-needs-to-compile" value="false" />
17+
<classpath>
18+
<classpathentry kind="lib" path="core/build/classes/java/main" module="spring-ldap-core" />
19+
<classpathentry kind="lib" path="core-tiger/build/classes/java/main" module="spring-ldap-core-tiger" />
20+
<classpathentry kind="lib" path="ldif/ldif-core/build/classes/java/main" module="spring-ldap-ldif-core" />
21+
<classpathentry kind="lib" path="odm/build/classes/java/main" module="spring-ldap-odm" />
22+
<classpathentry kind="lib" path="samples/plain/build/classes/java/main" module="spring-ldap-plain-sample" />
23+
<classpathentry kind="lib" path="sandbox/build/classes/java/main" module="spring-ldap-sandbox" />
24+
<classpathentry kind="lib" path="test-support/build/classes/java/main" module="spring-ldap-test" />
25+
</classpath>
26+
<pom-root-files />
27+
<modules-in-scope />
28+
<restructuring>
29+
<set version="3" name="Action list 1" hiview="Codemap" active="true" todo="false" list="0" />
30+
</restructuring>
31+
<grid-set sep="." version="6.1.19172" />
32+
</local-project>

etc/s101/repository/repository.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<structure101-repository language="java" version="19172">
3+
<xs-configuration>
4+
<entry metric="Tangled" scope="design" threshold="0" color="153,53,0" />
5+
<entry metric="Fat" scope="design" threshold="120" color="255,153,0" />
6+
<entry metric="Fat" scope="leaf package" threshold="120" color="0,153,153" />
7+
<entry metric="Fat" scope="class" threshold="120" color="255,153,153" />
8+
<entry metric="Fat" scope="method" threshold="15" color="51,255,51" />
9+
</xs-configuration>
10+
<!--Note: All date strings are stored in short US format e.g. 2/1/06 for 1st Feb 2006-->
11+
<project name="snapshots" dir="snapshots" baselineSnapshot="default" version="19172">
12+
<snapshot label="baseline" location="baseline" timestamp="1/19/22, 8:43 AM" version="19172" detail="true" good="true" size="501" />
13+
</project>
14+
</structure101-repository>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x�]N;
2+
1��0L��bc�q��B2j If��w�,����"t�-�L8nw�]�!?o����q�2�����\UQ�4�_r��mb“% �&0"<C�&<�ɾ��]}��R|!���,B}0,�����A7+
104 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)