1module IRTS.Java.Pom (pomString) where
3import Data.List (unfoldr)
6uattr :: String -> String -> Attr
7uattr k v = Attr (QName k Nothing Nothing) v
9-- from http://stackoverflow.com/a/4978733/283260
10splitOn :: Eq a => a -> [a] -> [[a]]
11splitOn chr = unfoldr sep where
13 sep l = Just . fmap (drop 1) . break (==chr) $ l
15parseToDep :: String -> Element
17 case splitOn ':' tuple of
18 [g, a, v] -> dependency g a v
21dependency :: String -> String -> String -> Element
22dependency g a v = unode "dependency" (groupArtifactVersion g a v)
24groupArtifactVersion :: String -> String -> String -> [Element]
25groupArtifactVersion g a v = [
31pomString :: String -> String -> [String] -> String
32pomString c a d = ppElement $ pom c a d
34pom :: String -> String -> [String] -> Element
35pom clsName artifactName dependencies = unode "project" ([
36 uattr "xmlns" "http://maven.apache.org/POM/4.0.0",
37 uattr "xmlns:xsi" "http://www.w3.org/2001/XMLSchema-instance",
38 uattr "xsi:schemaLocation" "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
41 unode "modelVersion" "4.0.0",
42 unode "groupId" "org.idris-lang",
43 unode "artifactId" artifactName,
44 unode "packaging" "jar",
45 unode "version" "1.0",
46 unode "name" artifactName,
48 unode "project.build.sourceEncoding" "UTF-8",
49 unode "skipTest" "true"
51 unode "dependencies" (
52 dependency "org.idris-lang" "idris" "0.9.10-alpha-2" :
53 map parseToDep dependencies
56 unode "finalName" artifactName,
59 unode "configuration" [
62 ] : groupArtifactVersion "org.apache.maven.plugins" "maven-compiler-plugin" "3.0"
65 unode "configuration" (
66 unode "skipTests" "${skipTests}"
67 ) : groupArtifactVersion "org.apache.maven.plugins" "maven-surefile-plugin" "2.14"
72 unode "phase" "package",
76 unode "configuration" (
77 unode "transformers" (
79 uattr "implementation" "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer",
80 unode "mainClass" clsName
85 ] : 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