1module IRTS.Java.Pom (pomString) where
3import Data.List (unfoldr)
6-----------------------------------------------------------------------
7-- String <-> XML processing
9uattr :: String -> String -> Attr
10uattr k v = Attr (QName k Nothing Nothing) v
12-- from http://stackoverflow.com/a/4978733/283260
13splitOn :: Eq a => a -> [a] -> [[a]]
14splitOn chr = unfoldr sep where
16 sep l = Just . fmap (drop 1) . break (==chr) $ l
18parseToDep :: String -> Element
20 case splitOn ':' tuple of
21 [g, a, v] -> dependency g a v
24dependency :: String -> String -> String -> Element
25dependency g a v = unode "dependency" (groupArtifactVersion g a v)
27groupArtifactVersion :: String -> String -> String -> [Element]
28groupArtifactVersion g a v = [
34pomString :: String -> String -> [String] -> String
35pomString c a d = ppElement $ pom c a d
37-----------------------------------------------------------------------
38-- The pom template for idris projects
40pom :: String -> String -> [String] -> Element
41pom clsName artifactName dependencies = unode "project" ([
42 uattr "xmlns" "http://maven.apache.org/POM/4.0.0",
43 uattr "xmlns:xsi" "http://www.w3.org/2001/XMLSchema-instance",
44 uattr "xsi:schemaLocation" "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
47 unode "modelVersion" "4.0.0",
48 unode "groupId" "org.idris-lang",
49 unode "artifactId" artifactName,
50 unode "packaging" "jar",
51 unode "version" "1.0",
52 unode "name" artifactName,
54 unode "project.build.sourceEncoding" "UTF-8",
55 unode "skipTest" "true"
57 unode "dependencies" (
58 dependency "org.idris-lang" "idris" "0.9.14" :
59 map parseToDep dependencies
62 unode "finalName" artifactName,
65 unode "configuration" [
68 ] : groupArtifactVersion "org.apache.maven.plugins" "maven-compiler-plugin" "3.0"
71 unode "configuration" (
72 unode "skipTests" "${skipTests}"
73 ) : groupArtifactVersion "org.apache.maven.plugins" "maven-surefile-plugin" "2.14"
78 unode "phase" "package",
82 unode "configuration" (
83 unode "transformers" (
85 uattr "implementation" "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer",
86 unode "mainClass" clsName
91 ] : groupArtifactVersion "org.apache.maven.plugins" "maven-shade-plugin" "2.1"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list