Skip to content

Instantly share code, notes, and snippets.

@flypenguin

flypenguin/Makefile

Created Apr 16, 2020
Embed
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<!--
DOKUMENTATION:
https://camel.apache.org/manual/latest/spring.html
-->
<routes xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file:from_here"/>
<to uri="file:to_here"/>
</route>
<route>
<from uri="file:and_from_here"/>
<to uri="file:to_here_as_well"/>
</route>
</routes>
import org.apache.camel.main.Main;
public final class CamelPusher {
private CamelPusher() {
}
public static void main(String[] args) throws Exception {
Main camelMain = new Main();
// https://is.gd/P8SzKX
camelMain.configure().withXmlRoutes("file:*.xml");
camelMain.run(args);
}
}
all: clean build prepare-test test
.PHONY: all
clean:
rm -rf tmp
.PHONY: clean
build:
mvn package
.PHONY: build
prepare-test: clean
mkdir -p tmp/from_here tmp/to_here tmp/and_from_here tmp/to_here_as_well
echo deeply > tmp/from_here/i-want-to-be-moved.txt
echo deeply > tmp/and_from_here/hashtag-metoo.txt
cp target/camelocclient-SNAPSHOT.jar tmp/
cp test-config.xml tmp/
.PHONY: test
test:
cd tmp; pwd; java -cp . -jar camelocclient-SNAPSHOT.jar
.PHONY: test
run: test
.PHONY: run
.PHONY: _git_dirtycheck
_git_dirtycheck:
[[ ! -z "git status -s" ]] || (echo -e "\n\n***** working dir is dirty. *****\n\n" && false)
.PHONY: _major
_major: _git_dirtycheck
mvn build-helper:parse-version \
versions:set \
-DnewVersion=\$${parsedVersion.nextMajorVersion}.0.0 \
versions:commit
.PHONY: _minor
_minor: _git_dirtycheck
mvn build-helper:parse-version \
versions:set \
-DnewVersion=\$${parsedVersion.majorVersion}.\$${parsedVersion.nextMinorVersion}.0 \
versions:commit
.PHONY: _patch
_patch: _git_dirtycheck
mvn build-helper:parse-version \
versions:set \
-DnewVersion=\$${parsedVersion.majorVersion}.\$${parsedVersion.minorVersion}.\$${parsedVersion.nextIncrementalVersion} \
versions:commit
.PHONY: _set_version
_set_version: _git_dirtycheck
read -p "new version: " VERSION ; \
mvn build-helper:parse-version \
versions:set \
-DnewVersion=$$VERSION \
versions:commit
.PHONY: _snap
_snap: _git_dirtycheck
mvn build-helper:parse-version \
versions:set \
-DnewVersion=\$${parsedVersion.majorVersion}.\$${parsedVersion.minorVersion}.\$${parsedVersion.nextIncrementalVersion}-SNAPSHOT \
versions:commit
.PHONY: _tag
_tag:
git commit -am "Version bump"
mvn build-helper:parse-version exec:exec
.PHONY: _snap_tag
_snap_tag: _snap _tag
.PHONY: _addsnap
_addsnap:
mvn build-helper:parse-version \
versions:set \
-DnewVersion=\$${parsedVersion.majorVersion}.\$${parsedVersion.minorVersion}.\$${parsedVersion.incrementalVersion}-SNAPSHOT \
versions:commit
.PHONY: _release
_release: _git_dirtycheck
mvn build-helper:parse-version \
versions:set \
-DnewVersion=\$${parsedVersion.majorVersion}.\$${parsedVersion.minorVersion}.\$${parsedVersion.incrementalVersion} \
versions:commit
.PHONY: major
major: _major _tag build _snap_tag
.PHONY: minor
minor: _minor _tag build _snap_tag
.PHONY: patch
patch: _patch _tag build _snap_tag
.PHONY: addsnap
addsnap: _addsnap
.PHONY: rel
rel: _release _tag build _snap_tag
.PHONY: release
release: rel
.PHONY: set-version
set-version: _set_version _tag build _snap_tag
.PHONY: setver
setver: set-version
<?xml version="1.0" encoding="utf-8"?>
<ruleset comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0
http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<ignoreVersion type="regex">.*\.Beta\d*</ignoreVersion>
<ignoreVersion type="regex">.*-beta\d*</ignoreVersion>
<ignoreVersion type="regex">.*-b\d+</ignoreVersion>
<ignoreVersion type="regex">.*\.Alpha\d*</ignoreVersion>
<ignoreVersion type="regex">.*-alpha\d*</ignoreVersion>
<ignoreVersion type="regex">.*-rc\d*</ignoreVersion>
<ignoreVersion type="regex">.*\.M\d+</ignoreVersion>
</ignoreVersions>
<rules>
<rule groupId="*.maven" comparisonMethod="mercury"/>
</rules>
</ruleset>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.company.business</groupId>
<artifactId>camelocclient</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>CamelOCClient</name>
<description>The thing that transfers payment files to OC</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<!-- spring boot only, but still helpful for that piece of shit called
maven: https://is.gd/RkZyRO , https://is.gd/1kgWAr -->
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ftp</artifactId>
<version>3.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-spring -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>3.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<allowMajorUpdates>false</allowMajorUpdates>
<!-- https://stackoverflow.com/a/22174801/902327 -->
<!-- fucking maven shit honestly those java assholes suck so badly -->
<rulesUri>file:///${project.basedir}/pom-versions-ruleset.xml</rulesUri>
</configuration>
</plugin>
<plugin>
<!-- see here: https://is.gd/HNFI0H -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.12.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution> <!-- Run our version calculation script -->
<id>git-tag</id>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>git</executable>
<arguments>
<argument>tag</argument>
<argument>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}${parsedVersion.qualifier?}</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- I FUCKING HATE MAVEN. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.