Skip to content

Commit 69be9a4

Browse files
author
Alexander Lippling
committed
Project files can be loaded, modified and saved. See UsageExamples.java.
Change-Id: I76b578bd419dc1aeba063ca841ae2bfe44b0db61
1 parent 73431a6 commit 69be9a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2801
-51
lines changed

pom.xml

Lines changed: 51 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,53 @@
1-
<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">
2-
<modelVersion>4.0.0</modelVersion>
3-
<groupId>com.sap.prd.mobile.ios.mios</groupId>
4-
<artifactId>xcode-project-reader</artifactId>
5-
<packaging>jar</packaging>
6-
<version>0.0.1-SNAPSHOT</version>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.sap.prd.mobile.ios.mios</groupId>
5+
<artifactId>xcode-project-reader</artifactId>
6+
<packaging>jar</packaging>
7+
<version>0.0.1-SNAPSHOT</version>
78

8-
<build>
9-
<plugins>
10-
<plugin>
11-
<groupId>org.apache.maven.plugins</groupId>
12-
<artifactId>maven-compiler-plugin</artifactId>
13-
<version>2.3.2</version>
14-
<configuration>
15-
<source>1.6</source>
16-
<target>1.6</target>
17-
</configuration>
18-
</plugin>
19-
<plugin>
20-
<artifactId>maven-source-plugin</artifactId>
21-
<version>2.1.2</version>
22-
<executions>
23-
<execution>
24-
<id>attach-sources</id>
25-
<goals>
26-
<goal>jar</goal>
27-
</goals>
28-
</execution>
29-
</executions>
30-
</plugin>
31-
</plugins>
32-
</build>
33-
<dependencies>
34-
35-
<dependency>
36-
<groupId>junit</groupId>
37-
<artifactId>junit</artifactId>
38-
<version>4.10</version>
39-
</dependency>
40-
</dependencies>
9+
<build>
10+
<plugins>
11+
<plugin>
12+
<groupId>org.apache.maven.plugins</groupId>
13+
<artifactId>maven-compiler-plugin</artifactId>
14+
<version>2.3.2</version>
15+
<configuration>
16+
<source>1.6</source>
17+
<target>1.6</target>
18+
</configuration>
19+
</plugin>
20+
<plugin>
21+
<artifactId>maven-source-plugin</artifactId>
22+
<version>2.1.2</version>
23+
<executions>
24+
<execution>
25+
<id>attach-sources</id>
26+
<goals>
27+
<goal>jar</goal>
28+
</goals>
29+
</execution>
30+
</executions>
31+
</plugin>
32+
</plugins>
33+
</build>
34+
<dependencies>
35+
<dependency>
36+
<groupId>apache-codec</groupId>
37+
<artifactId>commons-codec</artifactId>
38+
<version>1.2</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>junit</groupId>
42+
<artifactId>junit</artifactId>
43+
<version>4.10</version>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>xmlunit</groupId>
48+
<artifactId>xmlunit</artifactId>
49+
<version>1.3</version>
50+
<scope>test</scope>
51+
</dependency>
52+
</dependencies>
4153
</project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.sap.tip.production.xcode;
2+
3+
import java.util.List;
4+
5+
public interface Array extends List<Object>
6+
{
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.sap.tip.production.xcode;
2+
3+
public class BuildConfiguration extends NamedElement
4+
{
5+
public BuildConfiguration(ProjectFile projectFile)
6+
{
7+
this(projectFile, projectFile.createDict());
8+
}
9+
10+
BuildConfiguration(ProjectFile projectFile, Dict config)
11+
{
12+
super(projectFile, config);
13+
}
14+
15+
public BuildSettings getBuildSettings()
16+
{
17+
return new BuildSettings(getProjectFile(), getDict("buildSettings"));
18+
}
19+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.sap.tip.production.xcode;
2+
3+
public class BuildConfigurationList extends Element
4+
{
5+
public BuildConfigurationList(ProjectFile projectFile)
6+
{
7+
this(projectFile, projectFile.createDict());
8+
}
9+
10+
BuildConfigurationList(ProjectFile projectFile, Dict buildConfigurationList)
11+
{
12+
super(projectFile, buildConfigurationList);
13+
}
14+
15+
public String getDefaultConfigurationName()
16+
{
17+
return getString("defaultConfigurationName");
18+
}
19+
20+
public ReferenceArray<BuildConfiguration> getBuildConfigurations()
21+
{
22+
return new ReferenceArray<BuildConfiguration>(getProjectFile(),
23+
getOrCreateAndSetArray("buildConfigurations"), new ElementFactory<BuildConfiguration>() {
24+
@Override
25+
public BuildConfiguration create(ProjectFile projectFile, Dict dict)
26+
{
27+
return new BuildConfiguration(projectFile, dict);
28+
}
29+
});
30+
}
31+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.sap.tip.production.xcode;
2+
3+
public class BuildFile extends Element
4+
{
5+
public BuildFile(ProjectFile projectFile)
6+
{
7+
this(projectFile, projectFile.createDict());
8+
}
9+
10+
public BuildFile(ProjectFile projectFile, Dict dict)
11+
{
12+
super(projectFile, dict);
13+
}
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.sap.tip.production.xcode;
2+
3+
public class BuildSettings extends Element
4+
{
5+
public BuildSettings(ProjectFile projectFile)
6+
{
7+
this(projectFile, projectFile.createDict());
8+
}
9+
10+
BuildSettings(ProjectFile projectFile, Dict settings)
11+
{
12+
super(projectFile, settings);
13+
}
14+
15+
public String getProductName()
16+
{
17+
return getString("PRODUCT_NAME");
18+
}
19+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.sap.tip.production.xcode;
2+
3+
import java.util.Map;
4+
5+
public interface Dict extends Map<String, Object>, ValueProvider
6+
{
7+
8+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.sap.tip.production.xcode;
2+
3+
public abstract class Element implements ValueProvider
4+
{
5+
private final ProjectFile projectFile;
6+
private final Dict dict;
7+
8+
protected Element(ProjectFile projectFile, Dict dict)
9+
{
10+
this.projectFile = projectFile;
11+
this.dict = dict;
12+
}
13+
14+
protected ProjectFile getProjectFile()
15+
{
16+
return projectFile;
17+
}
18+
19+
public Dict getDict()
20+
{
21+
return dict;
22+
}
23+
24+
@Override
25+
public String getString(String key)
26+
{
27+
return dict.getString(key);
28+
}
29+
30+
@Override
31+
public void setString(String key, String value)
32+
{
33+
dict.setString(key, value);
34+
}
35+
36+
@Override
37+
public Array getArray(String key)
38+
{
39+
return dict.getArray(key);
40+
}
41+
42+
@Override
43+
public Array getOrCreateAndSetArray(String key)
44+
{
45+
return dict.getOrCreateAndSetArray(key);
46+
}
47+
48+
@Override
49+
public void setArray(String key, Array value)
50+
{
51+
dict.setArray(key, value);
52+
}
53+
54+
@Override
55+
public Dict getDict(String key)
56+
{
57+
return dict.getDict(key);
58+
}
59+
60+
@Override
61+
public Dict getOrCreateAndSetDict(String key)
62+
{
63+
return dict.getOrCreateAndSetDict(key);
64+
}
65+
66+
@Override
67+
public void setDict(String key, Dict value)
68+
{
69+
dict.setDict(key, value);
70+
}
71+
72+
public String getIsA()
73+
{
74+
return getString("isa");
75+
}
76+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.sap.tip.production.xcode;
2+
3+
public interface ElementFactory<T extends Element>
4+
{
5+
T create(ProjectFile projectFile, Dict dict);
6+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.sap.tip.production.xcode;
2+
3+
public abstract class NamedElement extends Element
4+
{
5+
protected NamedElement(ProjectFile projectFile, Dict dict)
6+
{
7+
super(projectFile, dict);
8+
}
9+
10+
public String getName()
11+
{
12+
return getString("name");
13+
}
14+
15+
public void setName(String name)
16+
{
17+
setString("name", name);
18+
}
19+
}

0 commit comments

Comments
 (0)