What is the largest structure humans could build in space not crushed by its own gravity?

For example, the Imperial Star Destroyer from Star Wars is 1.6km in length and has a mass of 36 billion kg.

The Death Star also from Star Wars is a sphere with a diameter of 160km, and a mass of approximately 3.0 trillion kg.

Is it within the laws of physics that an advanced civilization could build structures to that size?