Skip to content

Commit

Permalink
Merge pull request #74 from j256/generate-magic-gz-at-compile
Browse files Browse the repository at this point in the history
Generate the magic.gz file at compilation time.
  • Loading branch information
j256 authored Oct 20, 2020
2 parents 211cf35 + 44c1e6f commit 074a1fd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
8 changes: 8 additions & 0 deletions gzip_magic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Script called by ant from mvn to compress our magic file into place
#

echo "Generating compressed magic file: $2"

set -x
gzip -9 -c $1 > $2
41 changes: 40 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<!-- simplemagic pom configuration file for Maven (https://maven.apache.org/) -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.j256.simplemagic</groupId>
Expand Down Expand Up @@ -190,6 +191,31 @@
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>gzip-magic</id>
<phase>compile</phase>
<configuration>
<target>
<!-- couldn't use the gzip plugin because no level and couldn't call gzip directly because the output linefeeds were
corrupting the gzip stream. -->
<exec executable="sh">
<arg value="${project.basedir}/gzip_magic.sh" />
<arg value="${project.basedir}/src/test/resources/magic" />
<arg value="${project.build.outputDirectory}/magic.gz" />
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand All @@ -214,6 +240,19 @@
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.3,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
Expand Down
Binary file removed src/main/resources/magic.gz
Binary file not shown.

0 comments on commit 074a1fd

Please sign in to comment.