The modern standard is that "between two or more independent discoverers, the first to make formal publication is the legitimate winner", colorfully described as publish or perish. This was not always the case. In 16-th century it was common for scientists to hide their discoveries and assert their priority by challenging others to solve problems they could solve, Tartaglia's story being a famous example. Nor was it the case in the 17-th century, when Newton and others coded their discoveries into anagrams instead of publicizing them. It is interesting that in some early versions of the patent law "actual use of the invention was deemed adequate disclosure to the public" too.
Wikipedia says that the publish or perish rule came into effect "as soon as modern scientific methods were established" and mentions Newton and Leibniz, which is ironic since in the calculus priority dispute there never was any doubt that Leibniz published first. The point of contention rather was whether he saw Newton's private letters sent to Collins and Oldenburg prior to that. Even in 19-th century Gauss is often credited with discovering non-Euclidean geometry based on his private papers, even though he not only never published his findings but made a point of not even mentioning them publicly for fear of "the scream of beotians".
When did publish or perish become the "ironclad" priority rule? Unlike patents and copyrights it was never codified into law, so what was the mechanism of its adoption? Did Academies and Royal Societies play a role? Was it influenced by developments in patent and copyright law? When did universities start basing their hiring decisions on publications as they do now?