Programmatic project script library updates

Hello!

Is there anything I could do to programmatically update project’s script library?

It’d be used in a module build script to automatically re-generate any java-to-python bindings for
the module and it would reduce significant amount of manual work.

Thanks!

I guess refer to my other post :slight_smile:

I’d guess you could do something like this:

  1. Grab all projects
  2. For each grab the ScriptLibrary object
  3. Modify it
  4. Serialize it, and update the ProjectResource to include it.

I threw together some pseudocode to do this.

[code] for (Project project : context.getProjectManager().getProjectsFull(ProjectVersion.Staging)) {
for (ProjectResource resource : project.getResourcesOfType("", “sr.script.library”)) {
// Grab the scriptLibraries
List scriptLibraries = new ArrayList();
for (Object o : context.createDeserializer().deserialize(resource.getData()).getRootObjects()) {
if (o instanceof ScriptLibrary) {
scriptLibraries.add((ScriptLibrary) o);
}
}
// TODO: Modification code

			// Re-serialize them, and add them back to the project
		}
	}[/code]

I don’t know if the ProjectResource actually has more than one ScriptLibrary living in it.

It appears the GatewayContext doesnt have a context.createSerializer() though.

IA guys, is there any way to serialize from the gateway?

Not currently. Sounds like he wanted to do it as part of the build though? I’m not sure what bindings exactly are being re-created here…