78
|
1 |
|
|
2 |
#####################################
|
|
3 |
# #
|
|
4 |
# Update Content And Filenames tool #
|
|
5 |
# #
|
|
6 |
#####################################
|
|
7 |
|
|
8 |
The Update Content And Filenames tool allows you to clone this component to a new implementation.
|
|
9 |
It does the boring housekeeping to rename the source, change target DLL name,
|
|
10 |
update the UIDs etc. etc.
|
|
11 |
It does this by performing recursive search and replace on file names and content.
|
|
12 |
|
|
13 |
|
|
14 |
How to clone this component to a new implementation:
|
|
15 |
|
|
16 |
- Ensure this component builds as is:
|
|
17 |
cd group
|
|
18 |
sbs -c winscw_udeb
|
|
19 |
sbs -c winscw_udeb.test
|
|
20 |
If you're feeling conscientious you could test it too :-)
|
|
21 |
|
|
22 |
- Nominate an appropriate name for the new component.
|
|
23 |
e.g. Test123
|
|
24 |
If there's any chance the new component will end up
|
|
25 |
in a deliverable, please choose the name more carefully
|
|
26 |
than I just did
|
|
27 |
|
|
28 |
- Copy this folder (the one containing this README file),
|
|
29 |
naming the new folder as something appropriate,
|
|
30 |
relating to the component name you have chosen
|
|
31 |
(and keep it lower case to keep linux builds happy)
|
|
32 |
e.g. "Copy Of mbufgobblerlayer" => "test123layer"
|
|
33 |
|
|
34 |
- Ensure the new folder and all its contents are writable.
|
|
35 |
(if you got mbufgobblerlayer from a version control system it might be read-only)
|
|
36 |
|
|
37 |
Then, in the *new* folder:
|
|
38 |
|
|
39 |
- Modify the file UpdateContentsAndFilenames.ini accordingly,
|
|
40 |
to reflect the values required by your new component.
|
|
41 |
Obviously you'll need to obtain new UIds rather than just making them up :-)
|
|
42 |
(Ask your architect where new UIds should come from these days)
|
|
43 |
The "Search" fields specify the current values which will be replaced.
|
|
44 |
The "Replace" fields must be changed from CHANGEME to the desired values.
|
|
45 |
e.g. [Name].Replace=CHANGEME => [Name].Replace=Test123
|
|
46 |
e.g. [DllUid].Replace=CHANGEME => [DllUid].Replace=01234567
|
|
47 |
etc..
|
|
48 |
|
|
49 |
- Ensure Python 2.6.2 or greater is installed. This should come down automatically
|
|
50 |
with SymSEE or whatever you used to put together your development environment.
|
|
51 |
|
|
52 |
- Open a command window in the *new* folder, and run:
|
|
53 |
updatecontentandfilenames.py
|
|
54 |
|
|
55 |
- Before you make further modifications, ensure the script updated
|
|
56 |
everything correctly:
|
|
57 |
cd group
|
|
58 |
sbs -c winscw_udeb
|
|
59 |
sbs -c winscw_udeb.test
|
|
60 |
(and run any regression tests over the new copy of the component)
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
Notes and caveats:
|
|
65 |
|
|
66 |
1.
|
|
67 |
Remember you're taking a copy, so if you're cloning something feature-rich,
|
|
68 |
please think carefully about whether either..
|
|
69 |
- you really do want 2 copies of the same feature code knocking about, which is
|
|
70 |
totally ok if you're just trying something out and/or you want to isolate the new
|
|
71 |
component from changes in the cloned component
|
|
72 |
.. or ..
|
|
73 |
- you should be considering cloning a more basic implementation,
|
|
74 |
then applying techniques such as inheritance to reuse the existing features
|
|
75 |
|
|
76 |
|
|
77 |
So it's more suited for cloning basic ("feature-impoverished?") implementations as a
|
|
78 |
starting point for developing more functional implementations.
|
|
79 |
|
|
80 |
e.g. mbufgobbler Layer -> some new layer
|
|
81 |
|
|
82 |
|
|
83 |
2.
|
|
84 |
Correct functioning of the script of course assumes some reasonably pragmatic
|
|
85 |
correlation between class names, folder names, dll names etc.
|
|
86 |
|
|
87 |
It's easy for you to add extra search and replace pairs as needed to address
|
|
88 |
more complicated renaming tasks. Just add more sections to the
|
|
89 |
UpdateContentsAndFilenames.ini file. The [Header Names] are not used for anything, they're
|
|
90 |
just for your reference and should probably be unique across the file.
|
|
91 |
The really important bit is the Search/Replace pairs.
|
|
92 |
|
|
93 |
|
|
94 |
3.
|
|
95 |
Each search/replace pair is applied in turn. So don't expect to be able to do anything
|
|
96 |
sneaky like swapping strings in a single run.
|
|
97 |
|
|
98 |
|
|
99 |
4.
|
|
100 |
Reusing this script elsewhere should be easy,
|
|
101 |
because there is no special significance to the .ini file section names-
|
|
102 |
they are just there to assist the user in populating the fields.
|
|
103 |
i.e. .ini file sections purely exist to group together each Search/Replace pair.
|
|
104 |
|
|
105 |
Just copy the updatecontentandfilenames.* files into the root folder of a new
|
|
106 |
copy of the component that you want to clone, edit the ini file, and run the python script.
|
|
107 |
|
|
108 |
|
|
109 |
5.
|
|
110 |
Have fun..
|
|
111 |
|
|
112 |
|