Mark exported classes in Eclipse to not modify - eclipse

in my workpsace i do have SVN checkout classes and SVN export classes.
I seperate the classes into two working sets. The exported classes are members of another feature based project and i am not allowed to change this classes inside my workspace.
When i want to fix a bug or implement new features i want to be sure, that the exported classes are not touched.
Can i mark exported classes with a flag, that i can not modify this classes in my workspace. Something like read only would help. Does somebody knows a similar problem with an existing solution.
Thanks

There are two things I can think of that might help here.
Mark everything as read-only in the file system. If you edit in eclipse, it will prompt you if you try to edit it, asking if you want to make it read/write.
Mark everything as derived. Same type of prompting will occur, warning you it's a derived file. The problem here is that unless you have a plugin that can mark things as derived, you'll need to mark every file. (Writing such a plugin is very easy though - if you want to take this approach, email me: scott#javadude.com)
Neither of these will completely stop you, but the prompting might help (and if you do both you'll get two prompts...)
Hope this helps!

Related

Namespacing My Unity Project Scripts

I create tools for the Unity Asset Store and one of my tools is in conflict with other assets people bought from the store which is resulting in unwanted errors. From talking this over with people they said that I should just "namespace TrollBridge{}" EVERY script. Would this be a way of doing it or do I only need to do certain scripts? Even data structure scripts? If it is just certain scripts what exactly am I looking for about these scripts to throw the "namespace TrollBridge {}" on it? I think I understand the whole encapsulation concept with this but maybe I am missing something when it comes to selling tools for other people? Thanks in advance.
Would this be a way of doing it
Yes.
or do I only need to do certain scripts?
Do it for all your scripts.
Even data structure scripts?
Yes, even that. All your classes for this should be in a namespace.
To make this answer short, put all your scripts in a namespace. The reason for this is that you will be distributing this with thousands of people or even hundreds of thousands.
Let's say that someone is using another plugin called Lighting and that plugin has a class called Lighting. Ask yourself what happens when you release your own plugin with a class called Lighting?
I have seen this happen before between two plugins which led to many complains. The publisher had to add namespace to all their script which broke many old projects.
Do it right now so that you won't have this problem in the future. Name your namespace a name you think does not exist in the Asset Store and resonates with the function of your plugin.

"private" comments in Eclipse

I would like to write "private" comments in Eclipse while working on Java projects. In other words, I would like to write comments associated with areas in the Java classes that only I can see but other developers working on the project cannot. The comments therefore cannot be regular comments in the source code. Ideally I would select an area on a Java source file and have a view in the perspective allowing me to write and read my comments associated with the selected area. Those comments should be persisted in a file(s) outside of the Java source files of the project.
I understand that as other developers modify the Java code my comments might become stale and I will have to eventually have to work to alleviate this problem. I am not worried about the persistence right now, either.
How do I handle the Eclipse part of the challenge, i.e. create my own view in/to which I can write/read comments and have it associated with locations in the source files? Or, can I display comments lines in the source files that are not saved along with the source so that they are "private"?
This sounds like what you can already do with the Bookmarks View, aside from the text presentation in the view itself being rather limited.

Where does Eclipse store information about which files are "Derived"?

When you change the classpath of an Eclipse project, the .classpath file changes so that if you send the project to someone else (including the .classpath file) they have the same classpath. But when you change a resource to "Derived", there is no change in either .project or .classpath. So where is Eclipse storing the information about which files and folders are derived?
Edit: I found this: "currently the derived state is stored in a single bit within a
flag integer associated with each resource in the workspace tree file" but if someone could explain more precisely where that flag integer is stored, and how to change it, that would be quite appreciated.
Long discussion on this eclipse bug which requests that derived state is persisted with the eclipse project settings (which can be shared), rather than in the workspace metadata (which can not). The bug is quite old, and remains unaddressed, but there is quite a lot of discussion.
My situation is that I'm generating a lot of java class files as part of an ant build in a workspace directory, and want to mark them as derived so they don't show up in searches. I think the option I will take is probably to adjust my automation so that it marks its generated resources as derived:
IResource.setDerived(true);
The OP's situation seems somewhat different. I'd probably try and base my project's build paths on a variable which each user can define independently, so your .classpath file is the same for all users.
This is not an answer to the question, but something that is directly related what I believe to be the issue at hand. That being the ability to share which files should be derived in a project with others.
Found this plugin to address that:
http://nodj.github.io/AutoDeriv/

Why do I have to routinely Clean one particular project in Eclipse?

I am using Eclipse 3.5 for several different Java/JSP projects. All of our project code is stored in Subversion. I use the Subclipse plugin to update / commit code. This works great for all projects except one. There is one project where almost every time I do a SVN update, the entire project becomes riddled with Java compile errors. Most of the errors are complaints that it can't find other class files within the same project. To resolve this, I have to go to Project > Clean and manually clean out the project, which takes a little while to run. Everything compiles just fine after this, but it is a bit of a pain to have to manually clean the project every time I do a SVN update. And this only happens for this one single project.
Anyone experience something like this? I am not even sure where to look to figure out why the project needs to constantly be manually cleaned. Is it possible that someone else is checking in a file that breaks my project build in Eclipse? If so, what file(s) should I look for?
First, excuse me if I say something obvious, but you didn't give any details of your project configuration, nor described your previous attempts at solving this issue. So, maybe you've already tried everything I'm going to suggest... ;-)
Off the top of my mind, I'd check whether someone else is committing compiled classes, instead of sources only.
Other than that, it depends on your configuration: I'm assuming that you've got the "Build automatically" flag checked, that you're building through Eclipse only (and not, for example, through Ant, letting maybe the Ant build put its output somewhere in your classpath), and that you're not versioning jars nor your .classpath file.
I suggest (if you're not doing so) to perform your SVN updates going through the Synchronize view (Team -> Synchronize with Repository), in order to see at a glance what kind of incoming changes you've got, to better distinguish cases when your project gets messed up from cases when it doesn't.
Some one already explained that, may be someone else also committing the compiled classes , and the class paths are getting conflicts. Fist know this info from your collegues and proceed. I didn't come across this situation. sorry.
How are you storing the project on SVN? Are you storing the entire Eclipse project or just source code, structure, etc? If you're not storing the entire project I'd suggest doing that as it makes it easier to work with (unless you've got somebody using a different IDE). Without some more information it makes it hard to diagnose, but it certainly sounds like somebody is committing compiled class paths. You should check the SVN history to confirm.

How to handle different csproj [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I am working in a team of five. We are working on a C# application with five csprojects.
The problem is that for each csproject, each of my colleagues has their own ideas on how to reference a DLL; some would like to link in by Project reference, other would like to link in the DLL only. So each and every one of us will have our own csproject.
I want all of them to check in their csproject; but given that every copy of csproject is different, there isn't really a feasible mechanism to do that, is there? But if I don't ask them to check in their csproject, then every time they add a new file, I would have to manually edit my csproject and that's very tedious, not to mention that it beats the purpose of continuous integration.
Is there any strategy to handle this? I know it would be best to enforce a standard, but is there any other option leaving this aside?
There is a reason why the csproject content is different for everyone; not everyone has all of the five csprojects, and not everyone can have all of the 5 csprojects. So invariably some will have to end up having to reference DLLs instead of projects, and some want to reference by projects for the ease of debugging. If I were to enforce a standard, as the answers here suggest, I would have to solve this issue.
As to why we need to split into multiple csprojects, that's because we want to reuse some parts of the code for other applications, and because not everyone can have all access to the source code. It's more political than technological.
Your problem is not how to handle it with Source Control.
Your problem is that you (or management) needs to get your team to adopt a set of standards the entire team follows.
If you let everyone follow their own mish-mash of ideas and do not get team cohesion on the basics it will only end in tears...
You're almost certainly solving the wrong problem. If you fork the .csproj files to cater to invididual preferences, you are incurring additional work and introducing the likelihood of errors, for exactly the reason you describe -- every time Alice adds a file to AlicesX.csproj, Bob has to learn about this and add the same file to BobsX.csproj.
You really need to consider this as a problem of standards and team dynamics: agree on how DLLs will be referenced in the master sources, and require everyone to stick to that. If the "losing" side don't like to work that way, sure, they can use their preferred style in their private working copies. But you really only want one master source, and you want to work towards getting everybody to buy into the way the master source does it.
Per your edit: If you really, really cannot come to an agreement with your colleagues, then I would still suggest a single master, but write a little utility that the dissenters can use that converts project references to DLL references (or vice versa). .csproj files are just XML so this is pretty trivial to do. If you cannot even agree on what is going to be the repository format, then you will need to maintain parallel .csproj files, but I'd still write the utility to ensure that changes made to DllReferencingProj.csproj get copied to ProjectReferencingProj.csproj. But I still say you're just making more work and storing up more pain for yourself than if you had the squabble and got it over with: in order to function as a team, you're going to need to find some way of resolving disputes, and this is as good as test case as any.
Time to make everyone grow up and follow a standard. If you're all working on the same code you should decide together whether referencing the dll or the project is best and then stick to it. Once you guys figure this one out you can decide whether to indent 2 or 4 spaces or a tab. Then decide whether to put your curly braces on the same line as or the next line after your function declarations. I'm not even going to speak to the vagaries of Hungarian notation...
Our configuration is as follows:
Project -> copy dll to common folder
Project -> copy dll to common folder
Main Project -> Copy exe to common folder, run application from common folder
Doesn't much matter how you reference using this configuration, the dlls will be picked up from the application folder and you're golden.
Continuous integration shouldn't care about your .csproj files. I guess they're MSBUILD files? Or something?
Don't use them for CI. They're junk. They accrue garbage because they make too many things invisible. Create a clean build structure that is independent of them, you'll be thankful you did. And then only check in a project file when you're adding something, and everyone else can update/merge. You don't need to have the same or even similar project files most of the time. On my team we don't even run the same version of VS across all workstations.