Skip to content

Commit

Permalink
Include editorconfig-checker to complement `editorconfig-gradle-plu…
Browse files Browse the repository at this point in the history
…gin`.

`editorconfig-gradle-plugin` doesn't have sufficient support for `.editorconfig` properties: https://github.com/ec4j/editorconfig-gradle-plugin#how-it-works

`editorconfig-checker` has been added in version 2.4.0 for linux amd64: https://github.com/editorconfig-checker/editorconfig-checker/releases/tag/2.4.0

See also metafacture/metafacture-fix#179.
  • Loading branch information
blackwinter committed Feb 9, 2024
1 parent e8fea3f commit 6375a07
Show file tree
Hide file tree
Showing 27 changed files with 451 additions and 456 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ trim_trailing_whitespace = true
end_of_line = crlf
trim_trailing_whitespace = false

[*.{gradle,yml}]
[*.{g,gradle,json,xml,xsd,yml}]
indent_size = 2

[metafacture-io/src/test/resources/org/metafacture/io/compressed.txt]
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ tmp
.classpath
.project
.settings/
bin/

# Ignore IntelliJ project files:
*.ipr
Expand Down
56 changes: 28 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,43 +180,43 @@ We use semantic versioning in release numbers `A`.`B`.`C`, i.e. increase `A` whe
The following commands trigger a release build.

1. Create a signed tag:
```
git tag -s metafacture-core-A.B.C
```
```
git tag -s metafacture-core-A.B.C
```
1. When prompted, add a sensible commit message. For instance, something like:
```
Publish first release of the Metafacture A line
```
```
Publish first release of the Metafacture A line
```
1. You can now test the build locally by invoking:
```
./gradlew assemble
```
```
./gradlew assemble
```
1. Finally, push the new tag to GitHub to trigger the actual release build:
```
git push --follow-tags metafacture-core-A.B.C
```
```
git push --follow-tags metafacture-core-A.B.C
```
#### Publish to Maven Central
Upload archives to sonatype (where they can be released to Maven Central)
1. Make sure to have a clean directory (otherwise only a SNAPSHOT will be built):
```
git status
```
```
git status
```
1. You need a `gradle.properties` in the root directory that looks like this:
```
signing.gnupg.executable=gpg
signing.gnupg.useLegacyGpg=true
signing.gnupg.homeDir=$e.g."~/.gnupg"
signing.gnupg.keyName=$yourKeyName
signing.gnupg.passphrase=$keysPassphrase
releaseRepositoryUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
releaseRepositoryUser=$yourSonatypeUsername
releaseRepositoryPassword=$yourSonatypePassword
```
```
signing.gnupg.executable=gpg
signing.gnupg.useLegacyGpg=true
signing.gnupg.homeDir=$e.g."~/.gnupg"
signing.gnupg.keyName=$yourKeyName
signing.gnupg.passphrase=$keysPassphrase
releaseRepositoryUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
releaseRepositoryUser=$yourSonatypeUsername
releaseRepositoryPassword=$yourSonatypePassword
```
1. Let the release be built, signed and uploaded:
```
./gradlew publishAllPublicationsToMavenRepository
```
```
./gradlew publishAllPublicationsToMavenRepository
```
1. Finally, go to oss.sonatype.org , check the `Staging Repositories` when it's finished, and release it by clicking `close`
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ If you are only interested in running Flux scripts without doing any Java progra
1. Download the latest distribution package from the [release page](https://github.com/metafacture/metafacture-core/releases). Make sure that you do download a distribution package and *not* a source code package (the file name should include `*-dist*`).

2. Extract the downloaded archive:
```bash
$ tar xzf metafacture-core-$VERSION-dist.tar.gz
```
This will create a new directory containing a ready-to-use Metafacture distribution.
```bash
$ tar xzf metafacture-core-$VERSION-dist.tar.gz
```
This will create a new directory containing a ready-to-use Metafacture distribution.
3. Change into the newly created directory:
```bash
$ cd metafacture-core-$VERSION
```
```bash
$ cd metafacture-core-$VERSION
```
4. Run one of the example scripts:
```bash
$ ./flux.sh examples/read/marc21/read-marc21.flux
```
This example will print a number of MARC 21 records on standard output.
```bash
$ ./flux.sh examples/read/marc21/read-marc21.flux
```
This example will print a number of MARC 21 records on standard output.

The `examples` folder contains many more examples which provide a good starting point for learning Metafacture. If you have any questions please join our [mailing list](http://lists.dnb.de/mailman/listinfo/metafacture) or use our issue-based discussion forum over at [metafacture-documentation](https://github.com/metafacture/metafacture-documentation).

Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,18 @@ editorconfig {
]
}

task editorconfigChecker(type: Exec, group: 'Verification') {
executable 'misc/bin/editorconfig-checker'
args('-exclude', '/\\.|/bin/|\\.beacon$|\\.txt\\.|^LICENSE$|^\\.project$|^gradlew.*')
}

subprojects {
apply plugin: 'signing'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'maven-publish'

editorconfigCheck.dependsOn(editorconfigChecker)
check.dependsOn(editorconfigCheck)
check.dependsOn(javadoc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ private void emitAsSingleMultiscriptFields(final Map<?, BufferedField> fields) {

private String mapScriptToEntityName(final String script) {
return LATIN_SCRIPT.equals(script) ? ENTITY_NAME_FOR_LATIN :
(ARABIC_SCRIPT.equals(script) || HEBREW_SCRIPT.equals(script)) ? ENTITY_NAME_FOR_NON_LATIN_RL :
ENTITY_NAME_FOR_NON_LATIN_LR;
(ARABIC_SCRIPT.equals(script) || HEBREW_SCRIPT.equals(script)) ? ENTITY_NAME_FOR_NON_LATIN_RL : ENTITY_NAME_FOR_NON_LATIN_LR;
}

private static class BufferedField {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ public void setNoQuotes(final boolean noQuotes) {
private void initialize() {
writer = new StringWriter();
final String emptyLineEnd = "";
csvWriter = new CSVWriter(writer, separator,
noQuotes ? CSVWriter.NO_QUOTE_CHARACTER : CSVWriter.DEFAULT_QUOTE_CHARACTER,
CSVWriter.DEFAULT_ESCAPE_CHARACTER, emptyLineEnd);
csvWriter = new CSVWriter(writer, separator, noQuotes ? CSVWriter.NO_QUOTE_CHARACTER : CSVWriter.DEFAULT_QUOTE_CHARACTER, CSVWriter.DEFAULT_ESCAPE_CHARACTER, emptyLineEnd);
}

private String[] arrayOf(final List<String> list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,39 @@
*/
public final class ObjectThreaderTest {

@Mock
private ObjectReceiver<String> receiverThread1;
@Mock
private ObjectReceiver<String> receiverThread2;
@Mock
private ObjectReceiver<String> receiverThread1;
@Mock
private ObjectReceiver<String> receiverThread2;

private final ObjectThreader<String> objectThreader = new ObjectThreader<>();
private static final int ACTIVE_THREADS_AT_BEGINNING = Thread.getAllStackTraces().keySet().size();
private final ObjectThreader<String> objectThreader = new ObjectThreader<>();
private static final int ACTIVE_THREADS_AT_BEGINNING = Thread.getAllStackTraces().keySet().size();

@Before
public void setup() {
MockitoAnnotations.initMocks(this);
objectThreader//
.addReceiver(receiverThread1)//
.addReceiver(receiverThread2);
}
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
objectThreader//
.addReceiver(receiverThread1)//
.addReceiver(receiverThread2);
}

@Test
public void shouldSplitAllObjectsToAllThreadedDownStreamReceivers() throws InterruptedException {
objectThreader.process("a");
objectThreader.process("b");
objectThreader.process("a");
objectThreader.process("c");
// check if two more threads were indeed created
assertThat(Thread.getAllStackTraces().keySet().size() - ACTIVE_THREADS_AT_BEGINNING).isEqualTo(2);
objectThreader.closeStream();
// verify thread 1
verify(receiverThread1, atLeast(2)).process("a");
verify(receiverThread1, atMost(0)).process("b");
verify(receiverThread1, atMost(0)).process("c");
// verify thread 2
verify(receiverThread2, atMost(0)).process("a");
verify(receiverThread2, atLeast(1)).process("b");
verify(receiverThread2, atLeast(1)).process("c");
}
@Test
public void shouldSplitAllObjectsToAllThreadedDownStreamReceivers() throws InterruptedException {
objectThreader.process("a");
objectThreader.process("b");
objectThreader.process("a");
objectThreader.process("c");
// check if two more threads were indeed created
assertThat(Thread.getAllStackTraces().keySet().size() - ACTIVE_THREADS_AT_BEGINNING).isEqualTo(2);
objectThreader.closeStream();
// verify thread 1
verify(receiverThread1, atLeast(2)).process("a");
verify(receiverThread1, atMost(0)).process("b");
verify(receiverThread1, atMost(0)).process("c");
// verify thread 2
verify(receiverThread2, atMost(0)).process("a");
verify(receiverThread2, atLeast(1)).process("b");
verify(receiverThread2, atLeast(1)).process("c");
}

}
Loading

0 comments on commit 6375a07

Please sign in to comment.