~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2003, 2007 IBM Corporation and others.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 *     IBM - Initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.cdt.managedbuilder.internal.core;
 
12
 
 
13
 
 
14
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
 
15
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 
16
import org.osgi.framework.Version;
 
17
 
 
18
public class BuildObject implements IBuildObject {
 
19
 
 
20
        protected String id;
 
21
        protected String name;
 
22
        private String baseId=null;
 
23
        
 
24
        protected Version version = null;
 
25
        protected String managedBuildRevision = null;
 
26
                
 
27
        /* (non-Javadoc)
 
28
         * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
 
29
         */
 
30
        public String getId() {
 
31
                return id;
 
32
        }
 
33
 
 
34
        /* (non-Javadoc)
 
35
         * @see org.eclipse.cdt.core.build.managed.IBuildObject#setId(java.lang.String)
 
36
         */
 
37
        public void setId(String id) {
 
38
                this.id = id;
 
39
        }
 
40
 
 
41
        /* (non-Javadoc)
 
42
         * @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
 
43
         */
 
44
        public String getName() {
 
45
                return name;
 
46
        }
 
47
        
 
48
        /* (non-Javadoc)
 
49
         * @see org.eclipse.cdt.core.build.managed.IBuildObject#setName(java.lang.String)
 
50
         */
 
51
        public void setName(String name) {
 
52
                this.name = name;
 
53
        }
 
54
 
 
55
        /* (non-Javadoc)
 
56
         * @see java.lang.Object#toString()
 
57
         */
 
58
        @Override
 
59
        public String toString() {
 
60
                return name;
 
61
        }
 
62
        
 
63
        /**
 
64
         * @return Returns the managedBuildRevision.
 
65
         */
 
66
        public String getManagedBuildRevision() {
 
67
                return managedBuildRevision;
 
68
        }
 
69
        
 
70
        /**
 
71
         * @return Returns the version.
 
72
         */
 
73
        public Version getVersion() {
 
74
                        return version;
 
75
        }
 
76
 
 
77
        /**
 
78
         * @param version The version to set.
 
79
         */
 
80
        public void setVersion(Version version) {
 
81
                this.version = version;
 
82
        }
 
83
 
 
84
        /**
 
85
         * @return id of the object this class was based on. Note that this function 
 
86
         *    assumes that id was generated by {@link ManagedBuildManager#calculateChildId(String, String)}.
 
87
         */
 
88
        public String getBaseId() {
 
89
                if (baseId==null)
 
90
                        baseId = ManagedBuildManager.calculateBaseId(id);
 
91
                return baseId;
 
92
        }
 
93
 
 
94
        
 
95
        public Version getVersionFromId() {
 
96
                String versionNumber = ManagedBuildManager.getVersionFromIdAndVersion( getId());
 
97
                
 
98
                if( versionNumber == null) {
 
99
                        // It means, Tool Integrator either not provided version information in 'id' or  provided in wrong format,
 
100
                        // So get the default version based on 'managedBuildRevision' attribute.
 
101
                                                                
 
102
                        if ( getManagedBuildRevision() != null) {
 
103
                                Version tmpManagedBuildRevision = new Version( getManagedBuildRevision() );
 
104
                                if (tmpManagedBuildRevision.equals(new Version("1.2.0")) )      //$NON-NLS-1$
 
105
                                        versionNumber = "0.0.1";        //$NON-NLS-1$
 
106
                                else if (tmpManagedBuildRevision.equals(new Version("2.0.0")) ) //$NON-NLS-1$
 
107
                                        versionNumber = "0.0.2";        //$NON-NLS-1$
 
108
                                else if (tmpManagedBuildRevision.equals(new Version("2.1.0")) ) //$NON-NLS-1$
 
109
                                        versionNumber = "0.0.3";        //$NON-NLS-1$
 
110
                                else
 
111
                                        versionNumber = "0.0.4";        //$NON-NLS-1$
 
112
                        } else {
 
113
                                versionNumber = "0.0.0";        //$NON-NLS-1$
 
114
                        }
 
115
                }
 
116
                return new Version(versionNumber);
 
117
        }
 
118
 
 
119
        public void setManagedBuildRevision(String managedBuildRevision) {
 
120
                this.managedBuildRevision = managedBuildRevision;
 
121
        }
 
122
        
 
123
        /*
 
124
         * updates revision for this build object and all its children
 
125
         */
 
126
        public void updateManagedBuildRevision(String revision){
 
127
                setManagedBuildRevision(revision);
 
128
                setVersion(getVersionFromId());
 
129
        }
 
130
}